diff options
Diffstat (limited to 'dw/fltkui.cc')
-rw-r--r-- | dw/fltkui.cc | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/dw/fltkui.cc b/dw/fltkui.cc index 5e4f3c56..14914dfe 100644 --- a/dw/fltkui.cc +++ b/dw/fltkui.cc @@ -536,11 +536,11 @@ Fl_Widget *FltkComplexButtonResource::createNewWidget (core::Allocation // ---------------------------------------------------------------------- -FltkEntryResource::FltkEntryResource (FltkPlatform *platform, int maxLength, +FltkEntryResource::FltkEntryResource (FltkPlatform *platform, int size, bool password, const char *label): FltkSpecificResource <dw::core::ui::EntryResource> (platform) { - this->maxLength = maxLength; + this->size = size; this->password = password; this->label = label ? strdup(label) : NULL; this->label_w = 0; @@ -615,7 +615,7 @@ void FltkEntryResource::sizeRequest (core::Requisition *requisition) // 1.3.0 (STR #2688). requisition->width = (int)fl_width ("n") - * (maxLength == UNLIMITED_MAX_LENGTH ? 10 : maxLength) + * (size == UNLIMITED_SIZE ? 10 : size) + label_w + (2 * RELIEF_X_THICKNESS); requisition->ascent = font->ascent + RELIEF_Y_THICKNESS; requisition->descent = font->descent + RELIEF_Y_THICKNESS; @@ -670,6 +670,11 @@ void FltkEntryResource::setEditable (bool editable) this->editable = editable; } +void FltkEntryResource::setMaxLength (int maxlen) +{ + ((Fl_Input *)widget)->maximum_size(maxlen); +} + // ---------------------------------------------------------------------- FltkMultiLineTextResource::FltkMultiLineTextResource (FltkPlatform *platform, @@ -1131,6 +1136,14 @@ void FltkOptionMenuResource::addItem (const char *str, queueResize (true); } +void FltkOptionMenuResource::setItem (int index, bool selected) +{ + if (selected) { + ((Fl_Choice *)widget)->value(menu+index); + queueResize (true); + } +} + void FltkOptionMenuResource::pushGroup (const char *name, bool enabled) { Fl_Menu_Item *item = newItem(); @@ -1257,6 +1270,22 @@ void FltkListResource::addItem (const char *str, bool enabled, bool selected) queueResize (true); } +void FltkListResource::setItem (int index, bool selected) +{ + Fl_Tree *tree = (Fl_Tree *) widget; + Fl_Tree_Item *item = tree->root()->child(index); + + /* TODO: handle groups */ + if (item) { + itemsSelected.set (index, selected); + if (mode == SELECTION_MULTIPLE) + item->select(selected); + else if (selected) + tree->select_only(item); + queueResize (true); + } +} + void FltkListResource::pushGroup (const char *name, bool enabled) { bool selected = false; |