Patch level :

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :


git-svn-id: svn://10.65.10.50/branches/R_10_00@21968 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2011-04-18 13:20:56 +00:00
parent 5252f0a312
commit aca0ffaa05
2 changed files with 49 additions and 40 deletions

View File

@ -9,6 +9,9 @@
#include <tree.h> #include <tree.h>
#include <treectrl.h> #include <treectrl.h>
// DI "Prompt|field"
static TString_array _items;
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// TField_window // 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) WINDOW parent, TWindowed_field* owner)
: TField_window(x, y, dx, dy, parent, owner), _ctrl(NULL_WIN) : 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; TAuto_token_string _header;
private: private:
void create_children(XVT_TREEVIEW_NODE node); virtual void create_children(XVT_TREEVIEW_NODE node);
void handle_tree_event(EVENT* ep); virtual void handle_tree_event(EVENT* ep);
bool add_child(XVT_TREEVIEW_NODE parent); virtual bool add_child(XVT_TREEVIEW_NODE parent);
protected: // TWindow protected: // TWindow
virtual void update(); virtual void update();
@ -260,13 +264,13 @@ protected: // TWindow
virtual void force_update(); virtual void force_update();
public: public:
TTree* tree() const { return _tree; } virtual TTree* tree() const { return _tree; }
void set_tree(TTree* tree); virtual void set_tree(TTree* tree);
void hide_leaves(bool yes) { _hide_leaves = yes; } virtual void hide_leaves(bool yes) { _hide_leaves = yes; }
bool select_current(); virtual bool select_current();
bool goto_selected(); virtual bool goto_selected();
void set_header(const char* head); virtual void set_header(const char* head);
void set_row_height(int rh); virtual void set_row_height(int rh);
TTree_window(int x, int y, int dx, int dy, WINDOW parent, TTree_field* owner); TTree_window(int x, int y, int dx, int dy, WINDOW parent, TTree_field* owner);
virtual ~TTree_window() { } virtual ~TTree_window() { }
@ -279,9 +283,6 @@ bool TTree_window::add_child(XVT_TREEVIEW_NODE parent)
if (_hide_leaves && type == XVT_TREEVIEW_NODE_TERMINAL) if (_hide_leaves && type == XVT_TREEVIEW_NODE_TERMINAL)
return false; return false;
TString id; _tree->curr_id(id);
TString desc; _tree->get_description(desc);
XVT_IMAGE ii = NULL, ic = NULL, ie = NULL; XVT_IMAGE ii = NULL, ic = NULL, ie = NULL;
TImage* im_nor = _tree->image(false); TImage* im_nor = _tree->image(false);
if (im_nor != NULL) if (im_nor != NULL)
@ -295,11 +296,15 @@ bool TTree_window::add_child(XVT_TREEVIEW_NODE parent)
else else
ii = im_nor->xvt_image(); 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); XVT_TREEVIEW_NODE child = xvt_treeview_add_child_node(_ctrl, parent, type, ii, ic, ie, desc, NULL, id);
if (child != NULL) if (child != NULL)
{ {
if (!_tree->enabled()) if (!_tree->enabled())
xvt_treeview_enable_node(_ctrl, child, FALSE); 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()) 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) 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) 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) : TControl_host_window(x, y, dx, dy, parent, owner), _tree(NULL), _hide_leaves(false)
{ {
RCT rct; xvt_vobj_get_client_rect(win(), &rct); if (owner != NULL && owner->class_id() == CLASS_TREE_FIELD)
_ctrl = xvt_treeview_create(win(), &rct, "", 0, (long)this, owner->dlg(), {
NULL, NULL, NULL, 0, CHARY+2); 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)); XVT_COLOR_COMPONENT xcc[8]; memset(xcc, 0, sizeof(xcc));
xcc[0].type = XVT_COLOR_BACKGROUND; xcc[0].color = NORMAL_BACK_COLOR; xcc[0].type = XVT_COLOR_BACKGROUND; xcc[0].color = NORMAL_BACK_COLOR;
xcc[1].type = XVT_COLOR_FOREGROUND; xcc[1].color = NORMAL_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[2].type = XVT_COLOR_HIGHLIGHT; xcc[2].color = FOCUS_BACK_COLOR;
xcc[3].type = XVT_COLOR_SELECT; xcc[3].color = FOCUS_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[4].type = XVT_COLOR_BLEND; xcc[4].color = MASK_BACK_COLOR;
xcc[5].type = XVT_COLOR_TROUGH; xcc[5].color = DISABLED_COLOR; xcc[5].type = XVT_COLOR_TROUGH; xcc[5].color = DISABLED_COLOR;
xvt_ctl_set_colors(_ctrl, xcc, XVT_COLOR_ACTION_SET); 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[1].type = XVT_COLOR_FOREGROUND; xcc[1].color = PROMPT_COLOR;
xcc[2].type = XVT_COLOR_HIGHLIGHT; xcc[2].color = MASK_LIGHT_COLOR; xcc[2].type = XVT_COLOR_HIGHLIGHT; xcc[2].color = MASK_LIGHT_COLOR;
WIN_DEF wd; memset(&wd, 0, sizeof(wd)); WIN_DEF wd[2]; memset(&wd, 0, sizeof(wd));
wd.wtype = WC_OUTLOOKBAR; wd->wtype = WC_OUTLOOKBAR;
wd.v.ctl.ctrl_id = owner->dlg(); wd->v.ctl.ctrl_id = owner->dlg();
wd.v.ctl.font_id = xvtil_default_font(true); // Fat font wd->v.ctl.font_id = xvtil_default_font(true); // Fat font
wd.rct = resize_rect(x, y, dx, dy, wd.wtype, parent); wd->rct = resize_rect(x, y, dx, dy, wd->wtype, parent);
wd.ctlcolors = xcc; 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 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; return xvt_prop_for_each(win().win(), pcb, jolly) != 0;
} }
static TString_array _items;
bool TProp_field::parse_item(TScanner& scanner) bool TProp_field::parse_item(TScanner& scanner)
{ {
if (scanner.key() == "IT") 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) TProp_field::TProp_field(TMask* m) : TWindowed_field(m)
{ } {
_items.destroy();
}
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// TTreelist_window // TTreelist_window

View File

@ -48,7 +48,7 @@ class TTree;
class TTree_field : public TWindowed_field class TTree_field : public TWindowed_field
{ {
protected: // TObject public: // TObject
virtual word class_id() const; virtual word class_id() const;
virtual bool is_kind_of(word cid) const; virtual bool is_kind_of(word cid) const;
@ -61,11 +61,11 @@ public:
void hide_leaves(bool yes = true); void hide_leaves(bool yes = true);
void show_leaves(bool yes = true) { hide_leaves(!yes); } void show_leaves(bool yes = true) { hide_leaves(!yes); }
bool select_current(); virtual bool select_current();
bool goto_selected(); virtual bool goto_selected();
void set_header(const char* head); virtual void set_header(const char* head);
void set_row_height(int rh); virtual void set_row_height(int rh);
TTree_field(TMask* m) : TWindowed_field(m) { } TTree_field(TMask* m) : TWindowed_field(m) { }
virtual ~TTree_field() { } virtual ~TTree_field() { }