X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e776786754b4a54f90873b0f1801ba50f79c2d90..b271d60d6a009930d80092a8cb534a5df19fc99b:/utils/configtool/src/utils.h diff --git a/utils/configtool/src/utils.h b/utils/configtool/src/utils.h index 87fd293836..8b1dffa869 100644 --- a/utils/configtool/src/utils.h +++ b/utils/configtool/src/utils.h @@ -14,13 +14,11 @@ * \brief A file of utility functions and classes. */ -#ifdef __GNUG__ -// #pragma interface -#endif - #ifndef _AP_UTILS_H_ #define _AP_UTILS_H_ +#include "wx/imaglist.h" + #ifndef DOXYGEN_SKIP /*! @@ -72,9 +70,6 @@ wxFont apStringToFont(const wxString& str); /// Get the index of the given named wxNotebook page int apFindNotebookPage(wxNotebook* notebook, const wxString& name); -/// View the given URL -void apViewHTMLFile(const wxString& url); - /// Returns the system temporary directory. wxString wxGetTempDir(); @@ -113,15 +108,15 @@ and has a convenient API. For example, the following adds icons for a checkbox item that can be: on/enabled, off/enabled, on/disabled,off/disabled. - m_iconTable.AddInfo("Checkbox", wxICON(checked), 0, TRUE); - m_iconTable.AddInfo("Checkbox", wxICON(checked_dis), 0, FALSE); - m_iconTable.AddInfo("Checkbox", wxICON(unchecked), 1, TRUE); - m_iconTable.AddInfo("Checkbox", wxICON(unchecked_dis), 1, FALSE); + m_iconTable.AddInfo("Checkbox", wxICON(checked), 0, true); + m_iconTable.AddInfo("Checkbox", wxICON(checked_dis), 0, false); + m_iconTable.AddInfo("Checkbox", wxICON(unchecked), 1, true); + m_iconTable.AddInfo("Checkbox", wxICON(unchecked_dis), 1, false); When you update the item image in response to (e.g.) user interaction, you can say something like this: - int iconId = m_iconTable.GetIconId("Checkbox", 0, FALSE); + int iconId = m_iconTable.GetIconId("Checkbox", 0, false); treeCtrl.SetItemImage(itemId, iconId, wxTreeItemIcon_Normal); treeCtrl.SetItemImage(itemId, iconId, wxTreeItemIcon_Selected); @@ -137,19 +132,19 @@ class wxIconInfo: public wxObject { public: wxIconInfo(const wxString& name); - + // How many states? (Each state // has enabled/disabled state) // Max (say) 4 states, each with // enabled/disabled int GetStateCount() const { return m_maxStates; }; - void SetStateCount(int count) { m_maxStates; } - int GetIconId(int state, bool enabled = TRUE) const; + void SetStateCount(int count) { m_maxStates = count; } + int GetIconId(int state, bool enabled = true) const; void SetIconId(int state, bool enabled, int iconId); const wxString& GetName() const { return m_name; } - + protected: int m_maxStates; int m_states[wxMAX_ICON_STATES * 2]; // Enabled/disabled @@ -165,9 +160,9 @@ class wxIconTable: public wxList { public: wxIconTable(wxImageList* imageList = NULL); - + void AppendInfo(wxIconInfo* info); - + // Easy way of initialising both the image list and the // info db. It will generate image ids itself while appending the icon. // 'state' is an integer from 0 up to the max allowed, representing a different @@ -175,17 +170,17 @@ public: // A folder that can be open or closed would have two states. // Enabled/disabled is taken as a special case. bool AddInfo(const wxString& name, const wxIcon& icon, int state, bool enabled); - + wxIconInfo* FindInfo(const wxString& name) const; - - int GetIconId(const wxString& name, int state, bool enabled = TRUE) const; + + int GetIconId(const wxString& name, int state, bool enabled = true) const; bool SetIconId(const wxString& name, int state, bool enabled, int iconId) ; - + void SetImageList(wxImageList* imageList) { m_imageList = imageList; } wxImageList* GetImageList() const { return m_imageList; } - + protected: - wxImageList* m_imageList; + wxImageList* m_imageList; }; /// Useful insertion operators for wxOutputStream.