wg_toolbar.h

00001 // wg_toolbar.h
00002 //
00003 // CToolBar class interface
00004 //
00005 //
00006 // Copyright (c) 2002-2004 Rob Wiskow
00007 // rob-dev@boxedchaos.com
00008 //
00009 // This library is free software; you can redistribute it and/or
00010 // modify it under the terms of the GNU Lesser General Public
00011 // License as published by the Free Software Foundation; either
00012 // version 2.1 of the License, or (at your option) any later version.
00013 //
00014 // This library is distributed in the hope that it will be useful,
00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00017 // Lesser General Public License for more details.
00018 //
00019 // You should have received a copy of the GNU Lesser General Public
00020 // License along with this library; if not, write to the Free Software
00021 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
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      // CMessageClient overrides
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 

Generated on Wed May 16 23:11:26 2007 for wGui by  doxygen 1.5.1