- Main Page
- Classes
- Directories
- Related Pages

- Class List
- Class Hierarchy
- Class Members

# TkBase Class Reference

Base class for all type of widgets. More...

`#include <tk_base.h>`

Inheritance diagram for TkBase:

List of all members.

## Public Member Functions

Ptr< TXmlObject > & | getConstraints ()
| Return layout constraints (if any).
void | setConstraints (Ptr< TXmlObject > &constraints)
| Set layout constrains.
void | invalidate ()
| Forces layout to redisplay widget.
Ptr< TclInterp > & | getInterp ()
| Returns reference to interpret, in which was widget created.
const t_option_set & | getOptionSet () const
| Returns option set.
bool | isCreated () const
| Test if widget is created.
Tk_Window | getWindow () const
| Returns Tk identifier of the widget window.
TkContainer * | getParent ()
| Returns parent of widget (if any) otherwise NULL.
Tk_Uid | getUid () const
| Returns Tk unique widget identifier.
const string & | getGeneratedId () const
| Returns unique ID, generated for widget.
const string & | getName () const
| Return user-defined name for widger.
virtual const char * | getTkClass () const =0
| Returns type of widget.
virtual const Ptr< TkOptionDef > * | getOptionAll () const =0
| Returns array of all avaliable options valid for specific widget type.
bool | compareTo (TObject *object) const
| Compare two objects.
TObject * | clone ()=0
| Create deep-clone of object.
Ptr< TXmlObject > & | getTag ()
| Return tag.
void | setTag (TXmlObject *tag)
| Sets tag.
| TkBase (Ptr< TclInterp > &interp)
virtual void | create ()
| Creates widget in shell.
void | setOption (const Ptr< TkOptionDef > &def, TXmlObject *option)
| Sets value of one widget property.
Tcl_Obj * | getOption (const Ptr< TkOptionDef > &def) const
| Returns value of one widget property as Tcl_Obj.
const string & | getStrOption (const Ptr< TkOptionDef > &def) const
| Works just like getOption, but result is presented as string.
void | setRawOption (const string &optionName, const string &value)
| Set widget property in raw (string) format. Should be avoided.
void | setName (const string &name)
| Set user-defined name for widget.
virtual void | setEventsEnabled (bool value)
| Enables or disables events on widget.
bool | isEventsEnabled () const
| Returns state of event generation.
const string & | toString () const
| Simple text dump.
virtual void | setBackgroundColor (TkColorOption *color)=0
| Set background color.
virtual Ptr< TkColorOption > & | getBackgroundColor () const =0
| Returns background color of widget.

## Friends

class | TkContainer
class | TkTopLevel

## Detailed Description

Base class for all type of widgets.

Date:
  01-11-2006

Author:
  Ondrej Svejdar

Todo:

Bug:

## Constructor & Destructor Documentation

TkBase::TkBase | ( | Ptr< TclInterp > & | interp | ) |

Parameters:

  | interp | interpreter

## Member Function Documentation

TObject* TkBase::clone | ( |  | ) | `[pure virtual]`

| Create deep-clone of object.

Returns:
  deep-clone of object

Reimplemented from TObject.

Implemented in TkButton, TkCheckButton, TkEntry, TkFrame, TkLabel, TkListbox, TkMenu, TkRadioButton, TkScrollBar, TkSpinBox, TkText, and TkTopLevel.

bool TkBase::compareTo | ( | TObject * | object | ) | const`[inline, virtual]`

| Compare two objects.

Note:
  If method is not overriden it throws ExceptionNoImplementation when called.

Parameters:

  | object | pointer to another object

Returns:
  true if object are equal

Reimplemented from TObject.

virtual Ptr<TkColorOption>& TkBase::getBackgroundColor | ( |  | ) | const`[pure virtual]`

| Returns background color of widget.

Returns:
  background color

Implemented in TkButton, TkCheckButton, TkEntry, TkFrame, TkLabel, TkListbox, TkMenu, TkRadioButton, TkScrollBar, TkSpinBox, TkText, and TkTopLevel.

Ptr< TXmlObject > & TkBase::getConstraints | ( |  | ) |

| Return layout constraints (if any). In case there aren't any returns empty TXmlObject

Returns:
  layout constraints

const string& TkBase::getGeneratedId | ( |  | ) | const`[inline]`

| Returns unique ID, generated for widget.

Returns:
  widget generated id

Ptr< TclInterp > & TkBase::getInterp | ( |  | ) |

| Returns reference to interpret, in which was widget created.

Returns:
  reference to interpret

const string & TkBase::getName | ( |  | ) | const

| Return user-defined name for widger.

Returns:
  name of widget

Tcl_Obj * TkBase::getOption | ( | const Ptr< TkOptionDef > & | def | ) | const

| Returns value of one widget property as Tcl_Obj.

Parameters:

  | def | property definition, usually static member of specific widget

Returns:
  property value

virtual const Ptr<TkOptionDef>* TkBase::getOptionAll | ( |  | ) | const`[pure virtual]`

| Returns array of all avaliable options valid for specific widget type.

Returns:
  array of options

Implemented in TkButton, TkCheckButton, TkEntry, TkFrame, TkLabel, TkListbox, TkMenu, TkRadioButton, TkScrollBar, TkSpinBox, TkText, and TkTopLevel.

const TkBase::t_option_set & TkBase::getOptionSet | ( |  | ) | const

| Returns option set.

Returns:
  option set

TkContainer * TkBase::getParent | ( |  | ) |

| Returns parent of widget (if any) otherwise NULL.

Returns:
  pointer to parent widget

const string & TkBase::getStrOption | ( | const Ptr< TkOptionDef > & | def | ) | const

| Works just like getOption, but result is presented as string.

Parameters:

  | def | property definition, usually static member of specific widget

Returns:
  property value

Ptr< TXmlObject > & TkBase::getTag | ( |  | ) |

| Return tag. Each instance of class TkBase can have one "general purpose" object - tag, it is free to use for application programmer.

Returns:
  reference to tag (if any) or empty object

virtual const char* TkBase::getTkClass | ( |  | ) | const`[pure virtual]`

| Returns type of widget. Example values are "button","menu","entry" etc.

Returns:
  widget type

Implemented in TkButton, TkCheckButton, TkEntry, TkFrame, TkLabel, TkListbox, TkMenu, TkRadioButton, TkScrollBar, TkSpinBox, TkText, and TkTopLevel.

Tk_Uid TkBase::getUid | ( |  | ) | const

| Returns Tk unique widget identifier.

Note:
  This uid is sequenceof chars, equal to widget's name. Tk uses reference comparsion to hurry things up.

Returns:
  widget uid

Tk_Window TkBase::getWindow | ( |  | ) | const

| Returns Tk identifier of the widget window. That means toplevel window in which is widget placed.

Returns:
  Tk widget identifier

void TkBase::invalidate | ( |  | ) |

| Forces layout to redisplay widget. Does nothing if widget is not displayed.

bool TkBase::isCreated | ( |  | ) | const

| Test if widget is created.

Returns:
  true if widget created in shell

bool TkBase::isEventsEnabled | ( |  | ) | const

| Returns state of event generation.

Returns:
  true if events are enabled

virtual void TkBase::setBackgroundColor | ( | TkColorOption * | color | ) | `[pure virtual]`

| Set background color.

Parameters:

  | color | color value

Implemented in TkButton, TkCheckButton, TkEntry, TkFrame, TkLabel, TkListbox, TkMenu, TkRadioButton, TkScrollBar, TkSpinBox, TkText, and TkTopLevel.

void TkBase::setConstraints | ( | Ptr< TXmlObject > & | constraints | ) |

| Set layout constrains.

Parameters:

  | constraints | layout constrainst

void TkBase::setEventsEnabled | ( | bool | value | ) | `[virtual]`

| Enables or disables events on widget.

Parameters:

  | value | if true events will be enabled

Reimplemented in TkCheckButton, TkEntry, TkListbox, and TkSpinBox.

void TkBase::setName | ( | const string & | name | ) |

| Set user-defined name for widget.

Parameters:

  | name | user-defined name for widget

void TkBase::setOption | ( | const Ptr< TkOptionDef > & | def,
|  | TXmlObject * | option
| ) |

| Sets value of one widget property.

Parameters:

  | def | option definition, definition of this property
  | option | value

void TkBase::setRawOption | ( | const string & | optionName,
|  | const string & | value
| ) |

| Set widget property in raw (string) format. Should be avoided.

Parameters:

  | optionName | name of property
  | value | value

void TkBase::setTag | ( | TXmlObject * | tag | ) |

| Sets tag.

Parameters:

  | tag | value

const string & TkBase::toString | ( |  | ) | const`[virtual]`

| Simple text dump.

Returns:
  if not overriden, it returns type of class

Reimplemented from TObject.

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

- H:/projs/dotNET/eda/src/tk/gui/tk_base.h
- H:/projs/dotNET/eda/src/tk/gui/tk_base.cpp