24 #ifndef FXSCROLLAREA_H 25 #include "FXScrollArea.h" 33 LIST_EXTENDEDSELECT = 0,
34 LIST_SINGLESELECT = 0x00100000,
35 LIST_BROWSESELECT = 0x00200000,
36 LIST_MULTIPLESELECT = 0x00300000,
37 LIST_AUTOSELECT = 0x00400000,
38 LIST_NORMAL = LIST_EXTENDEDSELECT
61 FXListItem():icon(
nullptr),data(
nullptr),state(0),x(0),y(0){}
62 virtual void draw(
const FXList* list,
FXDC& dc,FXint x,FXint y,FXint w,FXint h)
const;
63 virtual FXint hitItem(
const FXList* list,FXint x,FXint y)
const;
78 virtual void setText(
const FXString& txt);
84 virtual void setIcon(
FXIcon* icn,FXbool owned=
false);
96 virtual void setFocus(FXbool focus);
99 FXbool
hasFocus()
const {
return (state&FOCUS)!=0; }
102 virtual void setSelected(FXbool selected);
108 virtual void setEnabled(FXbool enabled);
111 FXbool
isEnabled()
const {
return (state&DISABLED)==0; }
114 virtual void setDraggable(FXbool draggable);
120 virtual FXString getTipText()
const;
123 virtual FXint getWidth(
const FXList* list)
const;
126 virtual FXint getHeight(
const FXList* list)
const;
129 virtual void create();
132 virtual void detach();
135 virtual void destroy();
138 virtual void save(
FXStream& store)
const;
149 typedef FXint (*FXListSortFunc)(
const FXListItem*,
const FXListItem*);
153 typedef FXObjectListOf<FXListItem> FXListItemList;
179 FXColor selbackColor;
180 FXColor seltextColor;
185 FXListSortFunc sortfunc;
198 long onPaint(
FXObject*,FXSelector,
void*);
199 long onEnter(
FXObject*,FXSelector,
void*);
200 long onLeave(
FXObject*,FXSelector,
void*);
201 long onUngrabbed(
FXObject*,FXSelector,
void*);
202 long onKeyPress(
FXObject*,FXSelector,
void*);
203 long onKeyRelease(
FXObject*,FXSelector,
void*);
204 long onLeftBtnPress(
FXObject*,FXSelector,
void*);
205 long onLeftBtnRelease(
FXObject*,FXSelector,
void*);
206 long onRightBtnPress(
FXObject*,FXSelector,
void*);
207 long onRightBtnRelease(
FXObject*,FXSelector,
void*);
208 long onMotion(
FXObject*,FXSelector,
void*);
209 long onFocusIn(
FXObject*,FXSelector,
void*);
210 long onFocusOut(
FXObject*,FXSelector,
void*);
211 long onAutoScroll(
FXObject*,FXSelector,
void*);
212 long onClicked(
FXObject*,FXSelector,
void*);
213 long onDoubleClicked(
FXObject*,FXSelector,
void*);
214 long onTripleClicked(
FXObject*,FXSelector,
void*);
215 long onCommand(
FXObject*,FXSelector,
void*);
216 long onQueryTip(
FXObject*,FXSelector,
void*);
217 long onQueryHelp(
FXObject*,FXSelector,
void*);
218 long onTipTimer(
FXObject*,FXSelector,
void*);
219 long onLookupTimer(
FXObject*,FXSelector,
void*);
220 long onCmdSetValue(
FXObject*,FXSelector,
void*);
public:
221 long onCmdGetIntValue(
FXObject*,FXSelector,
void*);
222 long onCmdSetIntValue(
FXObject*,FXSelector,
void*);
230 ID_LOOKUPTIMER=FXScrollArea::ID_LAST,
236 FXList(
FXComposite *p,
FXObject* tgt=
nullptr,FXSelector sel=0,FXuint opts=LIST_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
239 virtual void create();
242 virtual void detach();
245 virtual void layout();
248 virtual FXint getDefaultWidth();
251 virtual FXint getDefaultHeight();
254 virtual FXint getContentWidth();
257 virtual FXint getContentHeight();
260 virtual void recalc();
263 virtual FXbool canFocus()
const;
266 virtual void setFocus();
269 virtual void killFocus();
278 void setNumVisible(FXint nvis);
284 FXint setItem(FXint index,
FXListItem* item,FXbool notify=
false);
287 FXint setItem(FXint index,
const FXString& text,
FXIcon *icon=
nullptr,FXptr ptr=
nullptr,FXbool notify=
false);
290 FXint fillItems(
const FXchar *
const *strings,
FXIcon *icon=
nullptr,FXptr ptr=
nullptr,FXbool notify=
false);
293 FXint fillItems(
const FXString* strings,
FXIcon *icon=
nullptr,FXptr ptr=
nullptr,FXbool notify=
false);
296 FXint fillItems(
const FXString& strings,
FXIcon *icon=
nullptr,FXptr ptr=
nullptr,FXbool notify=
false);
299 FXint insertItem(FXint index,
FXListItem* item,FXbool notify=
false);
302 FXint insertItem(FXint index,
const FXString& text,
FXIcon *icon=
nullptr,FXptr ptr=
nullptr,FXbool notify=
false);
305 FXint appendItem(
FXListItem* item,FXbool notify=
false);
308 FXint appendItem(
const FXString& text,
FXIcon *icon=
nullptr,FXptr ptr=
nullptr,FXbool notify=
false);
311 FXint prependItem(
FXListItem* item,FXbool notify=
false);
314 FXint prependItem(
const FXString& text,
FXIcon *icon=
nullptr,FXptr ptr=
nullptr,FXbool notify=
false);
317 FXint moveItem(FXint newindex,FXint oldindex,FXbool notify=
false);
320 FXListItem* extractItem(FXint index,FXbool notify=
false);
323 void removeItem(FXint index,FXbool notify=
false);
326 void clearItems(FXbool notify=
false);
329 FXint getItemWidth(FXint index)
const;
332 FXint getItemHeight(FXint index)
const;
335 virtual FXint getItemAt(FXint x,FXint y)
const;
338 FXint hitItem(FXint index,FXint x,FXint y)
const;
341 virtual void makeItemVisible(FXint index);
353 FXint findItem(
const FXString&
string,FXint start=-1,FXuint flags=SEARCH_FORWARD|SEARCH_WRAP)
const;
362 FXint findItemByData(FXptr ptr,FXint start=-1,FXuint flags=SEARCH_FORWARD|SEARCH_WRAP)
const;
365 void setItemText(FXint index,
const FXString& text);
368 FXString getItemText(FXint index)
const;
371 void setItemIcon(FXint index,
FXIcon* icon,FXbool owned=
false);
374 FXIcon* getItemIcon(FXint index)
const;
377 void setItemData(FXint index,FXptr ptr);
380 FXptr getItemData(FXint index)
const;
383 FXbool isItemSelected(FXint index)
const;
386 FXbool isItemCurrent(FXint index)
const;
389 FXbool isItemVisible(FXint index)
const;
392 FXbool isItemEnabled(FXint index)
const;
395 void updateItem(FXint index)
const;
398 virtual FXbool enableItem(FXint index);
401 virtual FXbool disableItem(FXint index);
404 virtual FXbool selectItem(FXint index,FXbool notify=
false);
407 virtual FXbool deselectItem(FXint index,FXbool notify=
false);
410 virtual FXbool toggleItem(FXint index,FXbool notify=
false);
413 virtual FXbool extendSelection(FXint index,FXbool notify=
false);
416 virtual FXbool selectAll(FXbool notify=
false);
419 virtual FXbool killSelection(FXbool notify=
false);
422 virtual void setCurrentItem(FXint index,FXbool notify=
false);
428 void setAnchorItem(FXint index);
443 void setFont(
FXFont* fnt);
452 void setTextColor(FXColor clr);
458 void setSelBackColor(FXColor clr);
464 void setSelTextColor(FXColor clr);
467 FXuint getListStyle()
const;
470 void setListStyle(FXuint style);
473 void setHelpText(
const FXString& text);
479 virtual void save(
FXStream& store)
const;
FXColor getTextColor() const
Return normal text color.
Definition: FXList.h:449
FXbool isEnabled() const
Return true if this item is enabled.
Definition: FXList.h:111
FXint getAnchorItem() const
Return anchor item, if any.
Definition: FXList.h:431
FXListItem(const FXString &text, FXIcon *ic=nullptr, FXptr ptr=nullptr)
Construct new item with given text, icon, and user-data.
Definition: FXList.h:75
FXColor getSelTextColor() const
Return selected text color.
Definition: FXList.h:461
FXbool isSelected() const
Return true if this item is selected.
Definition: FXList.h:105
FXint getNumItems() const
Return the number of items in the list.
Definition: FXList.h:272
FXptr getData() const
Get item's user data.
Definition: FXList.h:93
Base composite.
Definition: FXComposite.h:32
void setSortFunc(FXListSortFunc func)
Change sort function.
Definition: FXList.h:440
FXint getCurrentItem() const
Return current item, if any.
Definition: FXList.h:425
FXbool isDraggable() const
Return true if this item is draggable.
Definition: FXList.h:117
FXColor getSelBackColor() const
Return selected text background.
Definition: FXList.h:455
void setData(FXptr ptr)
Change item's user data.
Definition: FXList.h:90
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:81
Abstract Device Context.
Definition: FXDC.h:153
FXFont * getFont() const
Return text font.
Definition: FXList.h:446
A List Widget displays a list of items, each with a text and optional icon.
Definition: FXList.h:169
Definition: FX4Splitter.h:28
An Icon is an image with two additional server-side resources: a shape bitmap, which is used to mask ...
Definition: FXIcon.h:42
FXIcon * getIcon() const
Return item's icon.
Definition: FXList.h:87
FXival no() const
Return number of objects.
Definition: FXObjectList.h:59
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:134
List item.
Definition: FXList.h:48
const FXString & getHelpText() const
Get the status line help text for this list.
Definition: FXList.h:476
FXint getNumVisible() const
Return number of visible items.
Definition: FXList.h:275
const FXString & getText() const
Return item's text label.
Definition: FXList.h:81
Font class.
Definition: FXFont.h:137
FXbool hasFocus() const
Return true if item has focus.
Definition: FXList.h:99
FXListSortFunc getSortFunc() const
Return sort function.
Definition: FXList.h:437
FXString provides essential string manipulation capabilities in FOX.
Definition: FXString.h:42