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
00029
00030 #ifndef _CEGUICombobox_h_
00031 #define _CEGUICombobox_h_
00032
00033 #include "../CEGUIBase.h"
00034 #include "../CEGUIWindow.h"
00035 #include "CEGUIComboboxProperties.h"
00036
00037
00038 #if defined(_MSC_VER)
00039 # pragma warning(push)
00040 # pragma warning(disable : 4251)
00041 #endif
00042
00043
00044
00045 namespace CEGUI
00046 {
00047
00052 class CEGUIEXPORT Combobox : public Window
00053 {
00054 public:
00055 static const String EventNamespace;
00056 static const String WidgetTypeName;
00057
00058
00059
00060
00061
00062 static const String EventReadOnlyModeChanged;
00063 static const String EventValidationStringChanged;
00064 static const String EventMaximumTextLengthChanged;
00065 static const String EventTextInvalidated;
00066 static const String EventInvalidEntryAttempted;
00067 static const String EventCaratMoved;
00068 static const String EventTextSelectionChanged;
00069 static const String EventEditboxFull;
00070 static const String EventTextAccepted;
00071
00072
00073 static const String EventListContentsChanged;
00074 static const String EventListSelectionChanged;
00075 static const String EventSortModeChanged;
00076 static const String EventVertScrollbarModeChanged;
00077 static const String EventHorzScrollbarModeChanged;
00078
00079
00080 static const String EventDropListDisplayed;
00081 static const String EventDropListRemoved;
00082 static const String EventListSelectionAccepted;
00083
00084
00085
00086
00087 static const String EditboxNameSuffix;
00088 static const String DropListNameSuffix;
00089 static const String ButtonNameSuffix;
00090
00091
00092 bool isHit(const Vector2& position,
00093 const bool allow_disabled = false) const;
00094
00103 bool getSingleClickEnabled(void) const;
00104
00105
00113 bool isDropDownListVisible(void) const;
00114
00115
00126 Editbox* getEditbox() const;
00127
00138 PushButton* getPushButton() const;
00139
00151 ComboDropList* getDropList() const;
00152
00153
00154
00155
00156
00164 bool hasInputFocus(void) const;
00165
00166
00175 bool isReadOnly(void) const;
00176
00177
00194 bool isTextValid(void) const;
00195
00196
00208 const String& getValidationString(void) const;
00209
00210
00218 size_t getCaratIndex(void) const;
00219
00220
00229 size_t getSelectionStartIndex(void) const;
00230
00231
00240 size_t getSelectionEndIndex(void) const;
00241
00242
00250 size_t getSelectionLength(void) const;
00251
00252
00264 size_t getMaxTextLength(void) const;
00265
00266
00267
00268
00269
00277 size_t getItemCount(void) const;
00278
00279
00288 ListboxItem* getSelectedItem(void) const;
00289
00290
00303 ListboxItem* getListboxItemFromIndex(size_t index) const;
00304
00305
00318 size_t getItemIndex(const ListboxItem* item) const;
00319
00320
00328 bool isSortEnabled(void) const;
00329
00330
00343 bool isItemSelected(size_t index) const;
00344
00345
00363 ListboxItem* findItemWithText(const String& text, const ListboxItem* start_item);
00364
00365
00373 bool isListboxItemInList(const ListboxItem* item) const;
00374
00375
00384 bool isVertScrollbarAlwaysShown(void) const;
00385
00386
00395 bool isHorzScrollbarAlwaysShown(void) const;
00396
00397
00398
00399
00400
00411 virtual void initialiseComponents(void);
00412
00413
00421 void showDropList(void);
00422
00423
00431 void hideDropList(void);
00432
00433
00445 void setSingleClickEnabled(bool setting);
00446
00447
00448
00449
00450
00462 void setReadOnly(bool setting);
00463
00464
00479 void setValidationString(const String& validation_string);
00480
00481
00493 void setCaratIndex(size_t carat_pos);
00494
00495
00511 void setSelection(size_t start_pos, size_t end_pos);
00512
00513
00528 void setMaxTextLength(size_t max_len);
00529
00530
00538 void activateEditbox(void);
00539
00540
00541
00542
00543
00550 void resetList(void);
00551
00552
00564 void addItem(ListboxItem* item);
00565
00566
00584 void insertItem(ListboxItem* item, const ListboxItem* position);
00585
00586
00598 void removeItem(const ListboxItem* item);
00599
00600
00608 void clearAllSelections(void);
00609
00610
00621 void setSortingEnabled(bool setting);
00622
00623
00635 void setShowVertScrollbar(bool setting);
00636
00637
00649 void setShowHorzScrollbar(bool setting);
00650
00651
00671 void setItemSelectState(ListboxItem* item, bool state);
00672
00673
00693 void setItemSelectState(size_t item_index, bool state);
00694
00695
00708 void handleUpdatedListItemData(void);
00709
00710
00711
00712
00713
00718 Combobox(const String& type, const String& name);
00719
00720
00725 virtual ~Combobox(void);
00726
00727
00728 protected:
00729
00730
00731
00736 bool button_PressHandler(const EventArgs& e);
00737
00738
00743 bool droplist_SelectionAcceptedHandler(const EventArgs& e);
00744
00745
00750 bool droplist_HiddenHandler(const EventArgs& e);
00751
00752
00757 bool editbox_MouseDownHandler(const EventArgs& e);
00758
00759
00770 virtual bool testClassName_impl(const String& class_name) const
00771 {
00772 if (class_name=="Combobox") return true;
00773 return Window::testClassName_impl(class_name);
00774 }
00775
00781 void itemSelectChangeTextUpdate(const ListboxItem* const item,
00782 bool new_state, bool old_state);
00783
00784
00785
00786
00787 bool editbox_ReadOnlyChangedHandler(const EventArgs& e);
00788 bool editbox_ValidationStringChangedHandler(const EventArgs& e);
00789 bool editbox_MaximumTextLengthChangedHandler(const EventArgs& e);
00790 bool editbox_TextInvalidatedEventHandler(const EventArgs& e);
00791 bool editbox_InvalidEntryAttemptedHandler(const EventArgs& e);
00792 bool editbox_CaratMovedHandler(const EventArgs& e);
00793 bool editbox_TextSelectionChangedHandler(const EventArgs& e);
00794 bool editbox_EditboxFullEventHandler(const EventArgs& e);
00795 bool editbox_TextAcceptedEventHandler(const EventArgs& e);
00796 bool editbox_TextChangedEventHandler(const EventArgs& e);
00797 bool listbox_ListContentsChangedHandler(const EventArgs& e);
00798 bool listbox_ListSelectionChangedHandler(const EventArgs& e);
00799 bool listbox_SortModeChangedHandler(const EventArgs& e);
00800 bool listbox_VertScrollModeChangedHandler(const EventArgs& e);
00801 bool listbox_HorzScrollModeChangedHandler(const EventArgs& e);
00802
00803
00804
00805
00806
00811 virtual void onReadOnlyChanged(WindowEventArgs& e);
00812
00813
00818 virtual void onValidationStringChanged(WindowEventArgs& e);
00819
00820
00825 virtual void onMaximumTextLengthChanged(WindowEventArgs& e);
00826
00827
00832 virtual void onTextInvalidatedEvent(WindowEventArgs& e);
00833
00834
00839 virtual void onInvalidEntryAttempted(WindowEventArgs& e);
00840
00841
00846 virtual void onCaratMoved(WindowEventArgs& e);
00847
00848
00853 virtual void onTextSelectionChanged(WindowEventArgs& e);
00854
00855
00860 virtual void onEditboxFullEvent(WindowEventArgs& e);
00861
00862
00867 virtual void onTextAcceptedEvent(WindowEventArgs& e);
00868
00869
00874 virtual void onListContentsChanged(WindowEventArgs& e);
00875
00876
00882 virtual void onListSelectionChanged(WindowEventArgs& e);
00883
00884
00889 virtual void onSortModeChanged(WindowEventArgs& e);
00890
00891
00897 virtual void onVertScrollbarModeChanged(WindowEventArgs& e);
00898
00899
00905 virtual void onHorzScrollbarModeChanged(WindowEventArgs& e);
00906
00907
00912 virtual void onDropListDisplayed(WindowEventArgs& e);
00913
00914
00919 virtual void onDroplistRemoved(WindowEventArgs& e);
00920
00921
00926 virtual void onListSelectionAccepted(WindowEventArgs& e);
00927
00928
00929
00930
00931
00932 virtual void onFontChanged(WindowEventArgs& e);
00933 virtual void onTextChanged(WindowEventArgs& e);
00934 virtual void onActivated(ActivationEventArgs& e);
00935
00936
00937
00938
00939
00940 bool d_singleClickOperation;
00941
00942
00943 private:
00944
00945
00946
00947 static ComboboxProperties::ReadOnly d_readOnlyProperty;
00948 static ComboboxProperties::ValidationString d_validationStringProperty;
00949 static ComboboxProperties::CaratIndex d_caratIndexProperty;
00950 static ComboboxProperties::EditSelectionStart d_selStartProperty;
00951 static ComboboxProperties::EditSelectionLength d_selLengthProperty;
00952 static ComboboxProperties::MaxEditTextLength d_maxTextLengthProperty;
00953 static ComboboxProperties::SortList d_sortProperty;
00954 static ComboboxProperties::ForceVertScrollbar d_forceVertProperty;
00955 static ComboboxProperties::ForceHorzScrollbar d_forceHorzProperty;
00956 static ComboboxProperties::SingleClickMode d_singleClickOperationProperty;
00957
00958
00959
00960
00961 void addComboboxProperties(void);
00962 };
00963
00964 }
00965
00966 #if defined(_MSC_VER)
00967 # pragma warning(pop)
00968 #endif
00969
00970 #endif // end of guard _CEGUICombobox_h_