00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef CONTAINER_GUI_H
00019 #define CONTAINER_GUI_H
00020
00021 #include <iostream>
00022 #include <string>
00023 #include "constants.h"
00024 #include "scourge.h"
00025 #include "item.h"
00026 #include "gui/window.h"
00027 #include "gui/widget.h"
00028 #include "gui/button.h"
00029 #include "gui/scrollinglist.h"
00030 #include "gui/draganddrop.h"
00031
00032 class ContainerGui : public DragAndDropHandler {
00033
00034 private:
00035 Scourge *scourge;
00036 Item *container;
00037 Window *win;
00038 Button *openButton, *infoButton, *closeButton;
00039 ScrollingList *list;
00040 Label *label;
00041 char **containedItemNames;
00042 Color *itemColor;
00043 GLuint *itemIcon;
00044
00045 public:
00046 ContainerGui(Scourge *scourge, Item *container, int x, int y);
00047 ~ContainerGui();
00048
00049 bool handleEvent(SDL_Event *event);
00050 bool handleEvent(Widget *widget, SDL_Event *event);
00051
00052 inline Item *getContainer() { return container; }
00053 inline Window *getWindow() { return win; }
00054 inline void refresh() { showContents(); }
00055
00056
00057 void receive(Widget *widget);
00058 bool startDrag(Widget *widget, int x=0, int y=0);
00059
00060 private:
00061 void showContents();
00062 void dropItem();
00063
00064 };
00065
00066 #endif