29 #ifndef _CEGUITabControl_h_
30 #define _CEGUITabControl_h_
33 #include "../Window.h"
38 # pragma warning(push)
39 # pragma warning(disable : 4251)
54 class CEGUIEXPORT TabControlWindowRenderer :
public WindowRenderer
61 TabControlWindowRenderer(
const String& name);
71 virtual TabButton* createTabButton(
const String& name)
const = 0;
78 class CEGUIEXPORT TabControl :
public Window
81 static const String EventNamespace;
82 static const String WidgetTypeName;
99 static const String EventSelectionChanged;
105 static const String TabButtonName;
106 static const String TabButtonPaneName;
121 size_t getTabCount(
void)
const;
129 TabPanePosition getTabPanePosition(
void)
const
130 {
return d_tabPanePos; }
138 void setTabPanePosition(TabPanePosition pos);
146 void setSelectedTab(
const String &name);
154 void setSelectedTab(uint ID);
162 void setSelectedTabAtIndex(
size_t index);
169 void makeTabVisible(
const String &name);
176 void makeTabVisible(uint ID);
183 void makeTabVisibleAtIndex(
size_t index);
197 Window* getTabContentsAtIndex(
size_t index)
const;
225 Window* getTabContents(uint ID)
const;
239 bool isTabContentsSelected(
Window* wnd)
const;
248 size_t getSelectedTabIndex()
const;
254 const UDim& getTabHeight(
void)
const {
return d_tabHeight; }
260 const UDim& getTabTextPadding(
void)
const {
return d_tabPadding; }
276 virtual void initialiseComponents(
void);
282 void setTabHeight(
const UDim& height);
288 void setTabTextPadding(
const UDim& padding);
298 void addTab(Window* wnd);
305 void removeTab(
const String& name);
312 void removeTab(uint ID);
322 TabControl(
const String& type,
const String& name);
329 virtual ~TabControl(
void);
347 virtual void drawSelf(
const RenderingContext&) { }
353 virtual void addButtonForTabContent(Window* wnd);
358 virtual void removeButtonForTabContent(Window* wnd);
364 TabButton* getButtonForTabContents(Window* wnd)
const;
369 String makeButtonName(Window* wnd);
377 virtual void selectTab_impl(Window* wnd);
386 virtual void makeTabVisible_impl(Window* wnd);
399 Window* getTabButtonPane()
const;
412 Window* getTabPane()
const;
414 void performChildWindowLayout(
bool nonclient_sized_hint =
false,
415 bool client_sized_hint =
false);
416 int writeChildWindowsXML(XMLSerializer& xml_stream)
const;
419 virtual bool validateWindowRenderer(
const WindowRenderer* renderer)
const;
429 TabButton* createTabButton(
const String& name)
const;
432 void removeTab_impl(Window* window);
442 virtual void onSelectionChanged(WindowEventArgs& e);
452 virtual void onFontChanged(WindowEventArgs& e);
459 typedef std::vector<TabButton*
460 CEGUI_VECTOR_ALLOC(TabButton*)> TabButtonVector;
461 TabButtonVector d_tabButtonVector;
462 float d_firstTabOffset;
463 TabPanePosition d_tabPanePos;
465 std::map<Window*, Event::ScopedConnection> d_eventConnections;
487 void calculateTabButtonSizePosition(
size_t index);
493 void addTabControlProperties(
void);
495 void addChild_impl(
Element* element);
496 void removeChild_impl(
Element* element);
504 bool handleContentWindowTextChanged(
const EventArgs& args);
505 bool handleTabButtonClicked(
const EventArgs& args);
506 bool handleScrollPane(
const EventArgs& e);
507 bool handleDraggedPane(
const EventArgs& e);
508 bool handleWheeledPane(
const EventArgs& e);
515 typedef TabControl::TabPanePosition return_type;
516 typedef return_type safe_method_return_type;
517 typedef TabControl::TabPanePosition pass_type;
518 typedef String string_return_type;
520 static const String& getDataTypeName()
522 static String type(
"TabPanePosition");
527 static return_type fromString(
const String& str)
531 return TabControl::Bottom;
535 return TabControl::Top;
541 if (val == TabControl::Top)
545 else if (val == TabControl::Bottom)
551 assert(
false &&
"Invalid Tab Pane Position");
559 #if defined(_MSC_VER)
560 # pragma warning(pop)
563 #endif // end of guard _CEGUITabControl_h_