Patch level : 10.0

Files correlati     : xvaga.dll
Ricompilazione Demo : [ ]
Commento            :
Aggiunta funzione di ricerca stringa negli alberi,
usata soprattutto dal menu principale


git-svn-id: svn://10.65.10.50/trunk@17318 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2008-09-29 14:18:26 +00:00
parent f562042451
commit bf9410aed9
3 changed files with 55 additions and 11 deletions

View File

@ -2706,10 +2706,16 @@ void xvt_menu_translate_tree(WINDOW win, TRANSLATE_CALLBACK tc)
void xvt_menu_set_font_sel(WINDOW win, XVT_FNTID font_id)
{ /* Ignored */ }
static wxMenuItem* GetXvtMenuItem(WINDOW /* win */, MENU_TAG tag)
static wxMenuItem* GetXvtMenuItem(WINDOW win, MENU_TAG tag)
{
wxMenuBar* bar = ((TTaskWin*)_task_win)->GetMenuBar();
wxMenuItem* item = bar ? bar->FindItem(tag) : NULL;
wxMenuItem* item = NULL;
wxFrame* pFrame = wxDynamicCast((wxObject*)win, wxFrame);
if (pFrame != NULL)
{
wxMenuBar* bar = pFrame->GetMenuBar();
if (bar != NULL)
item = bar->FindItem(tag);
}
return item;
}

View File

@ -337,6 +337,7 @@ XVTDLL WINDOW xvt_treeview_create(WINDOW parent_win,
long attrs, int line_height);
XVTDLL void xvt_treeview_destroy_node(WINDOW win, XVT_TREEVIEW_NODE node);
XVTDLL BOOLEAN xvt_treeview_expand_node(WINDOW win, XVT_TREEVIEW_NODE node, BOOLEAN recurse);
XVTDLL XVT_TREEVIEW_NODE xvt_treeview_find_node_string(WINDOW win, const char* text);
XVTDLL XVT_TREEVIEW_NODE xvt_treeview_get_child_node(WINDOW win, XVT_TREEVIEW_NODE parent_node, int position);
XVTDLL const char* xvt_treeview_get_node_data(WINDOW win, XVT_TREEVIEW_NODE node);
XVTDLL XVT_TREEVIEW_NODE xvt_treeview_get_root_node(WINDOW win);

View File

@ -1122,6 +1122,40 @@ void xvt_treeview_suspend(WINDOW win)
tv.Suspend();
}
static XVT_TREEVIEW_NODE FindTreeNodeString(wxTreeCtrl& tv, const wxTreeItemId& parent,
const char*text)
{
if (parent.IsOk())
{
TwxTreeItemData* pData = (TwxTreeItemData*)tv.GetItemData(parent);
if (pData != NULL && pData->m_strData == text)
return parent.m_pItem;
wxTreeItemIdValue cookie;
for (wxTreeItemId id = tv.GetFirstChild(parent, cookie); id.IsOk();
id = tv.GetNextChild(parent, cookie))
{
XVT_TREEVIEW_NODE node = FindTreeNodeString(tv, id, text);
if (node != NULL)
return node;
}
}
return NULL;
}
XVT_TREEVIEW_NODE xvt_treeview_find_node_string(WINDOW win, const char* text)
{
XVT_TREEVIEW_NODE node = NULL;
if (win != NULL_WIN && text && *text)
{
CAST_TREEVIEW(win, tv);
node = FindTreeNodeString(tv, tv.GetSelection(), text);
if (node == NULL)
node = FindTreeNodeString(tv, tv.GetRootItem(), text);
}
return node;
}
///////////////////////////////////////////////////////////
// TwxOutlookBar
///////////////////////////////////////////////////////////
@ -1279,14 +1313,17 @@ void TwxOutlookBar::OnMouseCaptureLost(wxMouseCaptureLostEvent&)
void TwxOutlookBar::OnSelected(wxCommandEvent& evt)
{
EVENT e; memset(&e, 0, sizeof(EVENT));
e.type = E_CONTROL;
e.v.ctl.id = evt.GetId();
e.v.ctl.ci.type = WC_OUTLOOKBAR;
e.v.ctl.ci.win = WINDOW(this);
e.v.ctl.ci.v.lbox.dbl_click = evt.GetEventType() == wxEVT_COMMAND_LISTBOX_DOUBLECLICKED;
TwxWindow* win = (TwxWindow*)GetParent();
win->DoXvtEvent(e);
TwxWindow* win = wxDynamicCast(GetParent(), TwxWindow);
if (win != NULL)
{
EVENT e; memset(&e, 0, sizeof(EVENT));
e.type = E_CONTROL;
e.v.ctl.id = evt.GetId();
e.v.ctl.ci.type = WC_OUTLOOKBAR;
e.v.ctl.ci.win = WINDOW(this);
e.v.ctl.ci.v.lbox.dbl_click = evt.GetEventType() == wxEVT_COMMAND_LISTBOX_DOUBLECLICKED;
win->DoXvtEvent(e);
}
}
int TwxOutlookBar::Add(short nIconId, const wxString strText, int nFlags)