mirror of
https://github.com/italicsjenga/muda.git
synced 2025-01-10 03:41:30 +11:00
fix(windows): draw menubar for window after changes
This commit is contained in:
parent
0201895d74
commit
6f1c8cc9c9
|
@ -11,9 +11,10 @@ use windows_sys::Win32::{
|
||||||
UI::{
|
UI::{
|
||||||
Shell::{DefSubclassProc, RemoveWindowSubclass, SetWindowSubclass},
|
Shell::{DefSubclassProc, RemoveWindowSubclass, SetWindowSubclass},
|
||||||
WindowsAndMessaging::{
|
WindowsAndMessaging::{
|
||||||
AppendMenuW, CreateAcceleratorTableW, CreateMenu, EnableMenuItem, GetMenuItemInfoW,
|
AppendMenuW, CreateAcceleratorTableW, CreateMenu, DrawMenuBar, EnableMenuItem,
|
||||||
SetMenu, SetMenuItemInfoW, ACCEL, HACCEL, HMENU, MENUITEMINFOW, MFS_DISABLED,
|
GetMenuItemInfoW, SetMenu, SetMenuItemInfoW, ACCEL, HACCEL, HMENU, MENUITEMINFOW,
|
||||||
MF_DISABLED, MF_ENABLED, MF_GRAYED, MF_POPUP, MIIM_STATE, MIIM_STRING, WM_COMMAND,
|
MFS_DISABLED, MF_DISABLED, MF_ENABLED, MF_GRAYED, MF_POPUP, MIIM_STATE, MIIM_STRING,
|
||||||
|
WM_COMMAND,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -66,6 +67,7 @@ impl Menu {
|
||||||
unsafe {
|
unsafe {
|
||||||
SetMenu(hwnd, self.0.borrow().hmenu);
|
SetMenu(hwnd, self.0.borrow().hmenu);
|
||||||
SetWindowSubclass(hwnd, Some(menu_subclass_proc), MENU_SUBCLASS_ID, 0);
|
SetWindowSubclass(hwnd, Some(menu_subclass_proc), MENU_SUBCLASS_ID, 0);
|
||||||
|
DrawMenuBar(hwnd);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,18 +86,21 @@ impl Menu {
|
||||||
unsafe {
|
unsafe {
|
||||||
RemoveWindowSubclass(hwnd, Some(menu_subclass_proc), MENU_SUBCLASS_ID);
|
RemoveWindowSubclass(hwnd, Some(menu_subclass_proc), MENU_SUBCLASS_ID);
|
||||||
SetMenu(hwnd, 0);
|
SetMenu(hwnd, 0);
|
||||||
|
DrawMenuBar(hwnd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn hide_for_hwnd(&self, hwnd: isize) {
|
pub fn hide_for_hwnd(&self, hwnd: isize) {
|
||||||
unsafe {
|
unsafe {
|
||||||
SetMenu(hwnd, 0);
|
SetMenu(hwnd, 0);
|
||||||
|
DrawMenuBar(hwnd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn show_for_hwnd(&self, hwnd: isize) {
|
pub fn show_for_hwnd(&self, hwnd: isize) {
|
||||||
unsafe {
|
unsafe {
|
||||||
SetMenu(hwnd, self.0.borrow().hmenu);
|
SetMenu(hwnd, self.0.borrow().hmenu);
|
||||||
|
DrawMenuBar(hwnd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue