X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Fwidgets%2FXABAccountView.cpp;h=803496891b5a8c31f43fac9badbd9d14d39c6878;hb=ee9b71949005734012f18251774807c38b989ae2;hp=7020a4db77c2c5dfb12bdd6e3ba52f97610862b5;hpb=45729fca56479bd9158486e0cda0c4a94b4dd1dc;p=xestiaab%2F.git diff --git a/source/widgets/XABAccountView.cpp b/source/widgets/XABAccountView.cpp index 7020a4d..8034968 100644 --- a/source/widgets/XABAccountView.cpp +++ b/source/widgets/XABAccountView.cpp @@ -1,38 +1,65 @@ +// XABAccountView.cpp - XABAccountView widget +// +// (c) 2012-2015 Xestia Software Development. +// +// This file is part of Xestia Address Book. +// +// Xestia Address Book is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by the +// Free Software Foundation, version 3 of the license. +// +// Xestia Address Book is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with Xestia Address Book. If not, see + #include "XABAccountView.h" BEGIN_EVENT_TABLE(XABAccountView, wxTreeCtrl) - //EVT_LEFT_UP(XABAccountView::OnMouseClick) - EVT_LEFT_DCLICK(XABAccountView::OnMouseClick) - EVT_TREE_ITEM_EXPANDED(-1, XABAccountView::ExpColProc) - EVT_TREE_ITEM_COLLAPSED(-1, XABAccountView::ExpColProc) +EVT_LEFT_DCLICK(XABAccountView::OnMouseClick) +EVT_TREE_ITEM_EXPANDED(-1, XABAccountView::ExpColProc) +EVT_TREE_ITEM_COLLAPSED(-1, XABAccountView::ExpColProc) END_EVENT_TABLE() void XABAccountView::Init(){ + // Initialise the XABAccountView object. + idx = -1; } bool XABAccountView::Create(wxWindow* parent){ + // Create the XABAccountView control. + return wxTreeCtrl::Create(parent, 1, wxPoint(0,0), wxSize(100,100), wxTR_DEFAULT_STYLE|wxTR_HIDE_ROOT); } wxWindow* XABAccountView::GetControl(){ + // Get the control pointer. + return this; } void XABAccountView::SetStringValue(const wxString& s){ + // Set the string value for the XABAccountView control. + tid = wxTreeCtrl::GetSelection(); } wxString XABAccountView::GetStringValue() const{ + // Get the string value for the XABAccountView control. + if (tid.IsOk()){ wxString wxStrName = wxTreeCtrl::GetItemText(tid); return wxStrName; @@ -63,14 +90,19 @@ void XABAccountView::OnMouseClick(wxMouseEvent& WXUNUSED(event)){ void XABAccountView::SetAccount(){ + // Set the account for the XABAccountView control. + tid = wxTreeCtrl::GetSelection(); Dismiss(); } -// Needed by SetStringValue wxTreeItemId XABAccountView::FindItemByText(wxTreeItemId parent, const wxString& text) { + + // Find an item based on the supplied wxString value. + // Return a wxTreeItemId object if found. + wxTreeItemIdValue cookie; wxTreeItemId child = GetFirstChild(parent, cookie); while (child.IsOk()) @@ -92,6 +124,9 @@ wxTreeItemId XABAccountView::FindItemByText(wxTreeItemId parent, const wxString& void XABAccountView::ExpColProc(wxTreeEvent& event){ + // Function when pressing the down button on the + // XABAccountView control. + ixp = TRUE; } \ No newline at end of file