tbx  0.7.5
Public Types | Public Member Functions | List of all members
tbx::TextArea Class Reference

Class to manipulate a toolbox TextArea gadget. More...

#include <textarea.h>

Inheritance diagram for tbx::TextArea:
tbx::Gadget tbx::Component

Public Types

enum  { TOOLBOX_CLASS = 0x4018 }
 

Public Member Functions

 TextArea ()
 Construct an uninitialised text area.
 
 ~TextArea ()
 Destroy a text area gadget. More...
 
 TextArea (const TextArea &other)
 Construct a text area from another text area. More...
 
 TextArea (const Gadget &other)
 Construct a text area from another gadget. More...
 
 TextArea (const Component &other)
 Construct a text area from a gadget. More...
 
TextAreaoperator= (const TextArea &other)
 Assign a text area to refer to the same underlying toolbox gadget as another.
 
TextAreaoperator= (const Gadget &other)
 Assign a text area to refer to the same underlying toolbox gadget as an existing Gadget. More...
 
TextAreaoperator= (const Component &other)
 Assign a text area to refer to the same underlying toolbox component as an existing Gadget. More...
 
bool operator== (const Gadget &other) const
 Check if this text area refers to the same underlying toolbox gadget as another gadget. More...
 
bool operator!= (const Gadget &other) const
 Check if this text area refers to the same underlying toolbox gadget as another gadget. More...
 
int state () const
 Return all state flags.
 
void state (int state)
 Set all state flags.
 
bool has_vertical_scrollbar () const
 Check if text area has a vertical scroll bar. More...
 
void has_vertical_scrollbar (bool value)
 Set if text area has a vertical scroll bar. More...
 
bool has_horizontal_scrollbar () const
 Check if text area has a horizontal scroll bar. More...
 
void has_horizontal_scrollbar (bool value)
 Set if text area has a horizontal scroll bar. More...
 
bool wordwrap () const
 Check if text area is wrapping words. More...
 
void wordwrap (bool value)
 Set word wrapping in the text area. More...
 
bool allow_selection () const
 Check if text area allows a selection to be made. More...
 
void allow_selection (bool value)
 Set if text can be selected in the text area. More...
 
bool allow_save () const
 Check if saving from the text area is allowed. More...
 
void allow_save (bool value)
 Set if saving is allowed in the text area. More...
 
bool allow_load () const
 Check if loading from the text area is allowed. More...
 
void allow_load (bool value)
 Set if loading is allowed in the text area. More...
 
bool clipboard () const
 Check if this text area supports the clipboard. More...
 
void clipboard (bool value)
 Set if clipboard support is used the text area. More...
 
bool auto_scroll () const
 Check if text area will auto scroll.
 
void auto_scroll (bool value)
 Set if text area will auto scroll. More...
 
void text (const std::string &text)
 Set the text in the text area. More...
 
std::string text () const
 Get the text from the text area. More...
 
int text_length () const
 Get the length of the text.
 
void insert_text (int where, const std::string &text)
 Insert text into the text area. More...
 
void replace_text (int start, int end, const std::string &text)
 Rpelace text in the text area. More...
 
void get_selecton (int &start, int &end) const
 Get location of selection. More...
 
void set_selection (int start, int end)
 Set the selection. More...
 
int selection_length () const
 Get the length of the selection.
 
std::string selection_text () const
 Get the text of the selection.
 
void font (const std::string &name, int width, int height)
 Set the font used for the scroll list items. More...
 
void system_font (int width, int height)
 Set the scroll list to use the system font to display the text. More...
 
void set_colour (WimpColour foreground, WimpColour background)
 Set the colours of the text area using WIMP colours. More...
 
void set_colour (Colour foreground, Colour background)
 Set the colours of the text area using RGB colours. More...
 
void get_colour (Colour &foreground, Colour &background) const
 Get the colours used in the text area. More...
 
void border_size (int value)
 Set the size of the border for the text area. More...
 
- Public Member Functions inherited from tbx::Gadget
 Gadget ()
 Construct an uninitialised gadget. More...
 
 Gadget (const Gadget &other)
 Construct a gadget as a copy of another gadget object. More...
 
 Gadget (const Component &other)
 Construct a gadget as a copy of another component object. More...
 
Window window ()
 Get the window that contains this gadget.
 
Window window () const
 Get the window that contains this gadget.
 
Gadgetoperator= (const Gadget &other)
 Assign this gadget to refer to the same underlying toolbox gadget as another gadget.
 
Gadgetoperator= (const Component &other)
 Assign this gadget to refer to the same underlying toolbox gadget as the specified Component. More...
 
bool operator== (const Component &other) const
 Check if this gadget refers to the same underlying toolbox component as the given Component. More...
 
bool operator!= (const Component &other) const
 Check if this gadget refers to the same underlying toolbox component as the given Component. More...
 
bool operator== (const Gadget &other) const
 Check if this gadget refers to the same underlying toolbox component as the given Gadget. More...
 
bool operator!= (const Gadget &other) const
 Check if this gadget refers to the same underlying toolbox component as the given Gadget. More...
 
void check_toolbox_class (int class_id) const
 Check the underlying gadget class for this object has the given class id. More...
 
int toolbox_class () const
 Get the toolbox class for a gadget. More...
 
int toolbox_class_and_size () const
 Get the toolbox class and size for a gadget. More...
 
unsigned int flags () const
 Return the gadget flags. More...
 
void set_flag (unsigned int set)
 Sets bits in the gadgets flags. More...
 
void clear_flag (unsigned int clear)
 Clear bits in the gadget flags. More...
 
void fade ()
 Fade the gadget.
 
void unfade ()
 Clear the gadgets fade state.
 
void fade (bool fade)
 Fade/unfade the gadget. More...
 
bool faded () const
 Check if the gadget is faded. More...
 
void focus ()
 Set input focus to the gadget. More...
 
std::vector< IconHandleicon_list ()
 Get list of icons used in this gadget. More...
 
BBox bounds () const
 Get the bounding box of the gadget.
 
void bounds (const BBox &bounds)
 Set the bounds of the gadget. More...
 
Point bottom_left () const
 Get the bottom left location of gadget. More...
 
Point top_left () const
 Get the top left location of gadget. More...
 
void move_to (const Point &pos)
 Move gadget (without resizing) More...
 
void move_to (int x, int y)
 Move gadget without resizing. More...
 
void move_by (int bx, int by)
 Move gadget relative to it's current position without resizing. More...
 
Size size () const
 Return the size of the gadget. More...
 
void size (const Size &sz)
 Set size of gadget without moving it. More...
 
void add_loader (Loader *loader, int file_type=-2)
 Add a file loader. More...
 
void remove_loader (Loader *loader, int file_type=-2)
 Remove a file loader. More...
 
- Public Member Functions inherited from tbx::Component
 Component ()
 Construct an uninitialised component. More...
 
 Component (Object obj, ComponentId id)
 Construct a component from an object and component id. More...
 
 Component (ObjectId handle, ComponentId id)
 Construct a component from an object handle and component id. More...
 
bool null () const
 Check if this component is in an uninitialised state. More...
 
Object object ()
 Return the object his component belongs to.
 
Object object () const
 Return the object his component belongs to.
 
ObjectId handle () const
 Return the object handle for his component.
 
ComponentId id () const
 Get the component ID of this component. More...
 
Componentoperator= (const Component &other)
 Assign the Component to refer to the same underlying toolbox component.
 
bool operator== (const Component &other) const
 Check if this component refers to the same underlying toolbox component. More...
 
bool operator!= (const Component &other) const
 Check if this component refers to the same underlying toolbox gadget. More...
 
void add_command (int command_id, Command *command)
 Add a command to this Component. More...
 
void remove_command (int command_id, Command *command)
 Remove a command from this component. More...
 
void add_user_event_listener (int event_id, UserEventListener *listener)
 Add a user event listener. More...
 
void remove_user_event_listener (int event_id, UserEventListener *listener)
 Remove a user event listener from this component. More...
 
void remove_all_listeners ()
 Remove all the listeners on this component. More...
 

Additional Inherited Members

- Protected Member Functions inherited from tbx::Component
void add_listener (int action, Listener *listener, RawToolboxEventHandler handler)
 Helper function to add listeners to this component. More...
 
void remove_listener (int action, Listener *listener)
 Helper function to remove listeners from this component.
 
void add_window_listener (int event_code, Listener *listener)
 Helper function to add a listener for a WIMP window event.
 
void remove_window_listener (int event_code, Listener *listener)
 Helper function to remove a listener for a WIMP window event.
 
int int_property (int property_id) const
 Get an integer property from the toolbox Component. More...
 
void int_property (int property_id, int value)
 Set an integer property from the toolbox object. More...
 
bool bool_property (int property_id) const
 Get a boolean property from the toolbox Component. More...
 
void bool_property (int property_id, bool value)
 Set a boolean property from the toolbox object. More...
 
std::string string_property (int property_id) const
 Get a string property from the toolbox object. More...
 
int string_property_length (int property_id) const
 Get a the length of a string property from the toolbox object. More...
 
void string_property (int property_id, const std::string &value)
 Set a string property in the toolbox object. More...
 
bool flag_property (int property_id, int flag) const
 Check if a particular flag is set in a property. More...
 
void flag_property (int property_id, int flag, bool value)
 Set a particular flag in a property. More...
 
- Protected Attributes inherited from tbx::Component
ObjectId _handle
 Underlying toolbox handle.
 
int _id
 Underlying toolbox component id.
 

Detailed Description

Class to manipulate a toolbox TextArea gadget.

A text area allows multiple lines of text to be displayed and/or editied in a window.

Constructor & Destructor Documentation

◆ ~TextArea()

tbx::TextArea::~TextArea ( )
inline

Destroy a text area gadget.

This does not delete the underlying toolbox gadget.

◆ TextArea() [1/3]

tbx::TextArea::TextArea ( const TextArea other)
inline

Construct a text area from another text area.

Both TextArea will refer to the same underlying toolbox gadget.

◆ TextArea() [2/3]

tbx::TextArea::TextArea ( const Gadget other)
inline

Construct a text area from another gadget.

The TextArea and the Gadget will refer to the same underlying toolbox gadget.

Exceptions
GadgetClassErrorif the underlying toolbox gadget isn't a text area

◆ TextArea() [3/3]

tbx::TextArea::TextArea ( const Component other)
inline

Construct a text area from a gadget.

The TextArea and the Component will refer to the same underlying toolbox component.

Member Function Documentation

◆ allow_load() [1/2]

bool tbx::TextArea::allow_load ( ) const
inline

Check if loading from the text area is allowed.

Returns
true if loading from the text area is allowed

◆ allow_load() [2/2]

void tbx::TextArea::allow_load ( bool  value)
inline

Set if loading is allowed in the text area.

Parameters
valuetrue if loading is allowed, false if loading is not allowed

◆ allow_save() [1/2]

bool tbx::TextArea::allow_save ( ) const
inline

Check if saving from the text area is allowed.

Returns
true if saving from the text area is allowed

◆ allow_save() [2/2]

void tbx::TextArea::allow_save ( bool  value)
inline

Set if saving is allowed in the text area.

Parameters
valuetrue if saving is allowed, false if saving is not allowed

◆ allow_selection() [1/2]

bool tbx::TextArea::allow_selection ( ) const
inline

Check if text area allows a selection to be made.

Returns
true if selection is allowed

◆ allow_selection() [2/2]

void tbx::TextArea::allow_selection ( bool  value)
inline

Set if text can be selected in the text area.

Parameters
valuetrue to allow selection, false to disallow selection.

◆ auto_scroll()

void tbx::TextArea::auto_scroll ( bool  value)
inline

Set if text area will auto scroll.

Parameters
valuetrue to set auto scrolling mode, false to unset it

◆ border_size()

void tbx::TextArea::border_size ( int  value)
inline

Set the size of the border for the text area.

Parameters
valuenew border size in OS units

◆ clipboard() [1/2]

bool tbx::TextArea::clipboard ( ) const
inline

Check if this text area supports the clipboard.

Returns
true if the text area supports the clipboard

◆ clipboard() [2/2]

void tbx::TextArea::clipboard ( bool  value)
inline

Set if clipboard support is used the text area.

Parameters
valuetrue if the clipboard is supported, false if not

◆ font()

void tbx::TextArea::font ( const std::string &  name,
int  width,
int  height 
)

Set the font used for the scroll list items.

Parameters
nameThe name of the font
widthfont width in 16ths of a point
heightfont height in 16ths of a point

◆ get_colour()

void tbx::TextArea::get_colour ( Colour foreground,
Colour background 
) const

Get the colours used in the text area.

Parameters
foregroundupdated to foreground/text colour
backgroundupdated to background/text colour

◆ get_selecton()

void tbx::TextArea::get_selecton ( int &  start,
int &  end 
) const

Get location of selection.

Parameters
startupdated with start of selection
endupdated with end of selection

◆ has_horizontal_scrollbar() [1/2]

bool tbx::TextArea::has_horizontal_scrollbar ( ) const
inline

Check if text area has a horizontal scroll bar.

Returns
true if the text area has a horizontal scroll bar

◆ has_horizontal_scrollbar() [2/2]

void tbx::TextArea::has_horizontal_scrollbar ( bool  value)
inline

Set if text area has a horizontal scroll bar.

Parameters
valuetrue to turn on the scroll bar, false to turn it off

◆ has_vertical_scrollbar() [1/2]

bool tbx::TextArea::has_vertical_scrollbar ( ) const
inline

Check if text area has a vertical scroll bar.

Returns
true if the text area has a vertical scroll bar

◆ has_vertical_scrollbar() [2/2]

void tbx::TextArea::has_vertical_scrollbar ( bool  value)
inline

Set if text area has a vertical scroll bar.

Parameters
valuetrue to turn on the scroll bar, false to turn it off

◆ insert_text()

void tbx::TextArea::insert_text ( int  where,
const std::string &  text 
)

Insert text into the text area.

Parameters
whereposition to insert the text
texttext to insert

◆ operator!=()

bool tbx::TextArea::operator!= ( const Gadget other) const
inline

Check if this text area refers to the same underlying toolbox gadget as another gadget.

Returns
true if they do not refer to the same underlying toolbox gadget.

◆ operator=() [1/2]

TextArea& tbx::TextArea::operator= ( const Gadget other)
inline

Assign a text area to refer to the same underlying toolbox gadget as an existing Gadget.

Exceptions
GadgetClassErrorif the underlying toolbox gadget isn't a text area

◆ operator=() [2/2]

TextArea& tbx::TextArea::operator= ( const Component other)
inline

Assign a text area to refer to the same underlying toolbox component as an existing Gadget.

Exceptions
ObjectClassErrorif the component is not in a window.
GadgetClassErrorif the underlying toolbox gadget isn't a text area

◆ operator==()

bool tbx::TextArea::operator== ( const Gadget other) const
inline

Check if this text area refers to the same underlying toolbox gadget as another gadget.

Returns
true if they refer to the same underlying toolbox gadget.

◆ replace_text()

void tbx::TextArea::replace_text ( int  start,
int  end,
const std::string &  text 
)

Rpelace text in the text area.

Parameters
startposition of first character to replace
endposition of last character to replace
textnew text

◆ set_colour() [1/2]

void tbx::TextArea::set_colour ( WimpColour  foreground,
WimpColour  background 
)

Set the colours of the text area using WIMP colours.

Parameters
foregroundforeground/text colour
backgroundbackground colour

◆ set_colour() [2/2]

void tbx::TextArea::set_colour ( Colour  foreground,
Colour  background 
)

Set the colours of the text area using RGB colours.

Parameters
foregroundforeground/text colour
backgroundbackground colour

◆ set_selection()

void tbx::TextArea::set_selection ( int  start,
int  end 
)

Set the selection.

Parameters
startnew start position of the selection
endnew end position of the selection

◆ system_font()

void tbx::TextArea::system_font ( int  width,
int  height 
)

Set the scroll list to use the system font to display the text.

Parameters
widthfont width in 16ths of a point
heightfont height in 16ths of a point

◆ text() [1/2]

void tbx::TextArea::text ( const std::string &  text)
inline

Set the text in the text area.

Parameters
textnew text for the text area

◆ text() [2/2]

std::string tbx::TextArea::text ( ) const
inline

Get the text from the text area.

Returns
text area text as a string

◆ wordwrap() [1/2]

bool tbx::TextArea::wordwrap ( ) const
inline

Check if text area is wrapping words.

Returns
true if word wrap is on

◆ wordwrap() [2/2]

void tbx::TextArea::wordwrap ( bool  value)
inline

Set word wrapping in the text area.

Parameters
valuetrue to turn word wrap on, false to turn it off

The documentation for this class was generated from the following files: