1 #ifndef __lib_listbox_h
2 #define __lib_listbox_h
4 #include <lib/gui/ewidget.h>
5 #include <connection.h>
7 class iListboxContent: public iObject
10 virtual ~iListboxContent()=0;
12 /* indices go from 0 to size().
13 the end is reached when the cursor is on size(),
14 i.e. one after the last entry (this mimics
17 cursors never invalidate - they can become invalid
18 when stuff is removed. Cursors will always try
19 to stay on the same data, however when the current
20 item is removed, this won't work. you'll be notified
23 virtual void cursorHome()=0;
24 virtual void cursorEnd()=0;
25 virtual int cursorMove(int count=1)=0;
26 virtual int cursorValid()=0;
27 virtual int cursorSet(int n)=0;
28 virtual int cursorGet()=0;
30 virtual void cursorSave()=0;
31 virtual void cursorRestore()=0;
35 virtual RESULT connectItemChanged(const Slot0<void> &itemChanged, ePtr<eConnection> &connection)=0;
37 // void setOutputDevice ? (for allocating colors, ...) .. requires some work, though
38 virtual void setSize(const eSize &size)=0;
40 /* the following functions always refer to the selected item */
41 virtual void paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected)=0;
44 class eListbox: public eWidget
47 eListbox(eWidget *parent);
48 void setContent(iListboxContent *content);
50 void moveSelection(int how);
58 int event(int event, void *data=0, void *data2=0);
61 int m_top, m_selected;
64 ePtr<iListboxContent> m_content;