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/UAHMenuBar.h
Views: 1401
1
#pragma once
2
3
// MIT license, see LICENSE
4
// Copyright(c) 2021 adzm / Adam D. Walling
5
6
// processes messages related to UAH / custom menubar drawing.
7
// return true if handled, false to continue with normal processing in your wndproc
8
bool UAHDarkModeWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT* lr);
9
10
// window messages related to menu bar drawing
11
#define WM_UAHDESTROYWINDOW 0x0090 // handled by DefWindowProc
12
#define WM_UAHDRAWMENU 0x0091 // lParam is UAHMENU
13
#define WM_UAHDRAWMENUITEM 0x0092 // lParam is UAHDRAWMENUITEM
14
#define WM_UAHINITMENU 0x0093 // handled by DefWindowProc
15
#define WM_UAHMEASUREMENUITEM 0x0094 // lParam is UAHMEASUREMENUITEM
16
#define WM_UAHNCPAINTMENUPOPUP 0x0095 // handled by DefWindowProc
17
18
// describes the sizes of the menu bar or menu item
19
typedef union tagUAHMENUITEMMETRICS
20
{
21
// cx appears to be 14 / 0xE less than rcItem's width!
22
// cy 0x14 seems stable, i wonder if it is 4 less than rcItem's height which is always 24 atm
23
struct {
24
DWORD cx;
25
DWORD cy;
26
} rgsizeBar[2];
27
struct {
28
DWORD cx;
29
DWORD cy;
30
} rgsizePopup[4];
31
} UAHMENUITEMMETRICS;
32
33
// not really used in our case but part of the other structures
34
typedef struct tagUAHMENUPOPUPMETRICS
35
{
36
DWORD rgcx[4];
37
DWORD fUpdateMaxWidths : 2; // from kernel symbols, padded to full dword
38
} UAHMENUPOPUPMETRICS;
39
40
// hmenu is the main window menu; hdc is the context to draw in
41
typedef struct tagUAHMENU
42
{
43
HMENU hmenu;
44
HDC hdc;
45
DWORD dwFlags; // no idea what these mean, in my testing it's either 0x00000a00 or sometimes 0x00000a10
46
} UAHMENU;
47
48
// menu items are always referred to by iPosition here
49
typedef struct tagUAHMENUITEM
50
{
51
int iPosition; // 0-based position of menu item in menubar
52
UAHMENUITEMMETRICS umim;
53
UAHMENUPOPUPMETRICS umpm;
54
} UAHMENUITEM;
55
56
// the DRAWITEMSTRUCT contains the states of the menu items, as well as
57
// the position index of the item in the menu, which is duplicated in
58
// the UAHMENUITEM's iPosition as well
59
typedef struct UAHDRAWMENUITEM
60
{
61
DRAWITEMSTRUCT dis; // itemID looks uninitialized
62
UAHMENU um;
63
UAHMENUITEM umi;
64
} UAHDRAWMENUITEM;
65
66
// the MEASUREITEMSTRUCT is intended to be filled with the size of the item
67
// height appears to be ignored, but width can be modified
68
typedef struct tagUAHMEASUREMENUITEM
69
{
70
MEASUREITEMSTRUCT mis;
71
UAHMENU um;
72
UAHMENUITEM umi;
73
} UAHMEASUREMENUITEM;
74
75
76