2
* This file is part of wxSmith plugin for Code::Blocks Studio
3
* Copyright (C) 2006-2007 Bartlomiej Swiecki
5
* wxSmith is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 3 of the License, or
8
* (at your option) any later version.
10
* wxSmith is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with wxSmith. If not, see <http://www.gnu.org/licenses/>.
19
* $Id: wxsresourcetree.h 8251 2012-08-28 02:31:00Z ollydbg $
20
* $HeadURL: svn://svn.code.sf.net/p/codeblocks/code/trunk/src/plugins/contrib/wxSmith/wxsresourcetree.h $
23
#ifndef WXSRESOURCETREE_H
24
#define WXSRESOURCETREE_H
26
#include <wx/treectrl.h>
27
#include "wxsresourcetreeitemdata.h"
29
#if defined(__WXMSW__) && defined(LoadImage)
30
// Fix Windows winuser.h Header define of LoadImage.
38
/** \brief Definition of resource tree identifier. Separate name of type could be useful in future */
39
typedef wxTreeItemId wxsResourceItemId;
41
// TODO: Rewrite this class with custom widget
43
/** \brief Resource tree class */
44
class wxsResourceTree: public wxTreeCtrl
49
wxsResourceTree(wxWindow* Parent);
52
virtual ~wxsResourceTree();
54
/** \brief Function building new tree item for project
56
* This item takes name of associated cbProject and initializes
57
* item data to point to project.
59
wxsResourceItemId NewProjectItem(const wxString& ProjectTitle,wxsProject* Project);
61
/** \brief Function returning item id for external resources */
62
wxsResourceItemId ExternalResourcesId();
64
/** \brief Function deleting identifier for external resources */
65
void DeleteExternalResourcesId();
67
/** \brief Getting singleton instance */
68
static inline wxsResourceTree* Get() { return m_Singleton; }
70
/** \brief Getting global image list
72
* This list is declared as static, so it can be used even
73
* before wxsResourceTree is created
75
static wxImageList& GetGlobalImageList();
77
/** \brief Loading image to list
78
* \param FileName name relative to codeblock's data path
79
* \return Index in list
81
static int LoadImage(const wxString& FileName);
83
/** \brief Adding bitmap into global list
84
* \param Bitmap bitmap to be added
85
* \return Index in list
87
static int InsertImage(const wxBitmap& Bitmap);
89
/** \brief Freeing image at given index
91
* This function marks image at given index as freed, so
92
* it may be replaced by LoadImage in future without
93
* unnecessarily increasing size of list
95
static void FreeImage(int Index);
97
/** \brief Blocking processing select events
98
* \note This function must be paired with UnblockSelect
102
/** \brief Unblocking select events
103
* \note This function must be paired with BlockSelect
105
void UnblockSelect();
109
wxsResourceItemId m_ExtId; ///< \brief id of tree item containing external resources
110
bool m_IsExt; ///< \brief True if there is item for external resources
111
int m_BlockCount; ///< \brief if > 0 must block all select events
112
wxsResourceTreeItemData* m_Data; ///< \brief Pointer to item data object used in last action
113
static wxsResourceTree* m_Singleton; ///< \brief singleton object
115
static int m_RootImageId;
116
static int m_ProjectImageId;
117
static int m_ExternalImageId;
119
static wxArrayInt& GetFreedList();
121
void PopupMenu(wxMenu* Menu,wxsResourceTreeItemData* ItemData);
122
void InvalidateItemData(wxsResourceTreeItemData* ItemData);
124
void OnSelect(wxTreeEvent& event);
125
void OnRightClick(wxTreeEvent& event);
126
void OnPopupMenu(wxCommandEvent& event);
128
friend void wxsResourceTreeItemData::PopupMenu(wxMenu* Menu);
129
friend wxsResourceTreeItemData::~wxsResourceTreeItemData();
131
DECLARE_EVENT_TABLE()
134
/** \brief Helper function for getting resource tree singleton object */
135
inline wxsResourceTree* wxsTree() { return wxsResourceTree::Get(); }