logo
Main Page | Namespaces | Classes | Compounds | Files | Compound Members | Related

ListBox.h

00001 //
00002 //  SYNTOPIA. See http://Syntopia.sourceforge.net for details and documentation.        
00003 //
00004 //      Author of this file: Mikael Hvidtfeldt Christensen (mikaelc@users.sourceforge.net)
00005 //
00006 
00007 
00008 #ifndef __ListBox
00009 #define __ListBox
00010 
00011 #include "WinForm.h"
00012 #include "GUIControl.h"
00013 #include "Component.h"
00014 
00015 namespace GUIToolkit {
00016 
00018 class ComboBoxItem {
00019 public:
00021         friend class ComboBox;
00022 
00024         ComboBoxItem(std::string s) { Label = s;  };
00025 
00027         ~ComboBoxItem() {};
00028 
00030         std::string Label;
00031 
00032 private:
00033 
00035         int ID;
00036 };
00037 
00038 typedef std::map<ComboBoxItem *, int> ComboBoxMap ;
00039 typedef std::map<ComboBoxItem *, int>::const_iterator ComboBoxMapIter ;
00040 
00042 /* 
00043  *  @todo place in right file
00044  */
00045 class ComboBox : public Component {
00046 public:
00048         ComboBox(); 
00049 
00051         ~ComboBox();
00052 
00054         void PutInWinForm(WinForm * WF, int x0, int y0, int sizex, int sizey); 
00055 
00057         void add(ComboBoxItem * item);
00058 
00060         void setSelected(ComboBoxItem * item);
00061 
00063         void setSelected(int index);
00064 
00066         void show();
00067 
00069         void hide();
00070 
00072         ComboBoxItem * getSelected();
00073 
00074         private:
00075         ComboBoxMap myItems;
00076         HFONT hfDefault;
00077     HWND hEdit;
00078         int ItemCounter;
00079 };
00080 
00082 /*
00083  *  @todo Place in new file.
00084  */ 
00085 class ScrollBar : public Component {
00086 
00087         public:
00088 
00091         ScrollBar(float min, float max, int steps); 
00092 
00094         ~ScrollBar();
00095 
00097         void PutInWinForm(WinForm * WF, int x0, int y0, int sizex, int sizey); 
00098 
00102         void HandleEvents(event e);
00103 
00105         HWND getHWND() {return hEdit;}
00106 
00108         void show() ;
00109 
00111         void hide() ;
00112 
00114         void set(float p) ;
00115 
00117         void setInt(int p) ;
00118         
00120         float get() ;
00121 
00122         private:
00123         HFONT hfDefault;
00124     HWND hEdit;
00125         float myMax, myPos, myMin;
00126         int mySteps;
00127 };
00128 
00129 };
00130 
00131 #endif

Syntopia Project. Visit the web page, or the SourceForge page.
Docs made by Doxygen. Email: Mikael Christensen