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 "elements/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
00101 virtual bool isHit(const Point& position) const {return false;}
00102
00103
00112 bool getSingleClickEnabled(void) const;
00113
00114
00122 bool isDropDownListVisible(void) const;
00123
00124
00135 Editbox* getEditbox() const;
00136
00147 PushButton* getPushButton() const;
00148
00160 ComboDropList* getDropList() const;
00161
00162
00163
00164
00165
00173 bool hasInputFocus(void) const;
00174
00175
00184 bool isReadOnly(void) const;
00185
00186
00203 bool isTextValid(void) const;
00204
00205
00217 const String& getValidationString(void) const;
00218
00219
00227 size_t getCaratIndex(void) const;
00228
00229
00238 size_t getSelectionStartIndex(void) const;
00239
00240
00249 size_t getSelectionEndIndex(void) const;
00250
00251
00259 size_t getSelectionLength(void) const;
00260
00261
00273 size_t getMaxTextLength(void) const;
00274
00275
00276
00277
00278
00286 size_t getItemCount(void) const;
00287
00288
00297 ListboxItem* getSelectedItem(void) const;
00298
00299
00312 ListboxItem* getListboxItemFromIndex(size_t index) const;
00313
00314
00327 size_t getItemIndex(const ListboxItem* item) const;
00328
00329
00337 bool isSortEnabled(void) const;
00338
00339
00352 bool isItemSelected(size_t index) const;
00353
00354
00372 ListboxItem* findItemWithText(const String& text, const ListboxItem* start_item);
00373
00374
00382 bool isListboxItemInList(const ListboxItem* item) const;
00383
00384
00393 bool isVertScrollbarAlwaysShown(void) const;
00394
00395
00404 bool isHorzScrollbarAlwaysShown(void) const;
00405
00406
00407
00408
00409
00420 virtual void initialiseComponents(void);
00421
00422
00430 void showDropList(void);
00431
00432
00440 void hideDropList(void);
00441
00442
00454 void setSingleClickEnabled(bool setting);
00455
00456
00457
00458
00459
00471 void setReadOnly(bool setting);
00472
00473
00488 void setValidationString(const String& validation_string);
00489
00490
00502 void setCaratIndex(size_t carat_pos);
00503
00504
00520 void setSelection(size_t start_pos, size_t end_pos);
00521
00522
00537 void setMaxTextLength(size_t max_len);
00538
00539
00547 void activateEditbox(void);
00548
00549
00550
00551
00552
00559 void resetList(void);
00560
00561
00573 void addItem(ListboxItem* item);
00574
00575
00593 void insertItem(ListboxItem* item, const ListboxItem* position);
00594
00595
00607 void removeItem(const ListboxItem* item);
00608
00609
00617 void clearAllSelections(void);
00618
00619
00630 void setSortingEnabled(bool setting);
00631
00632
00644 void setShowVertScrollbar(bool setting);
00645
00646
00658 void setShowHorzScrollbar(bool setting);
00659
00660
00680 void setItemSelectState(ListboxItem* item, bool state);
00681
00682
00702 void setItemSelectState(size_t item_index, bool state);
00703
00704
00717 void handleUpdatedListItemData(void);
00718
00719
00720
00721
00722
00727 Combobox(const String& type, const String& name);
00728
00729
00734 virtual ~Combobox(void);
00735
00736
00737 protected:
00738
00739
00740
00745 bool button_PressHandler(const EventArgs& e);
00746
00747
00752 bool droplist_SelectionAcceptedHandler(const EventArgs& e);
00753
00754
00759 bool droplist_HiddenHandler(const EventArgs& e);
00760
00761
00766 bool editbox_MouseDownHandler(const EventArgs& e);
00767
00768
00779 virtual bool testClassName_impl(const String& class_name) const
00780 {
00781 if (class_name=="Combobox") return true;
00782 return Window::testClassName_impl(class_name);
00783 }
00784
00790 void itemSelectChangeTextUpdate(const ListboxItem* const item,
00791 bool new_state, bool old_state);
00792
00793
00794
00795
00796 bool editbox_ReadOnlyChangedHandler(const EventArgs& e);
00797 bool editbox_ValidationStringChangedHandler(const EventArgs& e);
00798 bool editbox_MaximumTextLengthChangedHandler(const EventArgs& e);
00799 bool editbox_TextInvalidatedEventHandler(const EventArgs& e);
00800 bool editbox_InvalidEntryAttemptedHandler(const EventArgs& e);
00801 bool editbox_CaratMovedHandler(const EventArgs& e);
00802 bool editbox_TextSelectionChangedHandler(const EventArgs& e);
00803 bool editbox_EditboxFullEventHandler(const EventArgs& e);
00804 bool editbox_TextAcceptedEventHandler(const EventArgs& e);
00805 bool editbox_TextChangedEventHandler(const EventArgs& e);
00806 bool listbox_ListContentsChangedHandler(const EventArgs& e);
00807 bool listbox_ListSelectionChangedHandler(const EventArgs& e);
00808 bool listbox_SortModeChangedHandler(const EventArgs& e);
00809 bool listbox_VertScrollModeChangedHandler(const EventArgs& e);
00810 bool listbox_HorzScrollModeChangedHandler(const EventArgs& e);
00811
00812
00813
00814
00815
00820 virtual void onReadOnlyChanged(WindowEventArgs& e);
00821
00822
00827 virtual void onValidationStringChanged(WindowEventArgs& e);
00828
00829
00834 virtual void onMaximumTextLengthChanged(WindowEventArgs& e);
00835
00836
00841 virtual void onTextInvalidatedEvent(WindowEventArgs& e);
00842
00843
00848 virtual void onInvalidEntryAttempted(WindowEventArgs& e);
00849
00850
00855 virtual void onCaratMoved(WindowEventArgs& e);
00856
00857
00862 virtual void onTextSelectionChanged(WindowEventArgs& e);
00863
00864
00869 virtual void onEditboxFullEvent(WindowEventArgs& e);
00870
00871
00876 virtual void onTextAcceptedEvent(WindowEventArgs& e);
00877
00878
00883 virtual void onListContentsChanged(WindowEventArgs& e);
00884
00885
00891 virtual void onListSelectionChanged(WindowEventArgs& e);
00892
00893
00898 virtual void onSortModeChanged(WindowEventArgs& e);
00899
00900
00906 virtual void onVertScrollbarModeChanged(WindowEventArgs& e);
00907
00908
00914 virtual void onHorzScrollbarModeChanged(WindowEventArgs& e);
00915
00916
00921 virtual void onDropListDisplayed(WindowEventArgs& e);
00922
00923
00928 virtual void onDroplistRemoved(WindowEventArgs& e);
00929
00930
00935 virtual void onListSelectionAccepted(WindowEventArgs& e);
00936
00937
00938
00939
00940
00941 virtual void onFontChanged(WindowEventArgs& e);
00942 virtual void onTextChanged(WindowEventArgs& e);
00943 virtual void onActivated(ActivationEventArgs& e);
00944
00945
00946
00947
00948
00949 bool d_singleClickOperation;
00950
00951
00952 private:
00953
00954
00955
00956 static ComboboxProperties::ReadOnly d_readOnlyProperty;
00957 static ComboboxProperties::ValidationString d_validationStringProperty;
00958 static ComboboxProperties::CaratIndex d_caratIndexProperty;
00959 static ComboboxProperties::EditSelectionStart d_selStartProperty;
00960 static ComboboxProperties::EditSelectionLength d_selLengthProperty;
00961 static ComboboxProperties::MaxEditTextLength d_maxTextLengthProperty;
00962 static ComboboxProperties::SortList d_sortProperty;
00963 static ComboboxProperties::ForceVertScrollbar d_forceVertProperty;
00964 static ComboboxProperties::ForceHorzScrollbar d_forceHorzProperty;
00965 static ComboboxProperties::SingleClickMode d_singleClickOperationProperty;
00966
00967
00968
00969
00970 void addComboboxProperties(void);
00971 };
00972
00973 }
00974
00975 #if defined(_MSC_VER)
00976 # pragma warning(pop)
00977 #endif
00978
00979 #endif // end of guard _CEGUICombobox_h_