/usr/include/MYGUI/MyGUI_TabControl.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 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | /*!
@file
@author Albert Semenov
@date 01/2008
*/
/*
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_TAB_CONTROL_H__
#define __MYGUI_TAB_CONTROL_H__
#include "MyGUI_Prerequest.h"
#include "MyGUI_Widget.h"
#include "MyGUI_Any.h"
#include "MyGUI_EventPair.h"
#include "MyGUI_ControllerFadeAlpha.h"
#include "MyGUI_IItem.h"
#include "MyGUI_IItemContainer.h"
namespace MyGUI
{
typedef delegates::CMultiDelegate2<TabControl*, size_t> EventHandle_TabPtrSizeT;
class MYGUI_EXPORT TabControl :
public Widget,
public IItemContainer,
public MemberObsolete<TabControl>
{
// для уведобления об удалении
//FIXME
friend class TabItem;
MYGUI_RTTI_DERIVED( TabControl )
public:
TabControl();
struct TabItemInfo
{
TabItemInfo(int _width, const UString& _name, TabItem* _item, Any _data) :
width(_width),
name(_name),
item(_item),
data(_data)
{
}
int width;
UString name;
TabItem* item;
Any data;
};
typedef std::vector<TabItemInfo> VectorTabItemInfo;
//! @copydoc Widget::setPosition(const IntPoint& _value)
virtual void setPosition(const IntPoint& _value);
//! @copydoc Widget::setSize(const IntSize& _value)
virtual void setSize(const IntSize& _value);
//! @copydoc Widget::setCoord(const IntCoord& _value)
virtual void setCoord(const IntCoord& _value);
/** @copydoc Widget::setPosition(int _left, int _top) */
void setPosition(int _left, int _top);
/** @copydoc Widget::setSize(int _width, int _height) */
void setSize(int _width, int _height);
/** @copydoc Widget::setCoord(int _left, int _top, int _width, int _height) */
void setCoord(int _left, int _top, int _width, int _height);
//------------------------------------------------------------------------------//
// манипуляции айтемами
//! Get number of items
size_t getItemCount() const;
//! Insert an item into a array at a specified position
TabItem* insertItemAt(size_t _index, const UString& _name, Any _data = Any::Null);
//! Insert an item into a array
TabItem* insertItem(TabItem* _to, const UString& _name, Any _data = Any::Null);
//! Add an item to the end of a array
TabItem* addItem(const UString& _name, Any _data = Any::Null);
//! Remove item at a specified position
void removeItemAt(size_t _index);
//! Remove item
void removeItem(TabItem* _item);
//! Remove all items
void removeAllItems();
//! Get item from specified position
TabItem* getItemAt(size_t _index);
//! Get item index
size_t getItemIndex(TabItem* _item);
//! Search item, returns the position of the first occurrence in array or ITEM_NONE if item not found
size_t findItemIndex(TabItem* _item);
//! Search item, returns the position of the first occurrence in array or ITEM_NONE if item not found
size_t findItemIndexWith(const UString& _name);
//! Search item, returns the item of the first occurrence in array or nullptr if item not found
TabItem* findItemWith(const UString& _name);
void swapItems(size_t _index1, size_t _index2);
//------------------------------------------------------------------------------//
// манипуляции выделениями
//! Get index of selected item (ITEM_NONE if none selected)
size_t getIndexSelected() const;
//! Get selected item (nullptr if none selected)
TabItem* getItemSelected();
//! Select specified _index
void setIndexSelected(size_t _index);
//! Select item
void setItemSelected(TabItem* _item);
//------------------------------------------------------------------------------//
// манипуляции данными
//! Replace an item data at a specified position
void setItemDataAt(size_t _index, Any _data);
//! Replace an item data
void setItemData(TabItem* _item, Any _data);
//! Clear an item data at a specified position
void clearItemDataAt(size_t _index);
//! Clear an item data
void clearItemData(TabItem* _item);
//! Get item data from specified position
template <typename ValueType>
ValueType* getItemDataAt(size_t _index, bool _throw = true)
{
MYGUI_ASSERT_RANGE(_index, mItemsInfo.size(), "TabControl::getItemDataAt");
return mItemsInfo[_index].data.castType<ValueType>(_throw);
}
//! Get item data
template <typename ValueType>
ValueType* getItemData(TabItem* _item, bool _throw = true)
{
return getItemDataAt<ValueType>(getItemIndex(_item), _throw);
}
//------------------------------------------------------------------------------//
// манипуляции отображением
//! Replace an item name at a specified position
void setItemNameAt(size_t _index, const UString& _name);
//! Replace an item name
void setItemName(TabItem* _item, const UString& _name);
//! Get item name from specified position
const UString& getItemNameAt(size_t _index);
//! Get item name
const UString& getItemName(TabItem* _item);
//------------------------------------------------------------------------------//
// манипуляции выдимостью
//! Move all elements so specified becomes visible
void beginToItemAt(size_t _index);
//! Move all elements so specified becomes visible
void beginToItem(TabItem* _item);
//! 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 button width at a specified position
void setButtonWidthAt(size_t _index, int _width = DEFAULT);
//! Set button width
void setButtonWidth(TabItem* _item, int _width = DEFAULT);
//! Get button width at a specified position
int getButtonWidthAt(size_t _index);
//! Get button width
int getButtonWidth(TabItem* _item);
//------------------------------------------------------------------------------//
/** Set default button width and disable autowidth mode */
void setButtonDefaultWidth(int _value);
/** Get default button width */
int getButtonDefaultWidth() const;
/** Enable or disable button auto width */
void setButtonAutoWidth(bool _value);
/** Get button auto width flag */
bool getButtonAutoWidth() const;
/** Enable or disable smooth sheets showing */
void setSmoothShow(bool _value);
/** Get smooth sheets showing flag */
bool getSmoothShow() const;
/*events:*/
/** Event : Active TabControl sheet changed \n
signature : void method(MyGUI::TabControl* _sender, size_t _index)\n
@param _sender widget that called this event
@param _index Index of selected sheet
*/
EventPair<EventHandle_WidgetSizeT, EventHandle_TabPtrSizeT>
eventTabChangeSelect;
/*internal:*/
// IItemContainer impl
virtual size_t _getItemCount();
virtual void _addItem(const MyGUI::UString& _name);
virtual void _removeItemAt(size_t _index);
virtual Widget* _getItemAt(size_t _index);
virtual void _setItemNameAt(size_t _index, const UString& _name);
virtual const UString& _getItemNameAt(size_t _index);
protected:
virtual void initialiseOverride();
virtual void shutdownOverride();
void updateBar();
void notifyPressedButtonEvent(MyGUI::Widget* _sender);
void notifyPressedBarButtonEvent(MyGUI::Widget* _sender);
int _getTextWidth(const UString& _text);
void _showItem(TabItem* _sheet, bool _show, bool _smooth);
void _createItemButton();
void _insertItem(size_t _index, const UString& _name, TabItem* _sheet, Any _data);
// вкладка при удалении уведомляет таб
void _notifyDeleteItem(TabItem* _item);
virtual void onWidgetCreated(Widget* _widget);
virtual void setPropertyOverride(const std::string& _key, const std::string& _value);
private:
void actionWidgetHide(Widget* _widget);
ControllerFadeAlpha* createControllerFadeAlpha(float _alpha, float _coef, bool _enable);
Widget* _getWidgetTemplate();
Widget* _getWidgetBar();
Button* createButton();
void updateBarOld();
void updateBarNew();
private:
int mOffsetTab; // смещение бара при показе кнопок
bool mButtonShow;
int mWidthBar; // ширина в которую помещаються все кнопки
std::vector<Button*> mItemButton; // список кнопок, не должно равно списку страниц
std::string mButtonSkinName;
std::string mEmptySkinName;
Widget* mWidgetBar;
Button* mButtonLeft;
Button* mButtonRight;
Widget* mButtonDecor;
VectorWidgetPtr mWidgetsPatch; // список виджетов которые нужно показать при показе кнопки
Widget* mEmptyBarWidget;
Widget* mItemTemplate;
// информация о вкладках
VectorTabItemInfo mItemsInfo;
size_t mStartIndex;
size_t mIndexSelect;
int mButtonDefaultWidth;
bool mSmoothShow;
bool mButtonAutoWidth;
// флаг, чтобы отсеч уведомления от вкладок, при общем шутдауне виджета
bool mShutdown;
Widget* mHeaderPlace;
Widget* mControls;
Widget* mEmpty;
};
} // namespace MyGUI
#endif // __MYGUI_TAB_CONTROL_H__
|