25 #define SIDE_SPACING 4
26 #define ICON_SPACING 4
37 FXIMPLEMENT(
MFXTreeListDynamic, FXTreeList, MFXTreeListDynamicMap, ARRAYNUMBER(MFXTreeListDynamicMap))
46 FXTreeItem(text, oi, ci, ptr) {
58 FXIcon* icon = (state & OPENED) ? openIcon : closedIcon;
59 FXFont* font = list->getFont();
60 FXint th = 0, tw = 0, ih = 0, iw = 0;
63 iw = icon->getWidth();
64 ih = icon->getHeight();
65 dc.drawIcon(icon, xx, yy + (hh - ih) / 2);
69 tw = 4 + font->getTextWidth(label.text(), label.length());
70 th = 4 + font->getFontHeight();
73 dc.setForeground(list->getSelBackColor());
74 dc.fillRectangle(xx, yy, tw, th);
77 dc.drawFocusRectangle(xx + 1, yy + 1, tw - 2, th - 2);
80 dc.setForeground(makeShadowColor(list->getBackColor()));
81 }
else if (isSelected()) {
82 dc.setForeground(list->getSelTextColor());
86 dc.drawText(xx + 2, yy + font->getFontAscent() + 2, label);
93 FXTreeList(p, tgt, sel, opts, 0, 0, 0, 200) {
100 setHeight(getContentHeight() + 20);
116 FXTreeList::update();
123 return FXTreeList::clearItems();
129 return FXTreeList::getNumItems();
142 if (newItem !=
nullptr) {
154 if (newItem !=
nullptr) {
171 return FXTreeList::getItemAt(x, y);
192 FXTreeList::onLeftBtnPress(obj, sel, ptr);
201 setHeight(getContentHeight() + 20);
207 FXTreeList::FXTreeList() {
FXDEFMAP(MFXTreeListDynamic) MFXTreeListDynamicMap[]
FXColor myTextColor
set text color
void setTextColor(FXColor clr)
Change text color.
void draw(const FXTreeList *list, FXDC &dc, FXint xx, FXint yy, FXint, FXint hh) const
draw tree item
void show()
Show MFXTreeListDynamic.
std::vector< FXTreeItemDynamic * > myFXTreeItemDynamicItems
list with current FXTreeItemDynamic elements
void clearItems()
clear items
FXint getNumItems()
get num items
FXint mySelectedItem
selected item
long onLeftBtnPress(FXObject *, FXSelector, void *)
void resetSelectedItem()
reset selected item
MFXTreeListDynamic()
default constructor
void hide()
Hide MFXTreeListDynamic.
FXWindow * getFXWindow()
get FXWindows associated with this MFXTreeListDynamic
FXTreeItem * getItemAt(FXint x, FXint y) const
Get item at x,y, if any.
FXTreeItem * appendItem(FXTreeItem *father, const FXString &text, FXIcon *oi, FXColor tColor=FXRGB(0, 0, 0))
append item with given text and icon
FXint getSelectedIndex()
getSelected item index
FXTreeItemDynamic * getItem(FXint index) const
Get item.
FXTreeItem * prependItem(FXTreeItem *father, const FXString &text, FXIcon *oi, FXColor tColor=FXRGB(0, 0, 0))
prepend item with given text and icon