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 <treectrl.h>
// DI "Prompt|field"
static TString_array _items;
///////////////////////////////////////////////////////////
// TField_window
///////////////////////////////////////////////////////////
@ -234,6 +237,7 @@ 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)
{
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,11 +555,14 @@ 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)
{
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);
@ -567,6 +575,7 @@ TTree_window::TTree_window(int x, int y, int dx, int dy, WINDOW parent, TTree_fi
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

View File

@ -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() { }