CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
Path: blob/master/Windows/W32Util/UAHMenuBar.h
Views: 1401
#pragma once12// MIT license, see LICENSE3// Copyright(c) 2021 adzm / Adam D. Walling45// processes messages related to UAH / custom menubar drawing.6// return true if handled, false to continue with normal processing in your wndproc7bool UAHDarkModeWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT* lr);89// window messages related to menu bar drawing10#define WM_UAHDESTROYWINDOW 0x0090 // handled by DefWindowProc11#define WM_UAHDRAWMENU 0x0091 // lParam is UAHMENU12#define WM_UAHDRAWMENUITEM 0x0092 // lParam is UAHDRAWMENUITEM13#define WM_UAHINITMENU 0x0093 // handled by DefWindowProc14#define WM_UAHMEASUREMENUITEM 0x0094 // lParam is UAHMEASUREMENUITEM15#define WM_UAHNCPAINTMENUPOPUP 0x0095 // handled by DefWindowProc1617// describes the sizes of the menu bar or menu item18typedef union tagUAHMENUITEMMETRICS19{20// cx appears to be 14 / 0xE less than rcItem's width!21// cy 0x14 seems stable, i wonder if it is 4 less than rcItem's height which is always 24 atm22struct {23DWORD cx;24DWORD cy;25} rgsizeBar[2];26struct {27DWORD cx;28DWORD cy;29} rgsizePopup[4];30} UAHMENUITEMMETRICS;3132// not really used in our case but part of the other structures33typedef struct tagUAHMENUPOPUPMETRICS34{35DWORD rgcx[4];36DWORD fUpdateMaxWidths : 2; // from kernel symbols, padded to full dword37} UAHMENUPOPUPMETRICS;3839// hmenu is the main window menu; hdc is the context to draw in40typedef struct tagUAHMENU41{42HMENU hmenu;43HDC hdc;44DWORD dwFlags; // no idea what these mean, in my testing it's either 0x00000a00 or sometimes 0x00000a1045} UAHMENU;4647// menu items are always referred to by iPosition here48typedef struct tagUAHMENUITEM49{50int iPosition; // 0-based position of menu item in menubar51UAHMENUITEMMETRICS umim;52UAHMENUPOPUPMETRICS umpm;53} UAHMENUITEM;5455// the DRAWITEMSTRUCT contains the states of the menu items, as well as56// the position index of the item in the menu, which is duplicated in57// the UAHMENUITEM's iPosition as well58typedef struct UAHDRAWMENUITEM59{60DRAWITEMSTRUCT dis; // itemID looks uninitialized61UAHMENU um;62UAHMENUITEM umi;63} UAHDRAWMENUITEM;6465// the MEASUREITEMSTRUCT is intended to be filled with the size of the item66// height appears to be ignored, but width can be modified67typedef struct tagUAHMEASUREMENUITEM68{69MEASUREITEMSTRUCT mis;70UAHMENU um;71UAHMENUITEM umi;72} UAHMEASUREMENUITEM;73747576