00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
#ifndef UCOMBOBOX_HPP
00029
#define UCOMBOBOX_HPP
00030
00031
#include "uwidget.hpp"
00032
00033
namespace ufo {
00034
00035
class UItem;
00036
class UIcon;
00037
class UColor;
00038
00039
class UListBox;
00040
class UTextEdit;
00041
00052 class UFO_EXPORT UComboBox :
public UWidget {
00053 UFO_DECLARE_DYNAMIC_CLASS(UComboBox)
00054 UFO_UI_CLASS(UComboBoxUI)
00055 UFO_STYLE_TYPE(UStyle::CE_ComboBox)
00056
public:
00057 UComboBox();
00058 UComboBox(
const std::vector<UString> & listDataA);
00059
public:
00064
void addList(
const std::vector<UString> & listData);
00067
void addItem(
UItem * itemA,
int index = -1);
00070
void addItem(
const UString & itemA,
int index = -1);
00073
void addItem(
UIcon * itemA,
int index = -1);
00074
00076
void removeItem(
unsigned int index);
00077
void removeAllItems();
00078
00079
UItem * getItemAt(
unsigned int n)
const;
00080
const std::vector<UItem*> & getItems()
const;
00081
00082
unsigned int getItemCount()
const;
00083
00084
public:
00088
void setVisibleRowCount(
int visibleRowCountA);
00089
int getVisibleRowCount()
const;
00090
00091
public:
00092
00096
int getCurrentItem()
const;
00097
void setCurrentItem(
int index);
00098
00102 std::string getCurrentText()
const;
00103
void setCurrentText(
const std::string & text);
00104
00106
virtual void popup();
00107
00108
public:
00109
virtual void setListBox(
UListBox * listBox);
00110
UListBox * getListBox()
const;
00111
00112
virtual void setTextEdit(
UTextEdit * textEdit);
00113
UTextEdit * getTextEdit()
const;
00114
00115
public:
00116
typedef USignal2<UComboBox*, int> sig_activated_t;
00117
typedef USignal2<UComboBox*, int> sig_highlighted_t;
00118
typedef USignal3<UComboBox*, int, int> sig_selection_change_t;
00119 sig_activated_t & sigActivated();
00120 sig_highlighted_t & sigHighlighted();
00121 sig_selection_change_t & sigSelectionChanged();
00122
00123
protected:
00124
virtual UDimension getContentsSize(
const UDimension & maxSize)
const;
00125
virtual void processMouseEvent(
UMouseEvent * e);
00126
virtual void processKeyEvent(
UKeyEvent * e);
00127
00128
protected:
00129
00130
UListBox * m_listBox;
00131
UTextEdit * m_textEdit;
00132
00133
private:
00134
UItem * m_activated;
00135 std::string m_currentText;
00136
00137
int m_visRowCount;
00138
private:
00139 sig_activated_t m_sigActivated;
00140 sig_highlighted_t m_sigHighlighted;
00141 sig_selection_change_t m_sigSelectionChanged;
00142 };
00143
00144
00145
inline UComboBox::sig_activated_t &
00146 UComboBox::sigActivated() {
00147
return m_sigActivated;
00148 }
00149
00150
inline UComboBox::sig_highlighted_t &
00151 UComboBox::sigHighlighted() {
00152
return m_sigHighlighted;
00153 }
00154
00155
inline UComboBox::sig_selection_change_t &
00156 UComboBox::sigSelectionChanged() {
00157
return m_sigSelectionChanged;
00158 }
00159
00160 }
00161
00162
#endif // UCOMBOBOX_HPP