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 #ifndef _CEGUICombobox_h_
00027 #define _CEGUICombobox_h_
00028
00029 #include "CEGUIBase.h"
00030 #include "CEGUIWindow.h"
00031 #include "elements/CEGUIComboboxProperties.h"
00032
00033
00034 #if defined(_MSC_VER)
00035 # pragma warning(push)
00036 # pragma warning(disable : 4251)
00037 #endif
00038
00039
00040
00041 namespace CEGUI
00042 {
00043
00048 class CEGUIBASE_API Combobox : public Window
00049 {
00050 public:
00051 static const String EventNamespace;
00052
00053
00054
00055
00056
00057 static const String EventReadOnlyModeChanged;
00058 static const String EventValidationStringChanged;
00059 static const String EventMaximumTextLengthChanged;
00060 static const String EventTextInvalidated;
00061 static const String EventInvalidEntryAttempted;
00062 static const String EventCaratMoved;
00063 static const String EventTextSelectionChanged;
00064 static const String EventEditboxFull;
00065 static const String EventTextAccepted;
00066
00067
00068 static const String EventListContentsChanged;
00069 static const String EventListSelectionChanged;
00070 static const String EventSortModeChanged;
00071 static const String EventVertScrollbarModeChanged;
00072 static const String EventHorzScrollbarModeChanged;
00073
00074
00075 static const String EventDropListDisplayed;
00076 static const String EventDropListRemoved;
00077 static const String EventListSelectionAccepted;
00078
00079
00090 virtual bool isHit(const Point& position) const {return false;}
00091
00092
00101 bool getSingleClickEnabled(void) const;
00102
00103
00111 bool isDropDownListVisible(void) const;
00112
00113
00114
00115
00116
00124 bool hasInputFocus(void) const;
00125
00126
00135 bool isReadOnly(void) const;
00136
00137
00154 bool isTextValid(void) const;
00155
00156
00168 const String& getValidationString(void) const;
00169
00170
00178 ulong getCaratIndex(void) const;
00179
00180
00189 ulong getSelectionStartIndex(void) const;
00190
00191
00200 ulong getSelectionEndIndex(void) const;
00201
00202
00210 ulong getSelectionLength(void) const;
00211
00212
00224 ulong getMaxTextLength(void) const;
00225
00226
00235 colour getNormalTextColour(void) const;
00236
00237
00246 colour getSelectedTextColour(void) const;
00247
00248
00257 colour getNormalSelectBrushColour(void) const;
00258
00259
00268 colour getInactiveSelectBrushColour(void) const;
00269
00270
00271
00272
00273
00281 uint getItemCount(void) const;
00282
00283
00292 ListboxItem* getSelectedItem(void) const;
00293
00294
00307 ListboxItem* getListboxItemFromIndex(uint index) const;
00308
00309
00322 uint getItemIndex(const ListboxItem* item) const;
00323
00324
00332 bool isSortEnabled(void) const;
00333
00334
00347 bool isItemSelected(uint index) const;
00348
00349
00367 ListboxItem* findItemWithText(const String& text, const ListboxItem* start_item);
00368
00369
00377 bool isListboxItemInList(const ListboxItem* item) const;
00378
00379
00388 bool isVertScrollbarAlwaysShown(void) const;
00389
00390
00399 bool isHorzScrollbarAlwaysShown(void) const;
00400
00401
00402
00403
00404
00415 virtual void initialise(void);
00416
00417
00425 void showDropList(void);
00426
00427
00435 void hideDropList(void);
00436
00437
00449 void setSingleClickEnabled(bool setting);
00450
00451
00452
00453
00454
00466 void setReadOnly(bool setting);
00467
00468
00483 void setValidationString(const String& validation_string);
00484
00485
00497 void setCaratIndex(ulong carat_pos);
00498
00499
00515 void setSelection(ulong start_pos, ulong end_pos);
00516
00517
00532 void setMaxTextLength(ulong max_len);
00533
00534
00545 void setNormalTextColour(colour col);
00546
00547
00556 void setSelectedTextColour(colour col);
00557
00558
00570 void setNormalSelectBrushColour(colour col);
00571
00572
00584 void setInactiveSelectBrushColour(colour col);
00585
00586
00594 void activateEditbox(void);
00595
00596
00597
00598
00599
00606 void resetList(void);
00607
00608
00620 void addItem(ListboxItem* item);
00621
00622
00640 void insertItem(ListboxItem* item, const ListboxItem* position);
00641
00642
00654 void removeItem(const ListboxItem* item);
00655
00656
00664 void clearAllSelections(void);
00665
00666
00677 void setSortingEnabled(bool setting);
00678
00679
00691 void setShowVertScrollbar(bool setting);
00692
00693
00705 void setShowHorzScrollbar(bool setting);
00706
00707
00727 void setItemSelectState(ListboxItem* item, bool state);
00728
00729
00749 void setItemSelectState(uint item_index, bool state);
00750
00751
00764 void handleUpdatedListItemData(void);
00765
00766
00767
00768
00769
00774 Combobox(const String& type, const String& name);
00775
00776
00781 virtual ~Combobox(void);
00782
00783
00784 protected:
00785
00786
00787
00792 void addComboboxEvents(void);
00793
00794
00802 virtual void layoutComponentWidgets() = 0;
00803
00804
00813 virtual Editbox* createEditbox(void) const = 0;
00814
00815
00824 virtual PushButton* createPushButton(void) const = 0;
00825
00826
00835 virtual ComboDropList* createDropList(void) const = 0;
00836
00837
00842 bool button_PressHandler(const EventArgs& e);
00843
00844
00849 bool droplist_SelectionAcceptedHandler(const EventArgs& e);
00850
00851
00856 bool droplist_HiddenHandler(const EventArgs& e);
00857
00858
00863 bool editbox_MouseDownHandler(const EventArgs& e);
00864
00865
00866
00867
00868
00869 bool editbox_ReadOnlyChangedHandler(const EventArgs& e);
00870 bool editbox_ValidationStringChangedHandler(const EventArgs& e);
00871 bool editbox_MaximumTextLengthChangedHandler(const EventArgs& e);
00872 bool editbox_TextInvalidatedEventHandler(const EventArgs& e);
00873 bool editbox_InvalidEntryAttemptedHandler(const EventArgs& e);
00874 bool editbox_CaratMovedHandler(const EventArgs& e);
00875 bool editbox_TextSelectionChangedHandler(const EventArgs& e);
00876 bool editbox_EditboxFullEventHandler(const EventArgs& e);
00877 bool editbox_TextAcceptedEventHandler(const EventArgs& e);
00878 bool editbox_TextChangedEventHandler(const EventArgs& e);
00879 bool listbox_ListContentsChangedHandler(const EventArgs& e);
00880 bool listbox_ListSelectionChangedHandler(const EventArgs& e);
00881 bool listbox_SortModeChangedHandler(const EventArgs& e);
00882 bool listbox_VertScrollModeChangedHandler(const EventArgs& e);
00883 bool listbox_HorzScrollModeChangedHandler(const EventArgs& e);
00884
00885
00886
00887
00888
00893 virtual void onReadOnlyChanged(WindowEventArgs& e);
00894
00895
00900 virtual void onValidationStringChanged(WindowEventArgs& e);
00901
00902
00907 virtual void onMaximumTextLengthChanged(WindowEventArgs& e);
00908
00909
00914 virtual void onTextInvalidatedEvent(WindowEventArgs& e);
00915
00916
00921 virtual void onInvalidEntryAttempted(WindowEventArgs& e);
00922
00923
00928 virtual void onCaratMoved(WindowEventArgs& e);
00929
00930
00935 virtual void onTextSelectionChanged(WindowEventArgs& e);
00936
00937
00942 virtual void onEditboxFullEvent(WindowEventArgs& e);
00943
00944
00949 virtual void onTextAcceptedEvent(WindowEventArgs& e);
00950
00951
00956 virtual void onListContentsChanged(WindowEventArgs& e);
00957
00958
00964 virtual void onListSelectionChanged(WindowEventArgs& e);
00965
00966
00971 virtual void onSortModeChanged(WindowEventArgs& e);
00972
00973
00979 virtual void onVertScrollbarModeChanged(WindowEventArgs& e);
00980
00981
00987 virtual void onHorzScrollbarModeChanged(WindowEventArgs& e);
00988
00989
00994 virtual void onDropListDisplayed(WindowEventArgs& e);
00995
00996
01001 virtual void onDroplistRemoved(WindowEventArgs& e);
01002
01003
01008 virtual void onListSelectionAccepted(WindowEventArgs& e);
01009
01010
01011
01012
01013
01014 virtual void onFontChanged(WindowEventArgs& e);
01015 virtual void onSized(WindowEventArgs& e);
01016 virtual void onTextChanged(WindowEventArgs& e);
01017 virtual void onActivated(ActivationEventArgs& e);
01018
01019
01020
01021
01022
01023 Editbox* d_editbox;
01024 ComboDropList* d_droplist;
01025 PushButton* d_button;
01026 bool d_singleClickOperation;
01027
01028
01029 private:
01030
01031
01032
01033 static ComboboxProperties::ReadOnly d_readOnlyProperty;
01034 static ComboboxProperties::ValidationString d_validationStringProperty;
01035 static ComboboxProperties::CaratIndex d_caratIndexProperty;
01036 static ComboboxProperties::EditSelectionStart d_selStartProperty;
01037 static ComboboxProperties::EditSelectionLength d_selLengthProperty;
01038 static ComboboxProperties::MaxEditTextLength d_maxTextLengthProperty;
01039 static ComboboxProperties::NormalEditTextColour d_normalTextColourProperty;
01040 static ComboboxProperties::SelectedEditTextColour d_selectedTextColourProperty;
01041 static ComboboxProperties::ActiveEditSelectionColour d_activeSelectionColourProperty;
01042 static ComboboxProperties::InactiveEditSelectionColour d_inactiveSelectionColourProperty;
01043 static ComboboxProperties::SortList d_sortProperty;
01044 static ComboboxProperties::ForceVertScrollbar d_forceVertProperty;
01045 static ComboboxProperties::ForceHorzScrollbar d_forceHorzProperty;
01046 static ComboboxProperties::SingleClickMode d_singleClickOperationProperty;
01047
01048
01049
01050
01051 void addComboboxProperties(void);
01052 };
01053
01054 }
01055
01056 #if defined(_MSC_VER)
01057 # pragma warning(pop)
01058 #endif
01059
01060 #endif // end of guard _CEGUICombobox_h_