sptk2 logo
SPTK Home Page

sptk::CControl Class Reference
[GUI Classes]

Base class for most of SPTK widgets. More...

#include <CControl.h>

Inheritance diagram for sptk::CControl:

sptk::CLayoutClient sptk::CBaseListBox sptk::CButtonGroup sptk::CInput sptk::CListView sptk::CTreeView sptk::CComboBox sptk::CListBox sptk::CRadioButtons sptk::CBox sptk::CDateIntervalInput sptk::CDateTimeBaseInput sptk::CFloatInput sptk::CHtmlBox sptk::CIntegerInput sptk::CMemoInput sptk::CPasswordInput sptk::CPhoneNumberInput sptk::CProgressBar sptk::CDBListView

List of all members.

Public Member Functions

 CControl (const char *label, int layoutSize=20, CLayoutAlign layoutAlign=SP_ALIGN_TOP)
 Constructor in SPTK style.
virtual void resize (int x, int y, int w, int h)
 Resizes the control and inside widgets.
virtual void draw ()
 Draws the control.
virtual int tag () const
 Returns the control's user data tag.
virtual void tag (int t)
 Sets the control's user data tag.
virtual Fl_Font textFont () const
 Returns the control's text font.
virtual void textFont (Fl_Font)
 Sets the control's text font.
virtual uchar textSize () const
 Returns the control's text font size.
virtual void textSize (uchar)
 Sets the control's text font size.
virtual Fl_Color textColor () const
 Returns the control's text color.
virtual void textColor (Fl_Color)
 Sets the control's text color.
virtual Fl_Color labelColor () const
 Returns the control's label color.
virtual void labelColor (Fl_Color)
 Sets the control's label color.
virtual Fl_Color color () const
 Returns the control's background color.
virtual void color (Fl_Color)
 Sets the control's background color.
uint32_t flags () const
 Returns the control's flags.
void flags (uint32_t flags)
 Sets the control's flags.
Fl_Widget * control () const
 Returns main widget inside the container.
const std::string & label () const
 Returns control's label.
void label (const std::string)
 Sets control's label.
Fl_Menu_ * menu () const
 Returns control's menu.
void menu (const Fl_Menu_Item *)
 Sets control's menu.
Fl_Font labelFont () const
 Returns control's label font.
void labelSize (Fl_Font f)
 Sets control's label font.
uchar labelSize () const
 Returns control's label font size.
void labelSize (uchar)
 Sets control's label font size.
uint32_t labelWidth () const
 Returns control's label width.
void labelWidth (uint32_t)
 Sets control's label width.
void hint (std::string str)
 Sets control's hint (tooltip).
std::string hint () const
 Returns control's hint (tooltip).
virtual int maxLength () const
 Returns control's max input length, if applicable.
virtual void maxLength (int)
 Sets control's max input length, if applicable.
virtual const std::string & fieldName () const
 Returns control's field name for universal data connection.
virtual void fieldName (const std::string &)
 Sets control's field name for universal data connection.
virtual CControlKind kind () const =0
 Returns control's kind (internal SPTK RTTI).
virtual std::string className () const
 Returns control's class name (internal SPTK RTTI).
virtual void reset ()
 Sets the control to empty text (for the input entries).
virtual void load (CQuery *)
 Loads control data from query fields.
virtual void save (CQuery *)
 Saves control data to query params.
virtual void load (const CXmlNode *node, CLayoutXMLmode xmlMode)
 Loads control data from XML.
virtual void save (CXmlNode *node, CLayoutXMLmode xmlMode) const
 Saves control data to XML.
virtual bool valid () const =0
 Returns true if the control state is valid, and the data is inside the limits (if applicable).
virtual CVariant data () const
 The universal data connector.
virtual void data (const CVariant v)
 The universal data connector, sets control data.
void fireEvent (CEvent ev, int32_t arg)
 Fires the event generated by this control.
const CEventInfoevent () const
 Returns the last event fired by this control.
CEvent eventType () const
 Returns the event type for the last fired by this control.
int eventArgument () const
 Returns the event argument for the last fired by this control.
CControloperator= (const std::string &str)
 Control data assignment.
CControloperator= (const char *str)
 Control data assignment.
CControloperator= (int32_t v)
 Control data assignment.
CControloperator= (uint32_t v)
 Control data assignment.
CControloperator= (int64_t v)
 Control data assignment.
CControloperator= (uint64_t v)
 Control data assignment.
CControloperator= (float v)
 Control data assignment.
CControloperator= (double v)
 Control data assignment.
CControloperator= (CDateTime dt)
 Control data assignment.
CControloperator= (CField &fld)
 Control data assignment.
 operator std::string () const
 Control data conversion.
 operator int32_t () const
 Control data conversion.
 operator uint32_t () const
 Control data conversion.
 operator int64_t () const
 Control data conversion.
 operator uint64_t () const
 Control data conversion.
 operator float () const
 Control data conversion.
 operator double () const
 Control data conversion.
 operator CDateTime () const
 Control data conversion.

Static Public Member Functions

static CControlKind controlNameToType (std::string typeName, int &maxLength, std::string values="")
 Converts control name to control kind.
static void defaultControlMenuCopy (Fl_Widget *, void *)
 Default callback function to support CControl default menu item 'Copy'.
static void defaultControlMenuCut (Fl_Widget *, void *)
 Default callback function to support CControl default menu item 'Delete'.
static void defaultControlMenuPaste (Fl_Widget *, void *)
 Default callback function to support CControl default menu item 'Paste'.
static void defaultControlMenuClear (Fl_Widget *, void *)
 Default callback function to support CControl default menu item 'Clear'.

Static Public Attributes

static const Fl_Menu_Item defaultControlMenu []
 CControl default menu.

Protected Member Functions

bool containsFocus () const
 Does the control contain focus?
void notifyFocus (bool gotFocus=true)
 Internal focus notification on focus change.
virtual void onEnter ()
 Internal focus notification on focus change.
virtual void onExit ()
 Internal focus notification on focus change.
uint32_t labelHeight () const
 Computes the label height based on the labelFont() and labelWidth().
int handle (int)
 Special handle() method.

Static Protected Member Functions

static void internalCallback (Fl_Widget *internalWidget, void *data)
 Internal callback function.

Protected Attributes

bool m_limited
 Control has the defined min and max values.
uint32_t m_labelWidth
 Control label width (on the left).
Fl_Color m_labelColor
 Control label color.
Fl_Color m_textColor
 Control text color.
Fl_Font m_textFont
 Control text font.
uchar m_textSize
 Control text font size.
std::string m_fieldName
 Field name for the universal data connection.
std::string m_hint
 The text of the hint.
Fl_Widget * m_control
 The main widget inside the control.
int m_tag
uint32_t m_controlFlags
 Control's special flags (a bit combination of FGENTRYFLAGS).
Fl_Menu_Button * m_menuButton
 Control's menu button - to show right-mouse click menu.
CEventInfo m_event
 The last SPTK event inside this control.
bool m_hasFocus
 Does the control have focus?

Friends

class CInternalComboBoxPanel
class CEditor
class CBaseButton
class CRadioButton
class CCheckButton
class CInput_


Detailed Description

Base class for most of SPTK widgets.

It is a group used as a container for the widget(s) inside. Every CControl has a field name, and it can be a layout client.


Constructor & Destructor Documentation

sptk::CControl::CControl ( const char *  label,
int  layoutSize = 20,
CLayoutAlign  layoutAlign = SP_ALIGN_TOP 
)

Constructor in SPTK style.

Parameters:
label const char *, label
layoutSize int, widget align in layout
layoutAlign CLayoutAlign, widget align in layout


Member Function Documentation

virtual CVariant sptk::CControl::data (  )  const [inline, virtual]

void sptk::CControl::hint ( std::string  str  )  [inline]

Sets control's hint (tooltip).

Parameters:
str std::string, tooltip text

virtual void sptk::CControl::load ( const CXmlNode node,
CLayoutXMLmode  xmlMode 
) [virtual]

Loads control data from XML.

Layout information may also include widget size and position, as well as visible() and active() states

Parameters:
node CXmlNode*, the XML node
xmlMode CLayoutXMLmode, the mode defining how the layout and/or data should be stored

Reimplemented from sptk::CLayoutClient.

Reimplemented in sptk::CButtonGroup, sptk::CBaseListBox, sptk::CDateTimeBaseInput, sptk::CInput, and sptk::CListView.

virtual void sptk::CControl::reset (  )  [inline, virtual]

Sets the control to empty text (for the input entries).

Also sets no selection state / default selection (for the lists)

virtual void sptk::CControl::resize ( int  x,
int  y,
int  w,
int  h 
) [virtual]

Resizes the control and inside widgets.

Parameters:
x int, x-position
y int, y-position
w int, width
h int, height

Reimplemented in sptk::CBox, sptk::CBaseListBox, sptk::CDateIntervalInput, sptk::CDateInput, sptk::CDateTimeInput, sptk::CListView, and sptk::CTreeView.

virtual void sptk::CControl::save ( CXmlNode node,
CLayoutXMLmode  xmlMode 
) const [virtual]

Saves control data to XML.

Layout information may also include widget size and position, as well as visible() and active() states

Parameters:
node CXmlNode*, the XML node
xmlMode CLayoutXMLmode, the mode defining how the layout and/or data should be stored

Reimplemented from sptk::CLayoutClient.

Reimplemented in sptk::CButtonGroup, sptk::CBaseListBox, sptk::CDateTimeBaseInput, sptk::CInput, and sptk::CListView.


Member Data Documentation

uint32_t sptk::CControl::m_controlFlags [protected]

Control's special flags (a bit combination of FGENTRYFLAGS).

See also:
FGENTRYFLAGS for details.

int sptk::CControl::m_tag [protected]

Control's special data tag


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

Mon Mar 5 11:56:10 2012: SPTK 3.5.7