PEBL 2.2
Psychology Experiment Building Language - Cross-platform psychological experiment development system
PTextObject.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/objects/PWord.h
4// Purpose: Contains generic specs for all objects containing text
5// Author: Shane T. Mueller, Ph.D.
6// Copyright: (c) 2003-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 __PTEXTOBJECT_H__
28#define __PTEXTOBJECT_H__
29
30
31#include "PWidget.h"
32#include "PFont.h"
33#include "PColor.h"
34#include "../utility/rc_ptrs.h"
35
36#include <string>
37
39
40class PTextObject: virtual public PWidget
41{
42public:
44 PTextObject(const std::string & text);
45 PTextObject(PTextObject & object);
46 virtual ~PTextObject();
47
48 //overloaded generic PObject methods
49 virtual bool SetProperty(std::string, Variant v);
50 virtual Variant GetProperty(std::string)const;
51 virtual ObjectValidationError ValidateProperty(std::string, Variant v)const;
52 virtual ObjectValidationError ValidateProperty(std::string)const;
53
54 virtual void SetText(const std::string & text);
55 virtual void SetDirection(int i);
56 virtual std::string GetText()const {return mText;}
57
58 virtual unsigned long int GetNumCharacters(){return mText.length();}
59
60
61private:
62
63
64protected:
65
66
67 virtual std::ostream & SendToStream(std::ostream& out) const{return out;};
68
69 bool mChanged; //Determines whether the object should be re-rendered.
70 std::string mText;
71 virtual std::string ObjectName() const{return "PTextObject";};
72 int mDirection; //1 for ltr, -1 for rtl
73
74};
75
76
77#endif
ObjectValidationError
Definition PEBLObject.h:37
This class simply represent an abstract text-based object.
Definition PTextObject.h:41
virtual ObjectValidationError ValidateProperty(std::string, Variant v) const
virtual bool SetProperty(std::string, Variant v)
virtual unsigned long int GetNumCharacters()
Definition PTextObject.h:58
std::string mText
Definition PTextObject.h:70
virtual std::string ObjectName() const
Definition PTextObject.h:71
virtual std::ostream & SendToStream(std::ostream &out) const
An inheritable printing class used by PEBLObjectBase::operator<<.
Definition PTextObject.h:67
virtual Variant GetProperty(std::string) const
virtual ~PTextObject()
virtual void SetDirection(int i)
virtual void SetText(const std::string &text)
virtual std::string GetText() const
Definition PTextObject.h:56