1 #include "XABAccountView.h"
3 BEGIN_EVENT_TABLE(XABAccountView, wxTreeCtrl)
4 //EVT_LEFT_UP(XABAccountView::OnMouseClick)
5 EVT_LEFT_DCLICK(XABAccountView::OnMouseClick)
6 EVT_TREE_ITEM_EXPANDED(-1, XABAccountView::ExpColProc)
7 EVT_TREE_ITEM_COLLAPSED(-1, XABAccountView::ExpColProc)
10 void XABAccountView::Init(){
16 bool XABAccountView::Create(wxWindow* parent){
18 return wxTreeCtrl::Create(parent, 1, wxPoint(0,0), wxSize(100,100), wxTR_DEFAULT_STYLE|wxTR_HIDE_ROOT);
22 wxWindow* XABAccountView::GetControl(){
28 void XABAccountView::SetStringValue(const wxString& s){
30 tid = wxTreeCtrl::GetSelection();
34 wxString XABAccountView::GetStringValue() const{
37 wxString wxStrName = wxTreeCtrl::GetItemText(tid);
44 void XABAccountView::OnMouseClick(wxMouseEvent& WXUNUSED(event)){
48 // Check if item expanding or collapsed
49 // has occured before dismissing.
53 // Item expansion/collapsing didn't occur.
55 tid = wxTreeCtrl::GetSelection();
64 void XABAccountView::SetAccount(){
66 tid = wxTreeCtrl::GetSelection();
71 // Needed by SetStringValue
72 wxTreeItemId XABAccountView::FindItemByText(wxTreeItemId parent, const wxString& text)
74 wxTreeItemIdValue cookie;
75 wxTreeItemId child = GetFirstChild(parent, cookie);
78 if (GetItemText(child) == text)
82 if (ItemHasChildren(child))
84 wxTreeItemId found = FindItemByText(child, text);
88 child = GetNextChild(parent, cookie);
90 return wxTreeItemId();
93 void XABAccountView::ExpColProc(wxTreeEvent& event){