~baltix/+junk/irrlicht-test

« back to all changes in this revision

Viewing changes to source/Irrlicht/CGUIComboBox.h

  • Committer: Mantas Kriaučiūnas
  • Date: 2011-07-18 13:06:25 UTC
  • Revision ID: mantas@akl.lt-20110718130625-c5pvifp61e7kj1ol
Included whole irrlicht SVN libraries to work around launchpad recipe issue with quilt, see https://answers.launchpad.net/launchpad/+question/165193

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (C) 2002-2011 Nikolaus Gebhardt
 
2
// This file is part of the "Irrlicht Engine".
 
3
// For conditions of distribution and use, see copyright notice in irrlicht.h
 
4
 
 
5
#ifndef __C_GUI_COMBO_BOX_H_INCLUDED__
 
6
#define __C_GUI_COMBO_BOX_H_INCLUDED__
 
7
 
 
8
#include "IrrCompileConfig.h"
 
9
#ifdef _IRR_COMPILE_WITH_GUI_
 
10
 
 
11
#include "IGUIComboBox.h"
 
12
#include "IGUIStaticText.h"
 
13
#include "irrString.h"
 
14
#include "irrArray.h"
 
15
 
 
16
namespace irr
 
17
{
 
18
namespace gui
 
19
{
 
20
        class IGUIButton;
 
21
        class IGUIListBox;
 
22
 
 
23
        //! Single line edit box for editing simple text.
 
24
        class CGUIComboBox : public IGUIComboBox
 
25
        {
 
26
        public:
 
27
 
 
28
                //! constructor
 
29
                CGUIComboBox(IGUIEnvironment* environment, IGUIElement* parent,
 
30
                        s32 id, core::rect<s32> rectangle);
 
31
 
 
32
                //! Returns amount of items in box
 
33
                virtual u32 getItemCount() const;
 
34
 
 
35
                //! returns string of an item. the idx may be a value from 0 to itemCount-1
 
36
                virtual const wchar_t* getItem(u32 idx) const;
 
37
 
 
38
                //! Returns item data of an item. the idx may be a value from 0 to itemCount-1
 
39
                virtual u32 getItemData(u32 idx) const;
 
40
 
 
41
                //! Returns index based on item data
 
42
                virtual s32 getIndexForItemData( u32 data ) const;
 
43
 
 
44
                //! adds an item and returns the index of it
 
45
                virtual u32 addItem(const wchar_t* text, u32 data);
 
46
 
 
47
                //! Removes an item from the combo box.
 
48
                virtual void removeItem(u32 id);
 
49
 
 
50
                //! deletes all items in the combo box
 
51
                virtual void clear();
 
52
 
 
53
                //! returns the text of the currently selected item
 
54
                virtual const wchar_t* getText() const;
 
55
 
 
56
                //! returns id of selected item. returns -1 if no item is selected.
 
57
                virtual s32 getSelected() const;
 
58
 
 
59
                //! sets the selected item. Set this to -1 if no item should be selected
 
60
                virtual void setSelected(s32 idx);
 
61
 
 
62
                //! sets the text alignment of the text part
 
63
                virtual void setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical);
 
64
 
 
65
                //! called if an event happened.
 
66
                virtual bool OnEvent(const SEvent& event);
 
67
 
 
68
                //! draws the element and its children
 
69
                virtual void draw();
 
70
 
 
71
                //! Writes attributes of the element.
 
72
                virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const;
 
73
 
 
74
                //! Reads attributes of the element
 
75
                virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options);
 
76
 
 
77
        private:
 
78
 
 
79
                void openCloseMenu();
 
80
                void sendSelectionChangedEvent();
 
81
 
 
82
                IGUIButton* ListButton;
 
83
                IGUIStaticText* SelectedText;
 
84
                IGUIListBox* ListBox;
 
85
                IGUIElement *LastFocus;
 
86
 
 
87
 
 
88
                struct SComboData
 
89
                {
 
90
                        SComboData ( const wchar_t * text, u32 data )
 
91
                                : Name (text), Data ( data ) {}
 
92
 
 
93
                        core::stringw Name;
 
94
                        u32 Data;
 
95
                };
 
96
                core::array< SComboData > Items;
 
97
 
 
98
                s32 Selected;
 
99
                EGUI_ALIGNMENT HAlign, VAlign;
 
100
                bool HasFocus;
 
101
        };
 
102
 
 
103
 
 
104
} // end namespace gui
 
105
} // end namespace irr
 
106
 
 
107
#endif // _IRR_COMPILE_WITH_GUI_
 
108
 
 
109
#endif // __C_GUI_COMBO_BOX_H_INCLUDED__
 
110