00001
00002
00003
00004
00006
00007 #ifndef KYRA_IMAGESCROLLBOX_INCLUDED
00008 #define KYRA_IMAGESCROLLBOX_INCLUDED
00009
00010
00011 #include "../gui/widget.h"
00012
00013 class KrTextWidget;
00014
00015
00030 class KrImageListBox : public KrWidget
00031 {
00032 public:
00033 KrImageListBox(int width, int height, int imageheight, const KrScheme& scheme);
00034 virtual ~KrImageListBox();
00035
00036 virtual const char* WidgetType() { return "ImageListBox"; }
00037
00038 KrImage* QuerySelectedItem();
00039 std::string& QuerySelectedItemText();
00040
00041 void AddedtoTree();
00042 int AddImage( KrImage* _image, std::string text );
00043 int NumItems() { return objectImages.size(); }
00045 int QuerySelectedItemNum() { return selectedItem; }
00046
00047 void MoveSelection( int delta );
00048 virtual int IsMouseListener() { return LEFT_MOUSE; }
00049 virtual bool MouseClick( int down, int x, int y );
00050 virtual void MouseMove( bool down, int x, int y );
00051 virtual void MouseIn( bool down, bool in );
00052
00053 private:
00054
00055 void DrawImage();
00056 void CalcImagePosition(KrImage* image);
00057
00058 int width, height;
00059 int imageHeight;
00060 int fontHeight;
00061
00062 KrBevelElement *outerBevel;
00063
00064 typedef struct{
00065 KrImage* image;
00066 KrImage* clone;
00067 KrTextWidget* textWidget;
00068 std::string imageText;
00069 }ImageItem;
00070
00071 void CalcTextPosition(ImageItem& item);
00072 std::vector< ImageItem > objectImages;
00073 std::vector< KrBox* > objectViewImages;
00074
00075 int firstItem;
00076 int selectedItem;
00077 int viewSelection;
00078 int currHiLight;
00079
00080 unsigned numVisibleItems;
00081 std::string emptyString;
00082 };
00083
00084 #endif