7#ifndef MYGUI_TAB_CONTROL_H_
8#define MYGUI_TAB_CONTROL_H_
53 static constexpr int DEFAULT_WIDTH = -1;
56 void setPosition(
const IntPoint& _point)
override;
58 void setSize(
const IntSize& _size)
override;
60 void setCoord(
const IntCoord& _coord)
override;
62 using Widget::setPosition;
63 using Widget::setSize;
64 using Widget::setCoord;
70 size_t getItemCount()
const;
73 TabItem* insertItemAt(
size_t _index,
const UString& _name,
Any _data = Any::Null);
81 void removeItemAt(
size_t _index);
83 void removeItem(
TabItem* _item);
86 void removeAllItems();
90 TabItem* getItemAt(
size_t _index)
const;
93 size_t getItemIndex(
const TabItem* _item)
const;
96 size_t findItemIndex(
const TabItem* _item);
99 size_t findItemIndexWith(
const UString& _name);
104 void swapItems(
size_t _index1,
size_t _index2);
110 size_t getIndexSelected()
const;
113 TabItem* getItemSelected()
const;
116 void setIndexSelected(
size_t _index);
119 void setItemSelected(
TabItem* _item);
126 void setItemDataAt(
size_t _index,
Any _data);
131 void clearItemDataAt(
size_t _index);
133 void clearItemData(
TabItem* _item);
136 template<
typename ValueType>
140 return mItemsInfo[_index].data.castType<ValueType>(_throw);
143 template<
typename ValueType>
146 return getItemDataAt<ValueType>(getItemIndex(_item), _throw);
154 void setItemNameAt(
size_t _index,
const UString& _name);
160 const UString& getItemNameAt(
size_t _index)
const;
170 void beginToItemAt(
size_t _index);
173 void beginToItem(
const TabItem* _item);
175 void beginToItemFirst();
177 void beginToItemLast();
179 void beginToItemSelected();
186 void setButtonWidthAt(
size_t _index,
int _width = DEFAULT_WIDTH);
188 void setButtonWidth(
TabItem* _item,
int _width = DEFAULT_WIDTH);
191 int getButtonWidthAt(
size_t _index)
const;
193 int getButtonWidth(
TabItem* _item)
const;
198 void setButtonDefaultWidth(
int _width);
200 int getButtonDefaultWidth()
const;
203 void setButtonAutoWidth(
bool _auto);
205 bool getButtonAutoWidth()
const;
208 void setSmoothShow(
bool _value);
210 bool getSmoothShow()
const;
222 size_t _getItemCount()
const override;
224 void _removeItemAt(
size_t _index)
override;
225 Widget* _getItemAt(
size_t _index)
const override;
226 void _setItemNameAt(
size_t _index,
const UString& _name)
override;
227 const UString& _getItemNameAt(
size_t _index)
const override;
230 void initialiseOverride()
override;
231 void shutdownOverride()
override;
238 int _getTextWidth(
const UString& _text);
240 void _showItem(
TabItem* _item,
bool _show,
bool _smooth);
242 void _createItemButton();
244 void _insertItem(
size_t _index,
const UString& _name,
TabItem* _sheet,
Any _data);
247 void _notifyDeleteItem(
TabItem* _sheet);
249 void onWidgetCreated(
Widget* _widget)
override;
251 void setPropertyOverride(std::string_view _key, std::string_view _value)
override;
258 Widget* _getWidgetTemplate();
267 bool mButtonShow{
true};
269 std::vector<Button*> mItemButton;
270 std::string mButtonSkinName;
271 std::string mEmptySkinName;
273 Widget* mWidgetBar{
nullptr};
274 Button* mButtonLeft{
nullptr};
275 Button* mButtonRight{
nullptr};
276 Widget* mButtonDecor{
nullptr};
278 Widget* mEmptyBarWidget{
nullptr};
279 Widget* mItemTemplate{
nullptr};
282 VectorTabItemInfo mItemsInfo;
283 size_t mStartIndex{0};
286 int mButtonDefaultWidth{1};
287 bool mSmoothShow{
true};
288 bool mButtonAutoWidth{
true};
291 bool mShutdown{
false};
293 Widget* mHeaderPlace{
nullptr};
294 Widget* mControls{
nullptr};
295 Widget* mEmpty{
nullptr};
#define MYGUI_ASSERT_RANGE(index, size, owner)
#define MYGUI_RTTI_DERIVED(DerivedType)
widget description should be here.
EventPair< EventHandle_WidgetSizeT, EventHandle_TabPtrSizeT > eventTabChangeSelect
ValueType * getItemData(TabItem *_item, bool _throw=true)
Get item data.
ValueType * getItemDataAt(size_t _index, bool _throw=true)
Get item data from specified position.
std::vector< TabItemInfo > VectorTabItemInfo
widget description should be here.
A UTF-16 string with implicit conversion to/from std::string and std::wstring.
constexpr size_t ITEM_NONE
std::vector< Widget * > VectorWidgetPtr
TabItemInfo(int _width, const UString &_name, TabItem *_item, Any _data)