65FXIMPLEMENT(
MFXComboBoxIcon, FXPacker, MFXComboBoxIconMap, ARRAYNUMBER(MFXComboBoxIconMap))
72 FXObject* tgt, FXSelector sel, FXuint opts, FXint x, FXint y, FXint w, FXint h, FXint pl, FXint pr, FXint pt, FXint pb):
73 FXPacker(p, opts, x, y, w, h, 0, 0, 0, 0, 0, 0) {
74 flags |= FLAG_ENABLED;
78 myTextFieldIcon =
new MFXTextFieldIcon(
this, cols,
nullptr,
this,
MFXComboBoxIcon::ID_TEXT, 0, 0, 0, 0, 0, pl, pr, pt, pb);
79 if (options & COMBOBOX_STATIC) {
80 myTextFieldIcon->setEditable(FALSE);
83 myPane =
new FXPopup(
this, FRAME_LINE);
86 myTextFieldSearch =
new MFXTextFieldSearch(myPane, 1,
this, ID_SEARCH, FRAME_THICK | LAYOUT_FIX_WIDTH | LAYOUT_FIX_HEIGHT, 0, 0, 0, 0, 2, 2, 2, 2);
88 myNoItemsLabel =
new FXLabel(myPane,
TL(
"No matches found"),
nullptr, FRAME_THICK | LAYOUT_FIX_WIDTH | LAYOUT_FIX_HEIGHT, 0, 0, 0, 0, 2, 2, 2, 2);
89 myNoItemsLabel->setTextColor(FXRGB(255, 0, 0));
90 myNoItemsLabel->hide();
94 if (options & COMBOBOX_STATIC) {
95 myList->setScrollStyle(SCROLLERS_TRACK | HSCROLLING_OFF);
97 myList->setNumVisible(visibleItems);
99 myButton =
new FXMenuButton(
this, FXString::null, NULL, myPane, FRAME_RAISED | FRAME_THICK | MENUBUTTON_DOWN | MENUBUTTON_ATTACH_RIGHT, 0, 0, 0, 0, 0, 0, 0, 0);
100 myButton->setXOffset(border);
101 myButton->setYOffset(border);
102 flags &= ~(FXuint)FLAG_UPDATE;
164 FXint pw =
myPane->getDefaultWidth();
165 return FXMAX(ww, pw);
174 return FXMAX(th, bh) + (border << 1);
180 const FXint itemHeight = height - (border << 1);
181 const FXint buttonWidth =
myButton->getDefaultWidth();
182 const FXint textWidth = width - buttonWidth - (border << 1);
184 myButton->position(border + textWidth, border, buttonWidth, itemHeight);
190 flags &= ~(FXuint)FLAG_DIRTY;
226 if (index >= 0 && index <= myList->
getNumItems()) {
237 if (notify && target) {
238 return target->tryHandle(
this, FXSEL(SEL_COMMAND, message), (
void*)item);
241 fxerror(
"%s::setItem: index out of range.\n", getClassName());
270 fxerror(
"%s::setItem: index out of range.\n", getClassName());
312 if (isCurrent == TRUE) {
347 myList->setBackColor(clr);
378 return (target && !
myPane->shown()) ? target->tryHandle(
this, FXSEL(SEL_UPDATE, message), NULL) : 0;
387 myPane->onPaint(0, 0, ptr);
401 myButton->handle(
this, FXSEL(SEL_COMMAND, ID_UNPOST), NULL);
402 if (FXSELTYPE(sel) == SEL_COMMAND) {
410 if (!(options & COMBOBOX_STATIC)) {
414 target->tryHandle(
this, FXSEL(SEL_COMMAND, message), (
void*)
getText().text());
423 if (options & COMBOBOX_STATIC) {
425 myButton->handle(
this, FXSEL(SEL_COMMAND, ID_POST), NULL);
434 return target ? target->tryHandle(
this, FXSEL(SEL_CHANGED, message), ptr) : 0;
452 return target ? target->tryHandle(
this, FXSEL(SEL_COMMAND, message), ptr) : 0;
468 }
else if (0 < index) {
499 FXEvent*
event = (FXEvent*)ptr;
502 if (event->code < 0) {
508 }
else if (event->code > 0) {
511 }
else if (0 < index) {
@ MID_MTEXTFIELDSEARCH_UPDATED
callback for MFXTextFieldSearch
FXDEFMAP(MFXComboBoxIcon) MFXComboBoxIconMap[]
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
FXbool isItemCurrent(FXint index) const
Return true if current item.
FXint insertIconItem(FXint index, const FXString &text, FXIcon *icon=nullptr, FXColor bgColor=FXRGB(255, 255, 255), void *ptr=nullptr)
insert icon item in the given position
long setCurrentItem(const FXint index, FXbool notify=FALSE)
Set the current item (index is zero-based)
void layout()
Perform layout.
FXint getCurrentItem() const
Get the current item's index.
void destroy()
Destroy server-side resources.
FXint findItem(const FXString &text) const
find item
long onTextChanged(FXObject *, FXSelector, void *)
void removeItem(FXint index)
Remove this item from the list.
long onFwdToText(FXObject *, FXSelector, void *)
FXint getNumItems() const
Return the number of items in the list.
FXLabel * myNoItemsLabel
no items label
const FXString & getTipText() const
Get the tool tip message for this combobox.
long onMouseWheel(FXObject *, FXSelector, void *)
FXint getDefaultWidth()
Return default width.
MFXTextFieldSearch * myTextFieldSearch
text field search
void setBackColor(FXColor clr)
Set window background color.
long onListClicked(FXObject *, FXSelector, void *)
FXMenuButton * myButton
myButton
MFXListIcon * myList
list with all items
FXString getText() const
Get the text.
long onCmdFilter(FXObject *, FXSelector, void *)
void setTextColor(FXColor clr)
Change text color.
FXPopup * myPane
popup in which place search label and list
void setNumVisible(FXint nvis)
Set the number of visible items in the drop down list.
~MFXComboBoxIcon()
Destructor.
void clearItems()
Remove all items from the list.
FXint updateIconItem(FXint index, const FXString &text, FXIcon *icon=nullptr, FXColor bgColor=FXRGB(255, 255, 255), void *ptr=nullptr)
Replace the item at index.
FXint getDefaultHeight()
Return default height.
long onTextButton(FXObject *, FXSelector, void *)
void setText(const FXString &text)
Set the text in the textField.
void setTipText(const FXString &txt)
Set the tool tip message for this combobox.
std::string getItemText(FXint index) const
Get text for specified item.
void disable()
Disable combo box.
MFXComboBoxIcon()
FOX need this.
FXColor getTextColor() const
Return text color.
long onUpdFmText(FXObject *, FXSelector, void *)
FXint appendIconItem(const FXString &text, FXIcon *icon=nullptr, FXColor bgColor=FXRGB(255, 255, 255), void *ptr=nullptr)
append icon item in the last position
void enable()
Enable combo box.
MFXTextFieldIcon * myTextFieldIcon
textField icon
long onTextCommand(FXObject *, FXSelector, void *)
void detach()
Detach server-side resources.
void create()
Create server-side resources.
long onFocusDown(FXObject *, FXSelector, void *)
long onFocusSelf(FXObject *, FXSelector, void *)
long onFocusUp(FXObject *, FXSelector, void *)
Commands.
A list item which allows for custom coloring.
void setNumVisible(FXint nvis)
Change the number of visible items.
void makeItemVisible(MFXListIconItem *item)
Scroll to bring item into view.
FXint editItem(FXint index, const FXString &text, FXIcon *icon=NULL, void *ptr=NULL, FXbool notify=FALSE)
Replace items text, icon, and user-data pointer.
int findItem(const FXString &text) const
Search items by name (In all items)
FXString tolowerString(const FXString &str) const
tolower string
FXint getNumItems() const
Return the number of items in the list.
FXint appendItem(MFXListIconItem *item, FXbool notify=FALSE)
Append a [possibly subclassed] item to the list.
FXbool isItemCurrent(FXint index) const
Return TRUE if item is current.
FXint getCurrentItemIndex() const
Return current item, if any.
void setFilter(const FXString &value, FXLabel *label)
filter items in list
MFXListIconItem * getItem(FXint index) const
Return the item at the given index.
void setTextColor(FXColor clr)
Change normal text color.
void clearItems(FXbool notify=FALSE)
Remove all items from list.
void removeItem(FXint index, FXbool notify=FALSE)
Remove node from list.
void setCurrentItem(MFXListIconItem *item, FXbool notify=FALSE)
Change current item.
FXint insertItem(FXint index, MFXListIconItem *item, FXbool notify=FALSE)
Insert a new [possibly subclassed] item at the give index.
const FXString & getText() const
Return item's text label.
FXIcon * getIcon() const
Return item's icon.
const FXColor & getBackGroundColor() const
get background color
virtual void disable()
Disable text field.
const FXString & getTipText() const
Get the tool tip message for this text field.
virtual void enable()
Enable text field.
virtual FXint getDefaultWidth()
Return default width.
FXColor getTextColor() const
Return text color.
FXString getText() const
Get the text for this label.
virtual FXint getDefaultHeight()
Return default height.
FXbool selectAll()
Select all text.
void setTextColor(FXColor clr)
Change text color.
void setIcon(FXIcon *ic)
Change the icon.
void setTipText(const FXString &text)
Set the tool tip message for this text field.
void setText(const FXString &text, FXbool notify=FALSE)
Change the text and move cursor to end.
FXTextFieldIcon (based on FXTextFieldIcon)