CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
hrydgard

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: hrydgard/ppsspp
Path: blob/master/Windows/W32Util/TabControl.h
Views: 1401
1
#pragma once
2
3
#include <vector>
4
5
#include "CommonWindows.h"
6
7
class Dialog;
8
9
class TabControl
10
{
11
public:
12
TabControl(HWND handle, bool noDisplayArea = false);
13
void HandleNotify(LPARAM lParam);
14
int HitTest(const POINT &screenPos);
15
HWND AddTabWindow(const wchar_t* className, const wchar_t* title, DWORD style = 0);
16
void AddTabDialog(Dialog* dialog, const wchar_t* title);
17
void AddTab(HWND hwnd, const wchar_t* title);
18
HWND RemoveTab(int index);
19
void ShowTab(int index, bool setControlIndex = true);
20
void ShowTab(HWND pageHandle);
21
void NextTab(bool cycle);
22
void PreviousTab(bool cycle);
23
int CurrentTabIndex() { return currentTab; }
24
HWND CurrentTabHandle() {
25
if (currentTab < 0 || currentTab >= (int)tabs.size()) {
26
return NULL;
27
}
28
return tabs[currentTab].pageHandle;
29
}
30
void SetShowTabTitles(bool enabled);
31
void SetIgnoreBottomMargin(bool enabled) { ignoreBottomMargin = enabled; }
32
bool GetShowTabTitles() { return showTabTitles; }
33
void SetMinTabWidth(int w);
34
35
int Count() {
36
return (int)tabs.size();
37
}
38
39
private:
40
static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
41
void OnResize();
42
int AppendPageToControl(const wchar_t* title);
43
44
struct TabInfo
45
{
46
bool hasBorder;
47
bool hasClientEdge;
48
HWND lastFocus;
49
HWND pageHandle;
50
wchar_t title[128];
51
};
52
53
HWND hwnd;
54
WNDPROC oldProc;
55
std::vector<TabInfo> tabs;
56
bool showTabTitles = true;
57
bool ignoreBottomMargin = false;
58
int currentTab = 0;
59
bool hasButtons;
60
bool noDisplayArea_;
61
};
62
63