2013-09-28 20:57:02 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
2016-12-05 16:51:28 +01:00
|
|
|
#include "CommonWindows.h"
|
|
|
|
|
|
2013-09-28 20:57:02 +02:00
|
|
|
class Dialog;
|
|
|
|
|
|
|
|
|
|
class TabControl
|
|
|
|
|
{
|
|
|
|
|
public:
|
2013-10-06 16:48:23 -07:00
|
|
|
TabControl(HWND handle, bool noDisplayArea = false);
|
2013-09-28 20:57:02 +02:00
|
|
|
void HandleNotify(LPARAM lParam);
|
2022-08-14 10:16:16 -07:00
|
|
|
int HitTest(const POINT &screenPos);
|
2018-03-23 04:21:46 +01:00
|
|
|
HWND AddTabWindow(const wchar_t* className, const wchar_t* title, DWORD style = 0);
|
|
|
|
|
void AddTabDialog(Dialog* dialog, const wchar_t* title);
|
|
|
|
|
void AddTab(HWND hwnd, const wchar_t* title);
|
2022-08-14 09:12:57 -07:00
|
|
|
HWND RemoveTab(int index);
|
2013-09-28 20:57:02 +02:00
|
|
|
void ShowTab(int index, bool setControlIndex = true);
|
|
|
|
|
void ShowTab(HWND pageHandle);
|
|
|
|
|
void NextTab(bool cycle);
|
|
|
|
|
void PreviousTab(bool cycle);
|
2013-10-25 23:48:54 -07:00
|
|
|
int CurrentTabIndex() { return currentTab; }
|
|
|
|
|
HWND CurrentTabHandle() {
|
|
|
|
|
if (currentTab < 0 || currentTab >= (int)tabs.size()) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
return tabs[currentTab].pageHandle;
|
|
|
|
|
}
|
2013-09-30 15:56:08 +02:00
|
|
|
void SetShowTabTitles(bool enabled);
|
2013-10-25 23:48:54 -07:00
|
|
|
void SetIgnoreBottomMargin(bool enabled) { ignoreBottomMargin = enabled; }
|
|
|
|
|
bool GetShowTabTitles() { return showTabTitles; }
|
2013-10-06 16:48:23 -07:00
|
|
|
void SetMinTabWidth(int w);
|
|
|
|
|
|
2022-08-14 09:12:57 -07:00
|
|
|
int Count() {
|
|
|
|
|
return (int)tabs.size();
|
|
|
|
|
}
|
|
|
|
|
|
2013-09-28 20:57:02 +02:00
|
|
|
private:
|
|
|
|
|
static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
|
|
|
|
void OnResize();
|
2018-03-23 04:21:46 +01:00
|
|
|
int AppendPageToControl(const wchar_t* title);
|
2013-09-30 15:56:08 +02:00
|
|
|
|
|
|
|
|
struct TabInfo
|
|
|
|
|
{
|
2013-09-30 21:38:46 +02:00
|
|
|
bool hasBorder;
|
|
|
|
|
bool hasClientEdge;
|
|
|
|
|
HWND lastFocus;
|
2013-09-30 15:56:08 +02:00
|
|
|
HWND pageHandle;
|
|
|
|
|
wchar_t title[128];
|
|
|
|
|
};
|
2013-09-30 10:40:15 +02:00
|
|
|
|
2013-09-28 20:57:02 +02:00
|
|
|
HWND hwnd;
|
|
|
|
|
WNDPROC oldProc;
|
2013-09-30 15:56:08 +02:00
|
|
|
std::vector<TabInfo> tabs;
|
2021-02-15 10:29:34 -08:00
|
|
|
bool showTabTitles = true;
|
|
|
|
|
bool ignoreBottomMargin = false;
|
|
|
|
|
int currentTab = 0;
|
2013-09-30 21:49:17 +02:00
|
|
|
bool hasButtons;
|
2013-10-06 16:48:23 -07:00
|
|
|
bool noDisplayArea_;
|
2018-03-23 04:21:46 +01:00
|
|
|
};
|