PEBL 2.2
Psychology Experiment Building Language - Cross-platform psychological experiment development system
sdl/PlatformLabel.h
Go to the documentation of this file.
1//* -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- */
3// Name: src/platforms/sdl/PlatformLabel.h
4// Purpose: Contains SDL-specific interface for text labels
5// Author: Shane T. Mueller, Ph.D.
6// Copyright: (c) 2004-2026 Shane T. Mueller <smueller@obereed.net>
7// License: GPL 2
8//
9//
10//
11// This file is part of the PEBL project.
12//
13// PEBL is free software; you can redistribute it and/or modify
14// it under the terms of the GNU General Public License as published by
15// the Free Software Foundation; either version 2 of the License, or
16// (at your option) any later version.
17//
18// PEBL is distributed in the hope that it will be useful,
19// but WITHOUT ANY WARRANTY; without even the implied warranty of
20// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21// GNU General Public License for more details.
22//
23// You should have received a copy of the GNU General Public License
24// along with PEBL; if not, write to the Free Software
25// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27#ifndef __PLATFORMLABEL_H__
28#define __PLATFORMLABEL_H__
29
30#include "PlatformWidget.h"
31#include "PlatformFont.h"
32#include "../../objects/PLabel.h"
33#include "../../utility/rc_ptrs.h"
34#include "../../base/PEBLObject.h"
35#ifdef PEBL_OSX
36#include "SDL.h"
37#include "SDL_ttf.h"
38#else
39#include "SDL.h"
40#include "SDL_ttf.h"
41#endif
42
43
47
48
49class PlatformLabel: virtual public PlatformWidget,virtual public PLabel
50{
51public:
52 PlatformLabel(const std::string & text, counted_ptr<PEBLObjectBase> font);
53
56
57 virtual ~PlatformLabel();
58
59
60 virtual bool RenderText();
61
62 //These need to be overridden because the text needs to be re-rendered when they are called.
63 virtual bool SetProperty(std::string, Variant v);
64 virtual void SetFont(counted_ptr<PEBLObjectBase> font);
65 virtual void SetText(const std::string & text);
66
67 virtual bool Draw();
68
69 virtual counted_ptr<PEBLObjectBase> GetFont(){return mFontObject;}
70 virtual std::string ObjectName()const{return "PlatformLabel";} ;
71
72protected:
73 virtual std::ostream & SendToStream(std::ostream& out) const;
74
75private:
76 // Helper to get PlatformFont pointer from counted_ptr when needed
77 PlatformFont* GetPlatformFont() const {
78 return dynamic_cast<PlatformFont*>(mFontObject.get());
79 }
80
82};
83
84
85
86#endif
Validator platform label - no rendering, used only for compilation.
virtual bool Draw()
This method initiates everything needed to display the main window
virtual void SetText(const std::string &text)
virtual counted_ptr< PEBLObjectBase > GetFont()
virtual std::ostream & SendToStream(std::ostream &out) const
An inheritable printing class used by PEBLObjectBase::operator<<.
virtual std::string ObjectName() const
virtual bool RenderText()
virtual ~PlatformLabel()
Standard Destructor.
virtual bool SetProperty(std::string, Variant v)
virtual void SetFont(counted_ptr< PEBLObjectBase > font)
X * get() const
Definition rc_ptrs.h:110