2013-09-28 18:57:02 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
class Dialog;
|
|
|
|
|
|
|
|
class TabControl
|
|
|
|
{
|
|
|
|
public:
|
2013-10-06 23:48:23 +00:00
|
|
|
TabControl(HWND handle, bool noDisplayArea = false);
|
2013-09-28 18:57:02 +00:00
|
|
|
void HandleNotify(LPARAM lParam);
|
|
|
|
HWND AddTabWindow(wchar_t* className, wchar_t* title, DWORD style = 0);
|
|
|
|
void AddTabDialog(Dialog* dialog, wchar_t* title);
|
2013-09-30 08:40:15 +00:00
|
|
|
void AddTab(HWND hwnd, wchar_t* title);
|
2013-09-28 18:57:02 +00:00
|
|
|
void ShowTab(int index, bool setControlIndex = true);
|
|
|
|
void ShowTab(HWND pageHandle);
|
|
|
|
void NextTab(bool cycle);
|
|
|
|
void PreviousTab(bool cycle);
|
2013-10-26 06:48:54 +00:00
|
|
|
int CurrentTabIndex() { return currentTab; }
|
|
|
|
HWND CurrentTabHandle() {
|
|
|
|
if (currentTab < 0 || currentTab >= (int)tabs.size()) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
return tabs[currentTab].pageHandle;
|
|
|
|
}
|
2013-09-30 13:56:08 +00:00
|
|
|
void SetShowTabTitles(bool enabled);
|
2013-10-26 06:48:54 +00:00
|
|
|
void SetIgnoreBottomMargin(bool enabled) { ignoreBottomMargin = enabled; }
|
|
|
|
bool GetShowTabTitles() { return showTabTitles; }
|
2013-10-06 23:48:23 +00:00
|
|
|
void SetMinTabWidth(int w);
|
|
|
|
|
2013-09-28 18:57:02 +00:00
|
|
|
private:
|
|
|
|
static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
|
|
|
void OnResize();
|
2013-09-30 13:56:08 +00:00
|
|
|
int AppendPageToControl(wchar_t* title);
|
|
|
|
|
|
|
|
struct TabInfo
|
|
|
|
{
|
2013-09-30 19:38:46 +00:00
|
|
|
bool hasBorder;
|
|
|
|
bool hasClientEdge;
|
|
|
|
HWND lastFocus;
|
2013-09-30 13:56:08 +00:00
|
|
|
HWND pageHandle;
|
|
|
|
wchar_t title[128];
|
|
|
|
};
|
2013-09-30 08:40:15 +00:00
|
|
|
|
2013-09-28 18:57:02 +00:00
|
|
|
HWND hwnd;
|
|
|
|
WNDPROC oldProc;
|
2013-09-30 13:56:08 +00:00
|
|
|
std::vector<TabInfo> tabs;
|
|
|
|
bool showTabTitles;
|
|
|
|
bool ignoreBottomMargin;
|
|
|
|
int currentTab;
|
2013-09-30 19:49:17 +00:00
|
|
|
bool hasButtons;
|
2013-10-06 23:48:23 +00:00
|
|
|
bool noDisplayArea_;
|
2013-09-28 18:57:02 +00:00
|
|
|
};
|