wg_dropdown.h

00001 // wg_dropdown.h
00002 //
00003 // CDropDown 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_DROPDOWN_H_
00026 #define _WG_DROPDOWN_H_
00027 
00028 #include "wg_window.h"
00029 #include "wg_painter.h"
00030 #include "wg_editbox.h"
00031 #include "wg_listbox.h"
00032 #include <memory>
00033 
00034 
00035 namespace wGui
00036 {
00037 
00039 
00041 
00042 class CDropDown : public CWindow
00043 {
00044 public:
00052      CDropDown(const CRect& WindowRect, CWindow* pParent, bool bAllowEdit = true, unsigned int iItemHeight = 15, CFontEngine* pFontEngine = 0);
00053 
00055      virtual ~CDropDown(void);
00056 
00060      int AddItem(SListItem ListItem) { return m_pListBox->AddItem(ListItem); }
00061 
00065      SListItem& GetItem(int iItemIndex) { return m_pListBox->GetItem(iItemIndex); }
00066 
00069      void RemoveItem(int iItemIndex) { m_pListBox->RemoveItem(iItemIndex); }
00070 
00072      void ClearItems(void) { m_pListBox->ClearItems(); }
00073 
00076      int Size(void) { return m_pListBox->Size(); }
00077 
00080      bool IsSelected(int iItemIndex) { return m_pListBox->IsSelected(iItemIndex); }
00081 
00084      int GetFirstSelectedIndex(void) const { return m_pListBox->GetFirstSelectedIndex(); }
00085 
00089      void SetSelection(int iItemIndex, bool bSelected) { m_pListBox->SetSelection(iItemIndex, bSelected); }
00090 
00093      void SetAllSelections(bool bSelected) { m_pListBox->SetAllSelections(bSelected); }
00094 
00097      void SetListboxHeight(int iItemCount);
00098 
00099 
00100      // CWindow overrides
00103      virtual void SetWindowRect(const CRect& WindowRect);
00104 
00107      virtual void SetWindowText(std::wstring sWindowText);
00108 
00110      virtual std::wstring GetWindowText();
00111 
00114      virtual void MoveWindow(const CPoint& MoveDistance);
00115 
00118      virtual void SetVisible(bool bVisible);
00119 
00120 
00121      // CMessageClient overrides
00124      virtual bool HandleMessage(CMessage* pMessage);
00125 
00126 
00127 protected:
00129      void ShowListBox(void);
00130 
00132      void HideListBox(void);
00133 
00134 
00135      CEditBox* m_pEditBox;  
00136      CListBox* m_pListBox;  
00137      CPictureButton* m_pDropButton;  
00138      bool m_bAllowEdit;  
00139 
00140 
00141 private:
00142      void operator=(CDropDown) { }  
00143 };
00144 
00145 }
00146 
00147 
00148 #include "unit_tests/wg_dropdown_unittests.h"
00149 
00150 #endif // _WG_DROPDOWN_H_
00151 
00152 
00153 
00154 

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