src/widget/widget_types.h
branchcpp_gui
changeset 6290 8078f7a3c8a0
parent 6289 be3d8bd9fb02
child 6292 272c690043e3
equal deleted inserted replaced
6289:be3d8bd9fb02 6290:8078f7a3c8a0
    55 	/*virtual*/ void DrawBackground(EvtPaint &ev);
    55 	/*virtual*/ void DrawBackground(EvtPaint &ev);
    56 
    56 
    57 	/*virtual*/ void OnLeftButtonDown(EvtLeftButtonDown &ev);
    57 	/*virtual*/ void OnLeftButtonDown(EvtLeftButtonDown &ev);
    58 };
    58 };
    59 
    59 
       
    60 struct ImageButton : public Button {
       
    61 	typedef Button super;
       
    62 
       
    63 protected:
       
    64 	SpriteID m_sprite;
       
    65 	Point16  m_sprite_offset;
       
    66 
       
    67 public:
       
    68 	ImageButton()
       
    69 		: Button()
       
    70 		, m_sprite(0)
       
    71 	{}
       
    72 
       
    73 	ImageButton(CompositeWidget *container, WidgetId id, FeatureFlags feature_flags, byte color, const Rect16 &rect, StringID tooltips, SpriteID sprite, Point16 sprite_offset)
       
    74 		: Button(container, id, feature_flags, color, rect, tooltips)
       
    75 		, m_sprite(sprite)
       
    76 		, m_sprite_offset(sprite_offset)
       
    77 	{}
       
    78 
       
    79 	/*virtual*/ void OnPaint(EvtPaint &ev);
       
    80 };
       
    81 
       
    82 struct ImageButton2 : public ImageButton {
       
    83 	typedef ImageButton super;
       
    84 
       
    85 protected:
       
    86 	SpriteID m_sprite_pushed;
       
    87 	Point16  m_sprite_offset_pushed;
       
    88 
       
    89 public:
       
    90 	ImageButton2()
       
    91 		: ImageButton()
       
    92 		, m_sprite_pushed(0)
       
    93 	{}
       
    94 
       
    95 	ImageButton2(CompositeWidget *container, WidgetId id, FeatureFlags feature_flags, byte color, const Rect16 &rect, StringID tooltips, SpriteID sprite, Point16 sprite_offset, SpriteID sprite_pushed, Point16 sprite_offset_pushed)
       
    96 		: ImageButton(container, id, feature_flags, color, rect, tooltips, sprite, sprite_offset)
       
    97 		, m_sprite_pushed(sprite_pushed)
       
    98 		, m_sprite_offset_pushed(sprite_offset_pushed)
       
    99 	{}
       
   100 
       
   101 	/*virtual*/ void OnPaint(EvtPaint &ev);
       
   102 };
       
   103 
    60 struct TextButton : public Button {
   104 struct TextButton : public Button {
    61 	typedef Button super;
   105 	typedef Button super;
    62 
   106 
    63 protected:
   107 protected:
    64 	StringID m_text;
   108 	StringID m_text;
    94 	/*virtual*/ void OnCreate(EvtCreate &ev);
   138 	/*virtual*/ void OnCreate(EvtCreate &ev);
    95 	/*virtual*/ void OnPaint(EvtPaint &ev);
   139 	/*virtual*/ void OnPaint(EvtPaint &ev);
    96 	/*virtual*/ void OnLeftClick(EvtLeftClick &ev);
   140 	/*virtual*/ void OnLeftClick(EvtLeftClick &ev);
    97 };
   141 };
    98 
   142 
    99 struct StickyBox : public Button {
   143 struct StickyBox : public ImageButton2 {
   100 	typedef Button super;
   144 	typedef ImageButton2 super;
   101 
   145 
   102 	static const int16 DEFAULT_WIDTH  = 12;
   146 	static const int16 DEFAULT_WIDTH  = 12;
   103 	static const int16 DEFAULT_HEIGHT = 14;
   147 	static const int16 DEFAULT_HEIGHT = 14;
   104 
   148 
   105 public:
   149 public:
   106 	StickyBox()
   150 	StickyBox()
   107 		: Button()
   151 		: ImageButton2()
   108 	{}
   152 	{}
   109 
   153 
   110 	StickyBox(CompositeWidget *container)
   154 	StickyBox(CompositeWidget *container)
   111 		: Button(container, -103, FF_TOGGLE_BUTTON, container->m_color, Rect16(), STR_STICKY_BUTTON)
   155 		: ImageButton2(container, -103, FF_TOGGLE_BUTTON, container->m_color, Rect16(), STR_STICKY_BUTTON, SPR_PIN_DOWN, Point(0, 1), SPR_PIN_UP, Point(0, 1))
   112 	{}
   156 	{}
   113 
   157 
   114 	/*virtual*/ void OnCreate(EvtCreate &ev);
   158 	/*virtual*/ void OnCreate(EvtCreate &ev);
   115 	/*virtual*/ void OnPaint(EvtPaint &ev);
   159 //	/*virtual*/ void OnPaint(EvtPaint &ev);
   116 	/*virtual*/ void OnLeftClick(EvtLeftClick &ev);
   160 	/*virtual*/ void OnLeftClick(EvtLeftClick &ev);
   117 };
   161 };
   118 
   162 
   119 struct Caption : public Widget {
   163 struct Caption : public Widget {
   120 	typedef Widget super;
   164 	typedef Widget super;