00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _WG_TOOLBAR_H_
00026 #define _WG_TOOLBAR_H_
00027
00028 #include "wg_window.h"
00029 #include "wg_button.h"
00030 #include <vector>
00031
00032
00033 namespace wGui
00034 {
00035
00037
00039
00040 class CToolBar : public CWindow
00041 {
00042 public:
00046 CToolBar(const CRect& WindowRect, CWindow* pParent);
00047
00049 virtual ~CToolBar(void);
00050
00051
00058 void InsertButton(CButton* pButton, long int iButtonID = 0, unsigned int iPosition = 0);
00059
00065 void AppendButton(CButton* pButton, long int iButtonID = 0);
00066
00070 void RemoveButton(unsigned int iPosition);
00071
00073 void Clear(void);
00074
00077 unsigned int GetButtonCount(void) { return stdex::safe_static_cast<unsigned int>(m_vpButtons.size()); }
00078
00081 long int GetButtonID(unsigned int iPosition) { return m_vpButtons.at(iPosition).second; }
00082
00085 int GetButtonPosition(long int iButtonID);
00086
00087
00091 virtual void SetWindowRect(const CRect& WindowRect);
00092
00093
00094
00097 virtual bool HandleMessage(CMessage* pMessage);
00098
00099
00100 protected:
00101
00103 void RepositionButtons(void);
00104
00105 typedef std::pair<CButton*, long int> t_ButtonIDPair;
00106 typedef std::vector<t_ButtonIDPair> t_ButtonVector;
00107 t_ButtonVector m_vpButtons;
00108
00109
00110 private:
00111 void operator=(CToolBar) { }
00112 };
00113
00114 }
00115
00116
00117 #include "unit_tests/wg_toolbar_unittests.h"
00118
00119 #endif // _WG_TOOLBAR_H_
00120