]> Shamusworld >> Repos - virtualjaguar/blob - src/gui/listbox.h
Creating Qt/Experimental branch of trunk.
[virtualjaguar] / src / gui / listbox.h
1 //
2 // ListBox class
3 //
4 // by James L. Hammons
5 //
6
7 #ifndef __LISTBOX_H__
8 #define __LISTBOX_H__
9
10 #include <string>
11 #include <vector>
12 #include "button.h"
13 //#include "element.h"
14
15 class ListBox: public Element
16 //class ListBox: public Window
17 {
18         public:
19 //              ListBox(uint32 x = 0, uint32 y = 0, uint32 w = 0, uint32 h = 0): Element(x, y, w, h),
20                 ListBox(uint32 x = 0, uint32 y = 0, uint32 w = 0, uint32 h = 0);//: Window(x, y, w, h),
21 //              windowPtr(0), cursor(0), limit(0), charWidth((w / 8) - 1), charHeight(h / 8),
22 //              elementToTell(NULL), upArrow(w - 8, 0, upArrowBox),
23 //              downArrow(w - 8, h - 8, downArrowBox), upArrow2(w - 8, h - 16, upArrowBox) {}
24                 virtual void HandleKey(SDLKey key);
25                 virtual void HandleMouseMove(uint32 x, uint32 y);
26                 virtual void HandleMouseButton(uint32 x, uint32 y, bool mouseDown);
27                 virtual void Draw(uint32 offsetX = 0, uint32 offsetY = 0);
28                 virtual void Notify(Element * e);
29                 void SetNotificationElement(Element * e);
30                 void AddItem(std::string s);
31                 std::string GetSelectedItem(void);
32
33         protected:
34                 bool thumbClicked;
35                 uint32 windowPtr, cursor, limit;
36                 uint32 charWidth, charHeight;                           // Box width/height in characters
37                 Element * elementToTell;
38                 Button upArrow, downArrow, upArrow2;
39                 std::vector<std::string> item;
40
41         private:
42                 uint32 yRelativePoint;
43 };
44
45 #endif  // __LISTBOX_H__