29#include <FL/Fl_Group.H>
30#include <FL/Fl_Menu_Button.H>
32#include <sptk5/db/Query.h>
33#include <sptk5/gui/CEvent.h>
34#include <sptk5/gui/CLayoutClient.h>
35#include <sptk5/xdoc/Node.h>
223 friend class CInternalComboBoxPanel;
229 friend class CRadioButton;
238 void ctor_init(
const char*);
244 bool m_limited {
false};
249 uint32_t m_labelWidth {0};
269 uchar m_textSize {0};
284 Fl_Widget* m_control {
nullptr};
295 uint32_t m_controlFlags {0};
299 Fl_Menu_Button* m_menuButton {
nullptr};
309 bool m_hasFocus {
false};
355#ifdef __COMPATIBILITY_MODE__
364 CControl(
int,
int,
int,
int,
const char* = 0);
374 void resize(
int x,
int y,
int w,
int h)
override;
400#if FL_MAJOR_VERSION < 2
411 virtual Font* textFont()
const;
416 virtual void textFont(Font*);
464 return m_controlFlags;
501 void menu(
const Fl_Menu_Item*);
551 m_control->tooltip(m_hint.c_str());
648 void load(
const xdoc::SNode& node)
override
670 virtual void save(
const xdoc::SNode& node)
const
715 return m_event.
type();
817 return data().asString();
823 explicit operator int32_t()
const
825 return data().asInteger();
831 explicit operator uint32_t()
const
833 return data().asInteger();
839 explicit operator int64_t()
const
841 return data().asInt64();
847 explicit operator uint64_t()
const
849 return data().asInt64();
855 explicit operator float()
const
857 return (
float) data().asFloat();
863 explicit operator double()
const
865 return data().asFloat();
873 return data().asDateTime();
899 static const Fl_Menu_Item defaultControlMenu[];
Definition: CColumn.h:178
Base class for most of SPTK widgets.
Definition: CControl.h:222
String m_hint
Definition: CControl.h:279
virtual Fl_Color textColor() const
Returns the control's text color.
CEventInfo m_event
Definition: CControl.h:304
virtual const String & fieldName() const
Returns control's field name for universal data connection.
Definition: CControl.h:582
uint32_t labelWidth() const
Returns control's label width.
Definition: CControl.h:532
String m_fieldName
Definition: CControl.h:274
void save(const xdoc::SNode &node, CLayoutXMLmode xmlMode) const override
Saves control data to XML.
virtual void save(const xdoc::SNode &node) const
Saves control data to XML.
Definition: CControl.h:670
bool containsFocus() const
Does the control contain focus?
virtual Fl_Color color() const
Returns the control's background color.
static void defaultControlMenuClear(Fl_Widget *, void *)
Default callback function to support CControl default menu item 'Clear'.
CControl & operator=(float v)
Control data assignment.
Definition: CControl.h:779
Fl_Font labelFont() const
Returns control's label font.
Definition: CControl.h:506
CControl & operator=(const String &str)
Control data assignment.
Definition: CControl.h:734
virtual void textSize(uchar)
Sets the control's text font size.
virtual void textFont(Fl_Font)
Sets the control's text font.
void label(const String &) override
Sets control's label.
CControl(const char *label, int layoutSize=20, CLayoutAlign layoutAlign=CLayoutAlign::TOP)
Constructor in SPTK style.
int handle(int) override
Special handle() method.
static void defaultControlMenuPaste(Fl_Widget *, void *)
Default callback function to support CControl default menu item 'Paste'.
Fl_Color m_textColor
Definition: CControl.h:259
virtual Fl_Color labelColor() const
Returns the control's label color.
static void defaultControlMenuCut(Fl_Widget *, void *)
Default callback function to support CControl default menu item 'Delete'.
CEvent eventType() const
Returns the event type for the last fired by this control.
Definition: CControl.h:713
void labelSize(Fl_Font f)
Sets control's label font.
Definition: CControl.h:514
static void internalCallback(Fl_Widget *internalWidget, void *data)
Internal callback function.
CControl & operator=(double v)
Control data assignment.
Definition: CControl.h:788
CControl & operator=(const DateTime &dt)
Control data assignment.
Definition: CControl.h:797
const String & label() const override
Returns control's label.
Definition: CControl.h:483
virtual void load(Query *)
Loads control data from query fields.
Definition: CControl.h:618
virtual Variant data() const
The universal data connector.
Definition: CControl.h:684
static CControlKind controlNameToType(const String &typeName, int &maxLength, const String &values="")
Converts control name to control kind.
const CEventInfo & event() const
Returns the last event fired by this control.
Definition: CControl.h:705
CControl & operator=(uint32_t v)
Control data assignment.
Definition: CControl.h:761
void hint(const String &str)
Sets control's hint (tooltip)
Definition: CControl.h:546
virtual void fieldName(const String &)
Sets control's field name for universal data connection.
virtual void save(Query *)
Saves control data to query params.
Definition: CControl.h:626
CControl & operator=(int32_t v)
Control data assignment.
Definition: CControl.h:752
String className() const override
Returns control's class name (internal SPTK RTTI).
Definition: CControl.h:600
void load(const xdoc::SNode &node) override
Loads control data from XML.
Definition: CControl.h:648
Fl_Widget * control() const
Returns main widget inside the container.
Definition: CControl.h:475
uint32_t labelHeight() const
Computes the label height based on the labelFont() and labelWidth()
void flags(uint32_t flags)
Sets the control's flags.
static void defaultControlMenuCopy(Fl_Widget *, void *)
Default callback function to support CControl default menu item 'Copy'.
virtual void tag(int t)
Sets the control's user data tag.
Definition: CControl.h:392
void notifyFocus(bool gotFocus=true)
Internal focus notification on focus change.
void load(const xdoc::SNode &node, CLayoutXMLmode xmlMode) override
Loads control data from XML.
void menu(const Fl_Menu_Item *)
Sets control's menu.
void fireEvent(CEvent ev, int32_t arg)
Fires the event generated by this control.
uint32_t flags() const
Returns the control's flags.
Definition: CControl.h:462
void labelSize(uchar)
Sets control's label font size.
Fl_Menu_ * menu() const
Returns control's menu.
void draw() override
Draws the control.
virtual int maxLength() const
Returns control's max input length, if applicable.
Definition: CControl.h:566
virtual uchar textSize() const
Returns the control's text font size.
int eventArgument() const
Returns the event argument for the last fired by this control.
Definition: CControl.h:721
Fl_Font m_textFont
Definition: CControl.h:264
CControl & operator=(const Field &fld)
Control data assignment.
Definition: CControl.h:806
virtual void labelColor(Fl_Color)
Sets the control's label color.
uchar labelSize() const
Returns control's label font size.
virtual int tag() const
Returns the control's user data tag.
Definition: CControl.h:384
virtual void color(Fl_Color)
Sets the control's background color.
String hint() const
Returns control's hint (tooltip)
Definition: CControl.h:558
void labelWidth(uint32_t)
Sets control's label width.
CControl & operator=(int64_t v)
Control data assignment.
Definition: CControl.h:770
virtual void reset()
Sets the control to empty text (for the input entries)
Definition: CControl.h:610
virtual void textColor(Fl_Color)
Sets the control's text color.
virtual CControlKind kind() const =0
Returns control's kind (internal SPTK RTTI).
Fl_Color m_labelColor
Definition: CControl.h:254
virtual void maxLength(int)
Sets control's max input length, if applicable.
Definition: CControl.h:574
CControl & operator=(const char *str)
Control data assignment.
Definition: CControl.h:743
virtual Fl_Font textFont() const
Returns the control's text font.
virtual void data(const Variant &v)
The universal data connector, sets control data.
Definition: CControl.h:692
void resize(int x, int y, int w, int h) override
Resizes the control and inside widgets.
virtual bool valid() const =0
Returns true if the control state is valid, and the data is inside the limits (if applicable)
virtual void onExit()
Internal focus notification on focus change.
virtual void onEnter()
Internal focus notification on focus change.
Drop-down window with CListView widget inside.
Definition: CDropDownBox.h:95
Text editor widget.
Definition: CEditor.h:50
int32_t argument() const
Definition: CEvent.h:193
CEvent type() const
Definition: CEvent.h:185
Definition: CLayoutClient.h:82
Packed strings list.
Definition: PackedStrings.h:58
Definition: DateTime.h:86
Definition: Variant.h:372
void createControls(const xdoc::SNode &xmlControls)
Create a control or a group of controls.
InputEntryFlags
Special control flags (used as bit combination)
Definition: CControl.h:162
CControlKind
Control kind is the constant to report the internal SPTK RTTI.
Definition: CControl.h:50
CLayoutAlign
Definition: CLayoutClient.h:44
CEvent
Definition: CEvent.h:42
CLayoutXMLmode
Definition: CLayoutClient.h:57
CControl * createControl(CControlKind controlKind, const String &label, const String &fieldName, int layoutSize)
Creates a single control.
SP_EXPORT bool checkFieldName(const String &fldName)
Internal field name validation.
constexpr int SINGLE_EDIT_ENTRY_HEIGHT
Default height for the single-row edit control.
Definition: CControl.h:198