/* GWEN Copyright (c) 2010 Facepunch Studios See license in Gwen.h */ #pragma once #ifndef GWEN_CONTROLS_COMBOBOX_H #define GWEN_CONTROLS_COMBOBOX_H #include "gwen_base.h" #include "gwen_button.h" #include "../gwen.h" #include "../gwen_skin.h" #include "gwen_textbox.h" #include "gwen_menu.h" namespace Gwen { namespace Controls { class GWEN_EXPORT ComboBox : public Button { public: GWEN_CONTROL( ComboBox, Button ); virtual void Render( Skin::Base* skin ); virtual void Layout( Skin::Base* skin ); virtual void UpdateColours(); virtual void SelectItemByName( const Gwen::String& name, bool bFireChangeEvents = true ); virtual Gwen::Controls::Label* GetSelectedItem(); virtual void OnPress(); virtual void OnItemSelected( Controls::Base* pControl ); virtual void OpenList(); virtual void CloseList(); virtual void ClearItems(); virtual MenuItem* AddItem( const String& strLabel, const String& strName = "" ); virtual bool OnKeyUp( bool bDown ); virtual bool OnKeyDown( bool bDown ); virtual void RenderFocus( Gwen::Skin::Base* skin ); virtual void OnLostKeyboardFocus(); virtual void OnKeyboardFocus(); virtual bool IsMenuOpen(); virtual bool IsMenuComponent(){ return true; } Gwen::Event::Caller onSelection; protected: void SelectItem( MenuItem* pItem ); Menu* m_Menu; MenuItem* m_SelectedItem; Controls::Base* m_Button; }; } } #endif