1 /********************************************************************************
2 * *
3 * L i s t B o x O b j e c t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1998,2021 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #include "xincs.h"
22 #include "fxver.h"
23 #include "fxdefs.h"
24 #include "fxmath.h"
25 #include "fxkeys.h"
26 #include "FXArray.h"
27 #include "FXHash.h"
28 #include "FXMutex.h"
29 #include "FXStream.h"
30 #include "FXString.h"
31 #include "FXSize.h"
32 #include "FXPoint.h"
33 #include "FXRectangle.h"
34 #include "FXObjectList.h"
35 #include "FXStringDictionary.h"
36 #include "FXSettings.h"
37 #include "FXRegistry.h"
38 #include "FXFont.h"
39 #include "FXEvent.h"
40 #include "FXWindow.h"
41 #include "FXApp.h"
42 #include "FXFrame.h"
43 #include "FXLabel.h"
44 #include "FXTextField.h"
45 #include "FXButton.h"
46 #include "FXMenuButton.h"
47 #include "FXComposite.h"
48 #include "FXPacker.h"
49 #include "FXShell.h"
50 #include "FXPopup.h"
51 #include "FXScrollBar.h"
52 #include "FXScrollArea.h"
53 #include "FXList.h"
54 #include "FXListBox.h"
55
56
57 /*
58 Notes:
59 - Need to catch up/down arrow keys.
60 - Listbox turns OFF GUI Updating while being manipulated.
61 - No reaction to up and down arrow while disabled.
62 */
63
64 #define LISTBOX_MASK (0)
65
66 using namespace FX;
67
68
69 /*******************************************************************************/
70
71 namespace FX {
72
73 // Map
74 FXDEFMAP(FXListBox) FXListBoxMap[]={
75 FXMAPFUNC(SEL_FOCUS_SELF,0,FXListBox::onFocusSelf),
76 FXMAPFUNC(SEL_FOCUS_UP,0,FXListBox::onFocusUp),
77 FXMAPFUNC(SEL_FOCUS_DOWN,0,FXListBox::onFocusDown),
78 FXMAPFUNC(SEL_UPDATE,FXListBox::ID_LIST,FXListBox::onListUpdate),
79 FXMAPFUNC(SEL_CLICKED,FXListBox::ID_LIST,FXListBox::onListClicked),
80 FXMAPFUNC(SEL_DOUBLECLICKED,FXListBox::ID_LIST,FXListBox::onListClicked),
81 FXMAPFUNC(SEL_CHANGED,FXListBox::ID_LIST,FXListBox::onListChanged),
82 FXMAPFUNC(SEL_DELETED,FXListBox::ID_LIST,FXListBox::onListForward),
83 FXMAPFUNC(SEL_INSERTED,FXListBox::ID_LIST,FXListBox::onListForward),
84 FXMAPFUNC(SEL_COMMAND,FXListBox::ID_LIST,FXListBox::onListCommand),
85 FXMAPFUNC(SEL_LEFTBUTTONPRESS,FXListBox::ID_FIELD,FXListBox::onFieldButton),
86 FXMAPFUNC(SEL_MOUSEWHEEL,FXListBox::ID_FIELD,FXListBox::onMouseWheel),
87 FXMAPFUNC(SEL_COMMAND,FXListBox::ID_SETVALUE,FXListBox::onCmdSetValue),
88 FXMAPFUNC(SEL_COMMAND,FXListBox::ID_SETINTVALUE,FXListBox::onCmdSetIntValue),
89 FXMAPFUNC(SEL_COMMAND,FXListBox::ID_GETINTVALUE,FXListBox::onCmdGetIntValue),
90 };
91
92
93 // Object implementation
FXIMPLEMENT(FXListBox,FXPacker,FXListBoxMap,ARRAYNUMBER (FXListBoxMap))94 FXIMPLEMENT(FXListBox,FXPacker,FXListBoxMap,ARRAYNUMBER(FXListBoxMap))
95
96
97 // List box
98 FXListBox::FXListBox(FXComposite *p,FXObject* tgt,FXSelector sel,FXuint opts,FXint x,FXint y,FXint w,FXint h,FXint pl,FXint pr,FXint pt,FXint pb):FXPacker(p,opts,x,y,w,h,0,0,0,0,0,0){
99 flags|=FLAG_ENABLED;
100 target=tgt;
101 message=sel;
102 field=new FXButton(this," ",NULL,this,FXListBox::ID_FIELD,ICON_BEFORE_TEXT|JUSTIFY_LEFT,0,0,0,0,pl,pr,pt,pb);
103 field->setBackColor(getApp()->getBackColor());
104 pane=new FXPopup(this,FRAME_LINE);
105 list=new FXList(pane,this,FXListBox::ID_LIST,LIST_BROWSESELECT|LIST_AUTOSELECT|LAYOUT_FILL_X|LAYOUT_FILL_Y|SCROLLERS_TRACK|HSCROLLING_OFF);
106 button=new FXMenuButton(this,FXString::null,NULL,pane,FRAME_RAISED|FRAME_THICK|MENUBUTTON_DOWN|MENUBUTTON_ATTACH_RIGHT,0,0,0,0,0,0,0,0);
107 button->setXOffset(border);
108 button->setYOffset(border);
109 flags&=~FLAG_UPDATE; // Never GUI update
110 }
111
112
113 // Create window
create()114 void FXListBox::create(){
115 FXPacker::create();
116 pane->create();
117 }
118
119
120 // Detach window
detach()121 void FXListBox::detach(){
122 FXPacker::detach();
123 pane->detach();
124 }
125
126
127 // Destroy window
destroy()128 void FXListBox::destroy(){
129 pane->destroy();
130 FXPacker::destroy();
131 }
132
133
134 // Enable the window
enable()135 void FXListBox::enable(){
136 if(!isEnabled()){
137 FXPacker::enable();
138 field->setBackColor(getApp()->getBackColor());
139 field->enable();
140 button->enable();
141 }
142 }
143
144
145 // Disable the window
disable()146 void FXListBox::disable(){
147 if(isEnabled()){
148 FXPacker::disable();
149 field->setBackColor(getApp()->getBaseColor());
150 field->disable();
151 button->disable();
152 }
153 }
154
155
156 // Get default width
getDefaultWidth()157 FXint FXListBox::getDefaultWidth(){
158 FXint ww,pw;
159 ww=field->getDefaultWidth()+button->getDefaultWidth()+(border<<1);
160 pw=pane->getDefaultWidth();
161 return FXMAX(ww,pw);
162 }
163
164
165 // Get default height
getDefaultHeight()166 FXint FXListBox::getDefaultHeight(){
167 FXint th,bh;
168 th=field->getDefaultHeight();
169 bh=button->getDefaultHeight();
170 return FXMAX(th,bh)+(border<<1);
171 }
172
173
174 // Recalculate layout
layout()175 void FXListBox::layout(){
176 FXint buttonWidth,fieldWidth,itemHeight;
177 itemHeight=height-(border<<1);
178 buttonWidth=button->getDefaultWidth();
179 fieldWidth=width-buttonWidth-(border<<1);
180 field->position(border,border,fieldWidth,itemHeight);
181 button->position(border+fieldWidth,border,buttonWidth,itemHeight);
182 pane->resize(width,pane->getDefaultHeight());
183 flags&=~FLAG_DIRTY;
184 }
185
186
187 // Update value from a message
onCmdSetValue(FXObject *,FXSelector,void * ptr)188 long FXListBox::onCmdSetValue(FXObject*,FXSelector,void* ptr){
189 setCurrentItem((FXint)(FXival)ptr);
190 return 1;
191 }
192
193
194 // Obtain value from list
onCmdGetIntValue(FXObject *,FXSelector,void * ptr)195 long FXListBox::onCmdGetIntValue(FXObject*,FXSelector,void* ptr){
196 *((FXint*)ptr)=getCurrentItem();
197 return 1;
198 }
199
200
201 // Update value from a message
onCmdSetIntValue(FXObject *,FXSelector,void * ptr)202 long FXListBox::onCmdSetIntValue(FXObject*,FXSelector,void* ptr){
203 setCurrentItem(*((FXint*)ptr));
204 return 1;
205 }
206
207
208 // Forward GUI update of list to target; but only if pane is not popped
onListUpdate(FXObject *,FXSelector,void *)209 long FXListBox::onListUpdate(FXObject*,FXSelector,void*){
210 return target && !isMenuShown() && target->tryHandle(this,FXSEL(SEL_UPDATE,message),NULL);
211 }
212
213
214 // Forward message from list widget
onListForward(FXObject *,FXSelector sel,void * ptr)215 long FXListBox::onListForward(FXObject*,FXSelector sel,void* ptr){
216 return target && target->tryHandle(this,FXSEL(FXSELTYPE(sel),message),ptr);
217 }
218
219
220 // Forward message from list widget
onListChanged(FXObject *,FXSelector,void * ptr)221 long FXListBox::onListChanged(FXObject*,FXSelector,void* ptr){
222 field->setText(list->getItemText((FXint)(FXival)ptr)); // FIXME but also called in notify callbacks...
223 field->setIcon(list->getItemIcon((FXint)(FXival)ptr));
224 return target && target->tryHandle(this,FXSEL(SEL_CHANGED,message),ptr);
225 }
226
227
228 // Clicked inside or outside an item in the list; unpost the pane
onListClicked(FXObject *,FXSelector,void *)229 long FXListBox::onListClicked(FXObject*,FXSelector,void*){
230 return button->handle(this,FXSEL(SEL_COMMAND,ID_UNPOST),NULL);
231 }
232
233
234 // Clicked on an item in the list; issue a callback
onListCommand(FXObject *,FXSelector,void * ptr)235 long FXListBox::onListCommand(FXObject*,FXSelector,void* ptr){
236 field->setText(list->getItemText((FXint)(FXival)ptr));
237 field->setIcon(list->getItemIcon((FXint)(FXival)ptr));
238 return target && target->tryHandle(this,FXSEL(SEL_COMMAND,message),ptr);
239 }
240
241
242 // Pressed left button in text field
onFieldButton(FXObject *,FXSelector,void *)243 long FXListBox::onFieldButton(FXObject*,FXSelector,void*){
244 button->showMenu(true);
245 return 1;
246 }
247
248
249 // Bounce focus to the field
onFocusSelf(FXObject * sender,FXSelector,void * ptr)250 long FXListBox::onFocusSelf(FXObject* sender,FXSelector,void* ptr){
251 return field->handle(sender,FXSEL(SEL_FOCUS_SELF,0),ptr);
252 }
253
254
255 // Select upper item
onFocusUp(FXObject *,FXSelector,void *)256 long FXListBox::onFocusUp(FXObject*,FXSelector,void*){
257 if(isEnabled()){
258 FXint index=getCurrentItem();
259 if(index<0) index=getNumItems()-1;
260 else if(0<index) index--;
261 if(0<=index && index<getNumItems()){
262 setCurrentItem(index,true);
263 }
264 return 1;
265 }
266 return 0;
267 }
268
269
270 // Select lower item
onFocusDown(FXObject *,FXSelector,void *)271 long FXListBox::onFocusDown(FXObject*,FXSelector,void*){
272 if(isEnabled()){
273 FXint index=getCurrentItem();
274 if(index<0) index=0;
275 else if(index<getNumItems()-1) index++;
276 if(0<=index && index<getNumItems()){
277 setCurrentItem(index,true);
278 }
279 return 1;
280 }
281 return 0;
282 }
283
284
285 // Mouse wheel
onMouseWheel(FXObject *,FXSelector,void * ptr)286 long FXListBox::onMouseWheel(FXObject*,FXSelector,void* ptr){
287 FXEvent* event=(FXEvent*)ptr;
288 if(isEnabled()){
289 FXint index=getCurrentItem();
290 if(event->code<0){
291 if(index<0) index=0;
292 else if(index<getNumItems()-1) index++;
293 }
294 else if(event->code>0){
295 if(index<0) index=getNumItems()-1;
296 else if(0<index) index--;
297 }
298 if(0<=index && index<getNumItems()){
299 setCurrentItem(index,true);
300 }
301 return 1;
302 }
303 return 0;
304 }
305
306
307 // Get number of items
getNumItems() const308 FXint FXListBox::getNumItems() const {
309 return list->getNumItems();
310 }
311
312
313 // Get number of visible items
getNumVisible() const314 FXint FXListBox::getNumVisible() const {
315 return list->getNumVisible();
316 }
317
318
319 // Set number of visible items
setNumVisible(FXint nvis)320 void FXListBox::setNumVisible(FXint nvis){
321 list->setNumVisible(nvis);
322 }
323
324
325 // Is item current
isItemCurrent(FXint index) const326 FXbool FXListBox::isItemCurrent(FXint index) const {
327 return list->isItemCurrent(index);
328 }
329
330
331 // Change current item
setCurrentItem(FXint index,FXbool notify)332 void FXListBox::setCurrentItem(FXint index,FXbool notify){
333 FXint current=list->getCurrentItem();
334 if(current!=index){
335 list->setCurrentItem(index,notify);
336 list->makeItemVisible(index);
337 if(0<=index){
338 field->setIcon(list->getItemIcon(index));
339 field->setText(list->getItemText(index));
340 }
341 else{
342 field->setIcon(NULL);
343 field->setText(" ");
344 }
345 }
346 }
347
348
349 // Get current item
getCurrentItem() const350 FXint FXListBox::getCurrentItem() const {
351 return list->getCurrentItem();
352 }
353
354
355 // Retrieve item
getItem(FXint index) const356 FXString FXListBox::getItem(FXint index) const {
357 return list->getItem(index)->getText();
358 }
359
360
361 // Replace text of item at index
setItem(FXint index,const FXString & text,FXIcon * icon,FXptr ptr,FXbool notify)362 FXint FXListBox::setItem(FXint index,const FXString& text,FXIcon* icon,FXptr ptr,FXbool notify){
363 if(index<0 || list->getNumItems()<=index){ fxerror("%s::setItem: index out of range.\n",getClassName()); }
364 list->setItem(index,text,icon,ptr,notify);
365 if(isItemCurrent(index)){
366 field->setIcon(icon);
367 field->setText(text);
368 }
369 recalc();
370 return index;
371 }
372
373
374 // Fill list by appending items from array of strings
fillItems(const FXchar * const * strings,FXIcon * icon,FXptr ptr,FXbool notify)375 FXint FXListBox::fillItems(const FXchar *const *strings,FXIcon* icon,FXptr ptr,FXbool notify){
376 FXint numberofitems=list->getNumItems();
377 FXint n=list->fillItems(strings,icon,ptr,notify);
378 if(numberofitems<=list->getCurrentItem()){
379 field->setIcon(list->getItemIcon(list->getCurrentItem()));
380 field->setText(list->getItemText(list->getCurrentItem()));
381 }
382 recalc();
383 return n;
384 }
385
386
387 // Fill list by appending items from array of strings
fillItems(const FXString * strings,FXIcon * icon,FXptr ptr,FXbool notify)388 FXint FXListBox::fillItems(const FXString* strings,FXIcon* icon,FXptr ptr,FXbool notify){
389 FXint numberofitems=list->getNumItems();
390 FXint n=list->fillItems(strings,icon,ptr,notify);
391 if(numberofitems<=list->getCurrentItem()){
392 field->setIcon(list->getItemIcon(list->getCurrentItem()));
393 field->setText(list->getItemText(list->getCurrentItem()));
394 }
395 recalc();
396 return n;
397 }
398
399
400 // Fill list by appending items from newline separated strings
fillItems(const FXString & strings,FXIcon * icon,FXptr ptr,FXbool notify)401 FXint FXListBox::fillItems(const FXString& strings,FXIcon* icon,FXptr ptr,FXbool notify){
402 FXint numberofitems=list->getNumItems();
403 FXint n=list->fillItems(strings,icon,ptr,notify);
404 if(numberofitems<=list->getCurrentItem()){
405 field->setIcon(list->getItemIcon(list->getCurrentItem()));
406 field->setText(list->getItemText(list->getCurrentItem()));
407 }
408 recalc();
409 return n;
410 }
411
412
413 // Insert item at index
insertItem(FXint index,const FXString & text,FXIcon * icon,FXptr ptr,FXbool notify)414 FXint FXListBox::insertItem(FXint index,const FXString& text,FXIcon* icon,FXptr ptr,FXbool notify){
415 if(index<0 || list->getNumItems()<index){ fxerror("%s::insertItem: index out of range.\n",getClassName()); }
416 list->insertItem(index,text,icon,ptr,notify);
417 if(isItemCurrent(index)){
418 field->setIcon(icon);
419 field->setText(text);
420 }
421 recalc();
422 return index;
423 }
424
425
426 // Append item
appendItem(const FXString & text,FXIcon * icon,FXptr ptr,FXbool notify)427 FXint FXListBox::appendItem(const FXString& text,FXIcon* icon,FXptr ptr,FXbool notify){
428 FXint index=list->appendItem(text,icon,ptr,notify);
429 if(isItemCurrent(index)){
430 field->setIcon(icon);
431 field->setText(text);
432 }
433 recalc();
434 return index;
435 }
436
437
438 // Prepend item
prependItem(const FXString & text,FXIcon * icon,FXptr ptr,FXbool notify)439 FXint FXListBox::prependItem(const FXString& text,FXIcon* icon,FXptr ptr,FXbool notify){
440 FXint index=list->prependItem(text,icon,ptr,notify);
441 if(isItemCurrent(index)){
442 field->setIcon(icon);
443 field->setText(text);
444 }
445 recalc();
446 return index;
447 }
448
449
450 // Move item from oldindex to newindex
moveItem(FXint newindex,FXint oldindex,FXbool notify)451 FXint FXListBox::moveItem(FXint newindex,FXint oldindex,FXbool notify){
452 FXint current=list->getCurrentItem();
453 list->moveItem(newindex,oldindex,notify);
454 if(current!=list->getCurrentItem()){
455 current=list->getCurrentItem();
456 if(0<=current){
457 field->setIcon(list->getItemIcon(current));
458 field->setText(list->getItemText(current));
459 }
460 else{
461 field->setIcon(NULL);
462 field->setText(" ");
463 }
464 }
465 recalc();
466 return newindex;
467 }
468
469
470 // Extract item from list
extractItem(FXint index,FXbool notify)471 FXListItem* FXListBox::extractItem(FXint index,FXbool notify){
472 FXint current=list->getCurrentItem();
473 FXListItem *result=list->extractItem(index,notify);
474 if(index==current){
475 current=list->getCurrentItem();
476 if(0<=current){
477 field->setIcon(list->getItemIcon(current));
478 field->setText(list->getItemText(current));
479 }
480 else{
481 field->setIcon(NULL);
482 field->setText(" ");
483 }
484 }
485 recalc();
486 return result;
487 }
488
489
490 // Remove given item
removeItem(FXint index,FXbool notify)491 void FXListBox::removeItem(FXint index,FXbool notify){
492 FXint current=list->getCurrentItem();
493 list->removeItem(index,notify);
494 if(index==current){
495 current=list->getCurrentItem();
496 if(0<=current){
497 field->setIcon(list->getItemIcon(current));
498 field->setText(list->getItemText(current));
499 }
500 else{
501 field->setIcon(NULL);
502 field->setText(" ");
503 }
504 }
505 recalc();
506 }
507
508
509 // Remove all items
clearItems(FXbool notify)510 void FXListBox::clearItems(FXbool notify){
511 list->clearItems(notify);
512 field->setIcon(NULL);
513 field->setText(" ");
514 recalc();
515 }
516
517
518 // Get item by name
findItem(const FXString & text,FXint start,FXuint flgs) const519 FXint FXListBox::findItem(const FXString& text,FXint start,FXuint flgs) const {
520 return list->findItem(text,start,flgs);
521 }
522
523
524 // Get item by data
findItemByData(FXptr ptr,FXint start,FXuint flgs) const525 FXint FXListBox::findItemByData(FXptr ptr,FXint start,FXuint flgs) const {
526 return list->findItemByData(ptr,start,flgs);
527 }
528
529
530 // Set item text
setItemText(FXint index,const FXString & txt)531 void FXListBox::setItemText(FXint index,const FXString& txt){
532 if(isItemCurrent(index)) field->setText(txt);
533 list->setItemText(index,txt);
534 recalc();
535 }
536
537
538 // Get item text
getItemText(FXint index) const539 FXString FXListBox::getItemText(FXint index) const {
540 return list->getItemText(index);
541 }
542
543
544 // Set item icon
setItemIcon(FXint index,FXIcon * icon,FXbool owned)545 void FXListBox::setItemIcon(FXint index,FXIcon* icon,FXbool owned){
546 if(isItemCurrent(index)) field->setIcon(icon);
547 list->setItemIcon(index,icon,owned);
548 recalc();
549 }
550
551
552 // Get item icon
getItemIcon(FXint index) const553 FXIcon* FXListBox::getItemIcon(FXint index) const {
554 return list->getItemIcon(index);
555 }
556
557
558 // Set item data
setItemData(FXint index,FXptr ptr) const559 void FXListBox::setItemData(FXint index,FXptr ptr) const {
560 list->setItemData(index,ptr);
561 }
562
563
564 // Get item data
getItemData(FXint index) const565 FXptr FXListBox::getItemData(FXint index) const {
566 return list->getItemData(index);
567 }
568
569
570 // Return true if item is enabled
isItemEnabled(FXint index) const571 FXbool FXListBox::isItemEnabled(FXint index) const {
572 return list->isItemEnabled(index);
573 }
574
575
576 // Enable item
enableItem(FXint index)577 FXbool FXListBox::enableItem(FXint index){
578 return list->enableItem(index);
579 }
580
581
582 // Disable item
disableItem(FXint index)583 FXbool FXListBox::disableItem(FXint index){
584 return list->disableItem(index);
585 }
586
587
588 // Show menu
showMenu(FXbool shw)589 void FXListBox::showMenu(FXbool shw){
590 button->showMenu(shw);
591 }
592
593
594 // Is the pane shown
isMenuShown() const595 FXbool FXListBox::isMenuShown() const {
596 return button->isMenuShown();
597 }
598
599
600 // Set font
setFont(FXFont * fnt)601 void FXListBox::setFont(FXFont* fnt){
602 if(!fnt){ fxerror("%s::setFont: NULL font specified.\n",getClassName()); }
603 field->setFont(fnt);
604 list->setFont(fnt);
605 recalc();
606 }
607
608
609 // Obtain font
getFont() const610 FXFont* FXListBox::getFont() const {
611 return field->getFont();
612 }
613
614
615 // Change popup pane shrinkwrap mode
setShrinkWrap(FXbool flag)616 void FXListBox::setShrinkWrap(FXbool flag){
617 pane->setShrinkWrap(flag);
618 }
619
620
621 // Return popup pane shrinkwrap mode
getShrinkWrap() const622 FXbool FXListBox::getShrinkWrap() const {
623 return pane->getShrinkWrap();
624 }
625
626
627 // Set window background color
setBackColor(FXColor clr)628 void FXListBox::setBackColor(FXColor clr){
629 field->setBackColor(clr);
630 list->setBackColor(clr);
631 }
632
633
634 // Get background color
getBackColor() const635 FXColor FXListBox::getBackColor() const {
636 return field->getBackColor();
637 }
638
639
640 // Set text color
setTextColor(FXColor clr)641 void FXListBox::setTextColor(FXColor clr){
642 field->setTextColor(clr);
643 list->setTextColor(clr);
644 }
645
646
647 // Return text color
getTextColor() const648 FXColor FXListBox::getTextColor() const {
649 return field->getTextColor();
650 }
651
652
653 // Set select background color
setSelBackColor(FXColor clr)654 void FXListBox::setSelBackColor(FXColor clr){
655 list->setSelBackColor(clr);
656 }
657
658
659 // Return selected background color
getSelBackColor() const660 FXColor FXListBox::getSelBackColor() const {
661 return list->getSelBackColor();
662 }
663
664
665 // Set selected text color
setSelTextColor(FXColor clr)666 void FXListBox::setSelTextColor(FXColor clr){
667 list->setSelTextColor(clr);
668 }
669
670
671 // Return selected text color
getSelTextColor() const672 FXColor FXListBox::getSelTextColor() const {
673 return list->getSelTextColor();
674 }
675
676
677 // Sort items using current sort function
sortItems()678 void FXListBox::sortItems(){
679 list->sortItems();
680 }
681
682
683 // Return sort function
getSortFunc() const684 FXListSortFunc FXListBox::getSortFunc() const {
685 return list->getSortFunc();
686 }
687
688
689 // Change sort function
setSortFunc(FXListSortFunc func)690 void FXListBox::setSortFunc(FXListSortFunc func){
691 list->setSortFunc(func);
692 }
693
694
695 // Set help text
setHelpText(const FXString & txt)696 void FXListBox::setHelpText(const FXString& txt){
697 field->setHelpText(txt);
698 }
699
700
701 // Get help text
getHelpText() const702 const FXString& FXListBox::getHelpText() const {
703 return field->getHelpText();
704 }
705
706
707 // Set tip text
setTipText(const FXString & txt)708 void FXListBox::setTipText(const FXString& txt){
709 field->setTipText(txt);
710 }
711
712
713 // Get tip text
getTipText() const714 const FXString& FXListBox::getTipText() const {
715 return field->getTipText();
716 }
717
718
719 // Save object to stream
save(FXStream & store) const720 void FXListBox::save(FXStream& store) const {
721 FXPacker::save(store);
722 store << field;
723 store << button;
724 store << list;
725 store << pane;
726 }
727
728
729 // Load object from stream
load(FXStream & store)730 void FXListBox::load(FXStream& store){
731 FXPacker::load(store);
732 store >> field;
733 store >> button;
734 store >> list;
735 store >> pane;
736 }
737
738
739 // Delete it
~FXListBox()740 FXListBox::~FXListBox(){
741 delete pane;
742 pane=(FXPopup*)-1L;
743 field=(FXButton*)-1L;
744 button=(FXMenuButton*)-1L;
745 list=(FXList*)-1L;
746 }
747
748 }
749