SavvyUI C++ UI Library
Loading...
Searching...
No Matches
TabPane.h
Go to the documentation of this file.
1#pragma once
2
3#include "PanelBase.h"
4#include "CardPanel.h"
5
7{
8public:
9 TabBarItem(const wstring& title, PanelBase*tabComponent)
10 {
11 _title = title;
12 _tabComponent = tabComponent;
13 }
14
15 wstring _title;
18};
19
23class TabPane: public Component
24{
25 WinHandle _hWnd;
26 CardPanel _cardPanel;
27
28 long _tabBarHeight;
29
30 vector<TabBarItem> _tabs;
31 long _firstVisibleTab;
32 long _lastVisibleTab;
33 long _selectedTab;
34
35 BOOL _paintTabsBackward;
36 Bounds _scrollLeftBtnRect;
37 Bounds _scrollRightBtnRect;
38
39protected:
49 BOOL getCreateWindowOptions(wstring& title, UINT& widownStyles, wstring& wndClassName, BOOL& isCustomWndProc);
50
55
56public:
61
65 virtual ~TabPane();
66
70 void clear();
71
78 void addTab(const wstring& tabTitle, PanelBase* tabComponent);
79
84
90 void onPaint(Graphics *g);
91
102 void onMousePressed(WinHandle hWnd, int x, int y, int clickCount, BOOL shiftPressed, BOOL ctrlPressed);
103};
HWND WinHandle
Definition Common.h:16
Definition Common.h:20
A UI component that manages multiple "cards", displaying only one at a time.
Definition CardPanel.h:27
Component()
Constructs a new Component instance.
Definition Graphics.h:161
Base class for panel-like components that arrange child components in a grid layout.
Definition PanelBase.h:29
wstring _title
Definition TabPane.h:15
Bounds _rect
Definition TabPane.h:17
PanelBase * _tabComponent
Definition TabPane.h:16
TabBarItem(const wstring &title, PanelBase *tabComponent)
Definition TabPane.h:9
void addTab(const wstring &tabTitle, PanelBase *tabComponent)
Adds a new tab with the specified title and component.
void windowCreated()
Called when the window is created.
TabPane()
Constructs a new TabPane component.
virtual ~TabPane()
Destructor for the TabPane component.
void clear()
Clears all tabs.
void onMousePressed(WinHandle hWnd, int x, int y, int clickCount, BOOL shiftPressed, BOOL ctrlPressed)
Handles mouse press events.
void onPaint(Graphics *g)
Paints the TabPane including tabs and active content.
void onWindowResized()
Handles window resize events.
BOOL getCreateWindowOptions(wstring &title, UINT &widownStyles, wstring &wndClassName, BOOL &isCustomWndProc)
Retrieves window creation options.