/usr/include/MYGUI/MyGUI_ComboBox.h is in libmygui-dev 3.2.0-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | /*!
@file
@author Albert Semenov
@date 12/2007
*/
/*
This file is part of MyGUI.
MyGUI is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
MyGUI is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __MYGUI_COMBO_BOX_H__
#define __MYGUI_COMBO_BOX_H__
#include "MyGUI_Prerequest.h"
#include "MyGUI_EditBox.h"
#include "MyGUI_ListBox.h"
#include "MyGUI_Any.h"
#include "MyGUI_EventPair.h"
#include "MyGUI_ControllerFadeAlpha.h"
#include "MyGUI_FlowDirection.h"
#include "MyGUI_IItem.h"
#include "MyGUI_IItemContainer.h"
namespace MyGUI
{
typedef delegates::CMultiDelegate2<ComboBox*, size_t> EventHandle_ComboBoxPtrSizeT;
class MYGUI_EXPORT ComboBox :
public EditBox,
public IItemContainer,
public MemberObsolete<ComboBox>
{
MYGUI_RTTI_DERIVED( ComboBox )
public:
ComboBox();
//------------------------------------------------------------------------------//
// манипуляции айтемами
//! Get number of items
size_t getItemCount() const;
//! Insert an item into a array at a specified position
void insertItemAt(size_t _index, const UString& _name, Any _data = Any::Null);
//! Add an item to the end of a array
void addItem(const UString& _name, Any _data = Any::Null);
//! Remove item at a specified position
void removeItemAt(size_t _index);
//! Remove all items
void removeAllItems();
//! Search item, returns the position of the first occurrence in array or ITEM_NONE if item not found
size_t findItemIndexWith(const UString& _name);
//------------------------------------------------------------------------------//
// манипуляции выделениями
//! Get index of selected item (ITEM_NONE if none selected)
size_t getIndexSelected() const;
//! Select specified _index
void setIndexSelected(size_t _index);
//! Clear item selection
void clearIndexSelected();
//------------------------------------------------------------------------------//
// манипуляции данными
//! Replace an item data at a specified position
void setItemDataAt(size_t _index, Any _data);
//! Clear an item data at a specified position
void clearItemDataAt(size_t _index);
//! Get item data from specified position
template <typename ValueType>
ValueType* getItemDataAt(size_t _index, bool _throw = true)
{
return mList->getItemDataAt<ValueType>(_index, _throw);
}
//------------------------------------------------------------------------------//
// манипуляции отображением
//! Replace an item name at a specified position
void setItemNameAt(size_t _index, const UString& _name);
//! Get item name from specified position
const UString& getItemNameAt(size_t _index);
//------------------------------------------------------------------------------//
// манипуляции выдимостью
//! Move all elements so specified becomes visible
void beginToItemAt(size_t _index);
//! Move all elements so first becomes visible
void beginToItemFirst();
//! Move all elements so last becomes visible
void beginToItemLast();
//! Move all elements so selected becomes visible
void beginToItemSelected();
//------------------------------------------------------------------------------------//
// методы для управления отображением
//! Set drop list mode (text can not be edited)
void setComboModeDrop(bool _value);
//! Get drop list mode flag
bool getComboModeDrop() const;
//! Set smooth show of list
void setSmoothShow(bool _value);
//! Get smooth show of list flag
bool getSmoothShow() const;
//! Get max list length
void setMaxListLength(int _value);
//! Set max list length
int getMaxListLength() const;
// RENAME
//! Set direction, where drop down list appears (TopToBottom by default).
void setFlowDirection(FlowDirection _value);
//! Get direction, where drop down list appears.
FlowDirection getFlowDirection() const;
/*events:*/
/** Event : Enter pressed in combo mode or item selected in drop down list
and combo mode drop enabled (see void ComboBox::setComboModeDrop(bool _value)).\n
signature : void method(MyGUI::ComboBox* _sender, size_t _index)
@param _sender widget that called this event
@param _index item
*/
EventPair<EventHandle_WidgetVoid, EventHandle_ComboBoxPtrSizeT>
eventComboAccept;
/** Event : Position changed.\n
signature : void method(MyGUI::ComboBox* _sender, size_t _index)
@param _sender widget that called this event
@param _index of new position
*/
EventPair<EventHandle_WidgetSizeT, EventHandle_ComboBoxPtrSizeT>
eventComboChangePosition;
/*internal:*/
// IItemContainer impl
virtual size_t _getItemCount();
virtual void _addItem(const MyGUI::UString& _name);
virtual void _removeItemAt(size_t _index);
virtual void _setItemNameAt(size_t _index, const UString& _name);
virtual const UString& _getItemNameAt(size_t _index);
virtual void _resetContainer(bool _update);
protected:
virtual void initialiseOverride();
virtual void shutdownOverride();
virtual void onKeyButtonPressed(KeyCode _key, Char _char);
virtual void setPropertyOverride(const std::string& _key, const std::string& _value);
private:
void notifyButtonPressed(Widget* _sender, int _left, int _top, MouseButton _id);
void notifyListLostFocus(Widget* _sender, MyGUI::Widget* _new);
void notifyListSelectAccept(ListBox* _widget, size_t _position);
void notifyListMouseItemActivate(ListBox* _widget, size_t _position);
void notifyListChangePosition(ListBox* _widget, size_t _position);
void notifyMouseWheel(Widget* _sender, int _rel);
void notifyMousePressed(Widget* _sender, int _left, int _top, MouseButton _id);
void notifyEditTextChange(EditBox* _sender);
void notifyToolTip(Widget* _sender, const ToolTipInfo& _info);
void showList();
void hideList();
void actionWidgetHide(Widget* _widget);
ControllerFadeAlpha* createControllerFadeAlpha(float _alpha, float _coef, bool _enable);
IntCoord calculateListPosition();
private:
Button* mButton;
ListBox* mList;
bool mListShow;
int mMaxListLength;
size_t mItemIndex;
bool mModeDrop;
bool mDropMouse;
bool mShowSmooth;
FlowDirection mFlowDirection;
};
} // namespace MyGUI
#endif // __MYGUI_COMBO_BOX_H__
|