diff --git a/include/treectrl.cpp b/include/treectrl.cpp index 4790097d0..0f358f4a5 100755 --- a/include/treectrl.cpp +++ b/include/treectrl.cpp @@ -9,6 +9,9 @@ #include #include +// DI "Prompt|field" +static TString_array _items; + /////////////////////////////////////////////////////////// // TField_window /////////////////////////////////////////////////////////// @@ -234,7 +237,8 @@ TControl_host_window::TControl_host_window(int x, int y, int dx, int dy, WINDOW parent, TWindowed_field* owner) : TField_window(x, y, dx, dy, parent, owner), _ctrl(NULL_WIN) { - set_scroll_max(0, 0); // Get rid of that useless scrollbars + if (win() != NULL_WIN) + set_scroll_max(0, 0); // Get rid of that useless scrollbars } /////////////////////////////////////////////////////////// @@ -250,9 +254,9 @@ protected: TAuto_token_string _header; private: - void create_children(XVT_TREEVIEW_NODE node); - void handle_tree_event(EVENT* ep); - bool add_child(XVT_TREEVIEW_NODE parent); + virtual void create_children(XVT_TREEVIEW_NODE node); + virtual void handle_tree_event(EVENT* ep); + virtual bool add_child(XVT_TREEVIEW_NODE parent); protected: // TWindow virtual void update(); @@ -260,13 +264,13 @@ protected: // TWindow virtual void force_update(); public: - TTree* tree() const { return _tree; } - void set_tree(TTree* tree); - void hide_leaves(bool yes) { _hide_leaves = yes; } - bool select_current(); - bool goto_selected(); - void set_header(const char* head); - void set_row_height(int rh); + virtual TTree* tree() const { return _tree; } + virtual void set_tree(TTree* tree); + virtual void hide_leaves(bool yes) { _hide_leaves = yes; } + virtual bool select_current(); + virtual bool goto_selected(); + virtual void set_header(const char* head); + virtual void set_row_height(int rh); TTree_window(int x, int y, int dx, int dy, WINDOW parent, TTree_field* owner); virtual ~TTree_window() { } @@ -279,9 +283,6 @@ bool TTree_window::add_child(XVT_TREEVIEW_NODE parent) if (_hide_leaves && type == XVT_TREEVIEW_NODE_TERMINAL) return false; - TString id; _tree->curr_id(id); - TString desc; _tree->get_description(desc); - XVT_IMAGE ii = NULL, ic = NULL, ie = NULL; TImage* im_nor = _tree->image(false); if (im_nor != NULL) @@ -295,11 +296,15 @@ bool TTree_window::add_child(XVT_TREEVIEW_NODE parent) else ii = im_nor->xvt_image(); } + TString256 desc; _tree->get_description(desc); + TString256 id; _tree->curr_id(id); XVT_TREEVIEW_NODE child = xvt_treeview_add_child_node(_ctrl, parent, type, ii, ic, ie, desc, NULL, id); if (child != NULL) { if (!_tree->enabled()) xvt_treeview_enable_node(_ctrl, child, FALSE); + if (_tree->marked()) + xvt_treeview_set_node_bold(_ctrl, child, TRUE); if (type == XVT_TREEVIEW_NODE_NONTERMINAL && _tree->expanded()) { @@ -550,23 +555,27 @@ void TTree_window::set_header(const char* head) void TTree_window::set_row_height(int rh) { + // TBI } TTree_window::TTree_window(int x, int y, int dx, int dy, WINDOW parent, TTree_field* owner) : TControl_host_window(x, y, dx, dy, parent, owner), _tree(NULL), _hide_leaves(false) { - RCT rct; xvt_vobj_get_client_rect(win(), &rct); - _ctrl = xvt_treeview_create(win(), &rct, "", 0, (long)this, owner->dlg(), - NULL, NULL, NULL, 0, CHARY+2); + if (owner != NULL && owner->class_id() == CLASS_TREE_FIELD) + { + RCT rct; xvt_vobj_get_client_rect(win(), &rct); + _ctrl = xvt_treeview_create(win(), &rct, "", 0, (long)this, owner->dlg(), + NULL, NULL, NULL, 0, CHARY+2); - XVT_COLOR_COMPONENT xcc[8]; memset(xcc, 0, sizeof(xcc)); - xcc[0].type = XVT_COLOR_BACKGROUND; xcc[0].color = NORMAL_BACK_COLOR; - xcc[1].type = XVT_COLOR_FOREGROUND; xcc[1].color = NORMAL_COLOR; - xcc[2].type = XVT_COLOR_HIGHLIGHT; xcc[2].color = FOCUS_BACK_COLOR; - xcc[3].type = XVT_COLOR_SELECT; xcc[3].color = FOCUS_COLOR; - xcc[4].type = XVT_COLOR_BLEND; xcc[4].color = MASK_BACK_COLOR; - xcc[5].type = XVT_COLOR_TROUGH; xcc[5].color = DISABLED_COLOR; - xvt_ctl_set_colors(_ctrl, xcc, XVT_COLOR_ACTION_SET); + XVT_COLOR_COMPONENT xcc[8]; memset(xcc, 0, sizeof(xcc)); + xcc[0].type = XVT_COLOR_BACKGROUND; xcc[0].color = NORMAL_BACK_COLOR; + xcc[1].type = XVT_COLOR_FOREGROUND; xcc[1].color = NORMAL_COLOR; + xcc[2].type = XVT_COLOR_HIGHLIGHT; xcc[2].color = FOCUS_BACK_COLOR; + xcc[3].type = XVT_COLOR_SELECT; xcc[3].color = FOCUS_COLOR; + xcc[4].type = XVT_COLOR_BLEND; xcc[4].color = MASK_BACK_COLOR; + xcc[5].type = XVT_COLOR_TROUGH; xcc[5].color = DISABLED_COLOR; + xvt_ctl_set_colors(_ctrl, xcc, XVT_COLOR_ACTION_SET); + } } /////////////////////////////////////////////////////////// @@ -670,14 +679,14 @@ TOutlook_window::TOutlook_window(int x, int y, int dx, int dy, WINDOW parent, TO xcc[1].type = XVT_COLOR_FOREGROUND; xcc[1].color = PROMPT_COLOR; xcc[2].type = XVT_COLOR_HIGHLIGHT; xcc[2].color = MASK_LIGHT_COLOR; - WIN_DEF wd; memset(&wd, 0, sizeof(wd)); - wd.wtype = WC_OUTLOOKBAR; - wd.v.ctl.ctrl_id = owner->dlg(); - wd.v.ctl.font_id = xvtil_default_font(true); // Fat font - wd.rct = resize_rect(x, y, dx, dy, wd.wtype, parent); - wd.ctlcolors = xcc; + WIN_DEF wd[2]; memset(&wd, 0, sizeof(wd)); + wd->wtype = WC_OUTLOOKBAR; + wd->v.ctl.ctrl_id = owner->dlg(); + wd->v.ctl.font_id = xvtil_default_font(true); // Fat font + wd->rct = resize_rect(x, y, dx, dy, wd->wtype, parent); + wd->ctlcolors = xcc; - _ctrl = xvt_ctl_create_def(&wd, win(), 0); + _ctrl = xvt_ctl_create_def(wd, win(), 0); } word TOutlook_field::class_id() const @@ -1146,8 +1155,6 @@ bool TProp_field::for_each_property(PROP_CALLBACK pcb, void* jolly) return xvt_prop_for_each(win().win(), pcb, jolly) != 0; } -static TString_array _items; - bool TProp_field::parse_item(TScanner& scanner) { if (scanner.key() == "IT") @@ -1222,7 +1229,9 @@ TField_window* TProp_field::create_window(int x, int y, int dx, int dy, WINDOW p } TProp_field::TProp_field(TMask* m) : TWindowed_field(m) -{ } +{ + _items.destroy(); +} /////////////////////////////////////////////////////////// // TTreelist_window diff --git a/include/treectrl.h b/include/treectrl.h index fbbb51b95..6ee366e48 100755 --- a/include/treectrl.h +++ b/include/treectrl.h @@ -48,7 +48,7 @@ class TTree; class TTree_field : public TWindowed_field { -protected: // TObject +public: // TObject virtual word class_id() const; virtual bool is_kind_of(word cid) const; @@ -61,11 +61,11 @@ public: void hide_leaves(bool yes = true); void show_leaves(bool yes = true) { hide_leaves(!yes); } - bool select_current(); - bool goto_selected(); + virtual bool select_current(); + virtual bool goto_selected(); - void set_header(const char* head); - void set_row_height(int rh); + virtual void set_header(const char* head); + virtual void set_row_height(int rh); TTree_field(TMask* m) : TWindowed_field(m) { } virtual ~TTree_field() { }