comboBoxComponent.h
Go to the documentation of this file.00001 #ifndef COMBO_BOX_COMPONENT_H
00002 #define COMBO_BOX_COMPONENT_H
00003
00013 #include "ttfDraw.h"
00014 #include "menuComponent.h"
00015 #include "drawSurface.h"
00016 #include "fillSurface.h"
00017 #include "multiSurface.h"
00018
00019
00023 class ComboBoxComponent : public FocusComponentInterface {
00024 enum { DefaultFontSize = 24 };
00025 TTF_Draw& ttf;
00026 unsigned long fore_color;
00027 unsigned long back_color;
00028 unsigned long focused_fore_color;
00029 unsigned long focused_back_color;
00030
00031 MenuComponent* menu;
00032 ButtonComponent* selected_item;
00033 MultiSurface* selected_surface;
00034 LabelComponent* button_label;
00035 DrawSurface* button_surface;
00036 VXV::Grid button_offset;
00037 FillSurface* fill_normal;
00038 FillSurface* fill_focused;
00039 std::vector<DrawSurface*> surface_normal;
00040 std::vector<DrawSurface*> surface_focused;
00041 std::vector<MultiSurface*> items_normal;
00042 std::vector<MultiSurface*> items_focused;
00043 std::vector<ButtonComponent*> items;
00044 std::vector<const Uint16*> add_text;
00045 std::vector<Uint16*> char_text;
00046 unsigned int now_index;
00047 bool view_list;
00048 int font_size;
00049 bool focused;
00050 bool decided;
00051
00052 void deleteObject(void);
00053
00054 public:
00060 ComboBoxComponent(TTF_Draw& ttf_resource);
00061 ~ComboBoxComponent(void);
00062 bool draw(unsigned long ticks, const UserInput& ui);
00068 void add(const Uint16* text);
00069
00070 void add(const char* text);
00071
00072 void setColor(unsigned long fore, unsigned long back,
00073 unsigned long focused_fore, unsigned long focused_back);
00074
00080 void setFontSize(int size);
00081
00082
00083
00084
00085
00089 void updateSelected(void);
00090
00096 void activate(bool on);
00097
00103 void setNowIndex(int index);
00104
00105 bool isDecided(void);
00106
00112 unsigned int getNowIndex(void);
00113
00114 void beginFocus(void);
00115 void endFocus(void) ;
00116 };
00117
00118 #endif
00119