X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d7463f75f9c170c29b4965d27dccf535ac32cfde..5c60e84569e7646f091a60c14ac2f4c54b100d8a:/utils/configtool/src/configtree.cpp diff --git a/utils/configtool/src/configtree.cpp b/utils/configtool/src/configtree.cpp index 3da10101fb..10769df40e 100644 --- a/utils/configtool/src/configtree.cpp +++ b/utils/configtool/src/configtree.cpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // Name: configtree.h -// Purpose: wxWindows Configuration Tool tree class +// Purpose: wxWidgets Configuration Tool tree class // Author: Julian Smart // Modified by: // Created: 2003-06-03 @@ -9,23 +9,17 @@ // Licence: ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ -#pragma implementation "configtree.h" -#endif - -// Includes other headers for precompiled compilation -#include "wx/wx.h" +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif -#include "wx/imaglist.h" #include "wx/cshelp.h" +#include "wx/imaglist.h" // Include XPM icons -#include "bitmaps/folder1.xpm" - #include "bitmaps/closedfolder.xpm" #include "bitmaps/closedfolder_dis.xpm" @@ -64,8 +58,8 @@ IMPLEMENT_CLASS(ctConfigTreeCtrl, wxTreeCtrl) BEGIN_EVENT_TABLE(ctConfigTreeCtrl, wxTreeCtrl) EVT_MOUSE_EVENTS(ctConfigTreeCtrl::OnMouseEvent) EVT_CHAR(ctConfigTreeCtrl::OnKeyDown) - EVT_TREE_SEL_CHANGED(-1, ctConfigTreeCtrl::OnSelChanged) - EVT_HELP(-1, ctConfigTreeCtrl::OnHelp) + EVT_TREE_SEL_CHANGED(wxID_ANY, ctConfigTreeCtrl::OnSelChanged) + EVT_HELP(wxID_ANY, ctConfigTreeCtrl::OnHelp) END_EVENT_TABLE() ctConfigTreeCtrl::ctConfigTreeCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pt, @@ -90,32 +84,32 @@ wxTreeCtrl(parent, id, pt, sz, style) // Load the icons and initialize the tree void ctConfigTreeCtrl::LoadIcons() { - m_imageList = new wxImageList(16, 16, TRUE); + m_imageList = new wxImageList(16, 16, true); m_iconTable.SetImageList(m_imageList); SetImageList(m_imageList); - m_iconTable.AddInfo("Group", wxIcon(closedfolder_xpm), 0, TRUE); - m_iconTable.AddInfo("Group", wxIcon(closedfolder_dis_xpm), 0, FALSE); + m_iconTable.AddInfo(_T("Group"), wxIcon(closedfolder_xpm), 0, true); + m_iconTable.AddInfo(_T("Group"), wxIcon(closedfolder_dis_xpm), 0, false); - m_iconTable.AddInfo("Checkbox", wxIcon(checked_xpm), 0, TRUE); - m_iconTable.AddInfo("Checkbox", wxIcon(checked_dis_xpm), 0, FALSE); - m_iconTable.AddInfo("Checkbox", wxIcon(unchecked_xpm), 1, TRUE); - m_iconTable.AddInfo("Checkbox", wxIcon(unchecked_dis_xpm), 1, FALSE); + m_iconTable.AddInfo(_T("Checkbox"), wxIcon(checked_xpm), 0, true); + m_iconTable.AddInfo(_T("Checkbox"), wxIcon(checked_dis_xpm), 0, false); + m_iconTable.AddInfo(_T("Checkbox"), wxIcon(unchecked_xpm), 1, true); + m_iconTable.AddInfo(_T("Checkbox"), wxIcon(unchecked_dis_xpm), 1, false); - m_iconTable.AddInfo("CheckGroup", wxIcon(checkedfolder_xpm), 0, TRUE); - m_iconTable.AddInfo("CheckGroup", wxIcon(checkedfolder_dis_xpm), 0, FALSE); - m_iconTable.AddInfo("CheckGroup", wxIcon(uncheckedfolder_xpm), 1, TRUE); - m_iconTable.AddInfo("CheckGroup", wxIcon(uncheckedfolder_dis_xpm), 1, FALSE); + m_iconTable.AddInfo(_T("CheckGroup"), wxIcon(checkedfolder_xpm), 0, true); + m_iconTable.AddInfo(_T("CheckGroup"), wxIcon(checkedfolder_dis_xpm), 0, false); + m_iconTable.AddInfo(_T("CheckGroup"), wxIcon(uncheckedfolder_xpm), 1, true); + m_iconTable.AddInfo(_T("CheckGroup"), wxIcon(uncheckedfolder_dis_xpm), 1, false); - m_iconTable.AddInfo("RadioGroup", wxIcon(radiofolderon_xpm), 0, TRUE); - m_iconTable.AddInfo("RadioGroup", wxIcon(radiofolderon_dis_xpm), 0, FALSE); - m_iconTable.AddInfo("RadioGroup", wxIcon(radiofolderoff_xpm), 1, TRUE); - m_iconTable.AddInfo("RadioGroup", wxIcon(radiofolderoff_dis_xpm), 1, FALSE); + m_iconTable.AddInfo(_T("RadioGroup"), wxIcon(radiofolderon_xpm), 0, true); + m_iconTable.AddInfo(_T("RadioGroup"), wxIcon(radiofolderon_dis_xpm), 0, false); + m_iconTable.AddInfo(_T("RadioGroup"), wxIcon(radiofolderoff_xpm), 1, true); + m_iconTable.AddInfo(_T("RadioGroup"), wxIcon(radiofolderoff_dis_xpm), 1, false); - m_iconTable.AddInfo("Radiobutton", wxIcon(radioon_xpm), 0, TRUE); - m_iconTable.AddInfo("Radiobutton", wxIcon(radioon_dis_xpm), 0, FALSE); - m_iconTable.AddInfo("Radiobutton", wxIcon(radiooff_xpm), 1, TRUE); - m_iconTable.AddInfo("Radiobutton", wxIcon(radiooff_dis_xpm), 1, FALSE); + m_iconTable.AddInfo(_T("Radiobutton"), wxIcon(radioon_xpm), 0, true); + m_iconTable.AddInfo(_T("Radiobutton"), wxIcon(radioon_dis_xpm), 0, false); + m_iconTable.AddInfo(_T("Radiobutton"), wxIcon(radiooff_xpm), 1, true); + m_iconTable.AddInfo(_T("Radiobutton"), wxIcon(radiooff_dis_xpm), 1, false); } ctConfigTreeCtrl::~ctConfigTreeCtrl() @@ -126,7 +120,7 @@ ctConfigTreeCtrl::~ctConfigTreeCtrl() delete m_contextMenu; } -void ctConfigTreeCtrl::OnSelChanged(wxTreeEvent& event) +void ctConfigTreeCtrl::OnSelChanged(wxTreeEvent& WXUNUSED(event)) { ctConfigToolDoc* doc = wxGetApp().GetMainFrame()->GetDocument(); if (doc) @@ -204,10 +198,11 @@ void ctConfigTreeCtrl::OnHelp(wxHelpEvent& event) wxPoint pt = ScreenToClient(event.GetPosition()); int flags = 0; wxTreeItemId id = HitTest(pt, flags); + ctTreeItemData *itemData = (ctTreeItemData*) GetItemData(id); wxHelpProvider *helpProvider = wxHelpProvider::Get(); - if ( helpProvider && id > 0) + if ( helpProvider && itemData) { - ctConfigItem* item = ((ctTreeItemData*) GetItemData(id))->GetConfigItem(); + ctConfigItem* item = itemData->GetConfigItem(); if (item) { wxString helpTopic = item->GetPropertyString(wxT("help-topic")); @@ -216,7 +211,7 @@ void ctConfigTreeCtrl::OnHelp(wxHelpEvent& event) wxGetApp().GetReferenceHelpController().DisplaySection(helpTopic); return; } - } + } } event.Skip();