Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 244 | chris | 1 | #ifndef __LISTWIDGET_H__ |
| 2 | #define __LISTWIDGET_H__ |
||
| 3 | |||
| 4 | #include "ScrollListener.h" |
||
| 5 | #include "Widget.h" |
||
| 6 | |||
| 7 | namespace Sexy |
||
| 8 | { |
||
| 9 | |||
| 10 | typedef std::vector<SexyString> SexyStringVector; |
||
| 11 | typedef std::vector<Color> ColorVector; |
||
| 12 | |||
| 13 | class ScrollbarWidget; |
||
| 14 | class ListListener; |
||
| 15 | class Font; |
||
| 16 | |||
| 17 | class ListWidget : public Widget, public ScrollListener |
||
| 18 | { |
||
| 19 | public: |
||
| 20 | enum |
||
| 21 | { |
||
| 22 | JUSTIFY_LEFT =0, |
||
| 23 | JUSTIFY_CENTER, |
||
| 24 | JUSTIFY_RIGHT |
||
| 25 | }; |
||
| 26 | |||
| 27 | enum |
||
| 28 | { |
||
| 29 | COLOR_BKG =0, |
||
| 30 | COLOR_OUTLINE, |
||
| 31 | COLOR_TEXT, |
||
| 32 | COLOR_HILITE, |
||
| 33 | COLOR_SELECT, |
||
| 34 | COLOR_SELECT_TEXT, |
||
| 35 | }; |
||
| 36 | |||
| 37 | public: |
||
| 38 | int mId; |
||
| 39 | Font* mFont; |
||
| 40 | ScrollbarWidget* mScrollbar; |
||
| 41 | int mJustify; |
||
| 42 | |||
| 43 | SexyStringVector mLines; |
||
| 44 | ColorVector mLineColors; |
||
| 45 | double mPosition; |
||
| 46 | double mPageSize; |
||
| 47 | int mHiliteIdx; |
||
| 48 | int mSelectIdx; |
||
| 49 | ListListener* mListListener; |
||
| 50 | ListWidget* mParent; |
||
| 51 | ListWidget* mChild; |
||
| 52 | bool mSortFromChild; |
||
| 53 | bool mDrawOutline; |
||
| 54 | int mMaxNumericPlaces; |
||
| 55 | int mItemHeight; |
||
| 56 | |||
| 57 | bool mDrawSelectWhenHilited; |
||
| 58 | bool mDoFingerWhenHilited; |
||
| 59 | |||
| 60 | void SetHilite(int theHiliteIdx, bool notifyListener = false); |
||
| 61 | |||
| 62 | public: |
||
| 63 | ListWidget(int theId, Font *theFont, ListListener *theListListener); |
||
| 64 | virtual ~ListWidget(); |
||
| 65 | |||
| 66 | virtual void RemovedFromManager(WidgetManager *theManager); |
||
| 67 | |||
| 68 | virtual SexyString GetSortKey(int theIdx); |
||
| 69 | virtual void Sort(bool ascending); |
||
| 70 | virtual SexyString GetStringAt(int theIdx); |
||
| 71 | virtual void Resize(int theX, int theY, int theWidth, int theHeight); |
||
| 72 | virtual int AddLine(const SexyString& theLine, bool alphabetical); |
||
| 73 | virtual void SetLine(int theIdx, const SexyString& theString); |
||
| 74 | virtual int GetLineCount(); |
||
| 75 | virtual int GetLineIdx(const SexyString& theLine); |
||
| 76 | virtual void SetColor(const SexyString& theLine, const Color& theColor); |
||
| 77 | virtual void SetColor(int theIdx, const Color& theColor); |
||
| 78 | virtual void SetLineColor(int theIdx, const Color& theColor); |
||
| 79 | virtual void RemoveLine(int theIdx); |
||
| 80 | virtual void RemoveAll(); |
||
| 81 | virtual int GetOptimalWidth(); |
||
| 82 | virtual int GetOptimalHeight(); |
||
| 83 | virtual void OrderInManagerChanged(); |
||
| 84 | virtual void Draw(Graphics *g); |
||
| 85 | virtual void ScrollPosition(int theId, double thePosition); |
||
| 86 | virtual void MouseMove(int x, int y); |
||
| 87 | virtual void MouseWheel(int theDelta); |
||
| 88 | virtual void MouseDown(int x, int y, int theClickCount) { Widget::MouseDown(x, y, theClickCount); } |
||
| 89 | virtual void MouseDown(int x, int y, int theBtnNum, int theClickCount); |
||
| 90 | virtual void MouseLeave(); |
||
| 91 | virtual void SetSelect(int theSelectIdx); |
||
| 92 | }; |
||
| 93 | |||
| 94 | } |
||
| 95 | |||
| 96 | #endif // __LISTWIDGET_H__ |