3.3.2 with wxPython 4.3.0a16047
I noticed this while browsing around, however, I noticed that it’s never called with a PopupMenu. Should it be?
Not a big deal if that's not the intent. Just exploring
#if wxCHECK_VERSION(3, 3, 0) #include <wx/msw/darkmode.h> class PyRxDarkModeSettings : public wxDarkModeSettings { public: static COLORREF getPaletteBackground() { #ifndef _ARXTARGET return RGB(49, 56, 66); #else auto mgr = CAdUiThemeManager{}; auto theme = mgr.GetTheme(PALETTE_SET_THEME); if (theme == nullptr) return RGB(49, 56, 66); COLORREF clr = theme->GetColor(kPaletteBackground); mgr.ReleaseTheme(theme); return clr; #endif } wxColour GetMenuColour(wxMenuColour which) override { static COLORREF clr = getPaletteBackground(); switch (which) { case wxMenuColour::StandardBg: return wxColour(clr); default: return wxDarkModeSettings::GetMenuColour(which); } } wxColour GetColour(wxSystemColour index) override { static COLORREF clr = getPaletteBackground(); switch (index) { case wxSYS_COLOUR_ACTIVECAPTION: case wxSYS_COLOUR_APPWORKSPACE: case wxSYS_COLOUR_INFOBK: case wxSYS_COLOUR_LISTBOX: case wxSYS_COLOUR_WINDOW: case wxSYS_COLOUR_BTNFACE: return wxColour(clr); default: return wxDarkModeSettings::GetColour(index); } } }; #endif //wxVERSION_NUMBER
class MyPopupMenu(wx.Menu): def __init__(self): wx.Menu.__init__(self) item = wx.MenuItem(self, wx.NewId(), "Item One") self.Append(item) self.Bind(wx.EVT_MENU, self.OnItem1, item) item = wx.MenuItem(self, wx.NewId(), "Item Two") self.Append(item) self.Bind(wx.EVT_MENU, self.OnItem2, item) item = wx.MenuItem(self, wx.NewId(), "Item Three") self.Append(item) self.Bind(wx.EVT_MENU, self.OnItem3, item) def OnItem1(self, event): print("OnItem1") def OnItem2(self, event): print("OnItem2") def OnItem3(self, event): print("OnItem3") class MyPanel(wx.Panel): def __init__(self): super().__init__() self.Bind(wx.EVT_SHOW, self.OnShow) def OnShow(self, event): # import the XRC _res = Ap.ResourceOverride() self.res = xrc.XmlResource("./wxPaletteTab.xrc") self.childpanel = self.res.LoadPanel(self, "ID_WXPALETTETAB") if not self.childpanel: raise Exception("failed to find xrc file") # create a sizer and add the child sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.childpanel, 1, wx.ALL | wx.EXPAND) self.SetSizerAndFit(sizer) self.Layout() self.index = 0 self.OnInitListCtrl() # bind events self.Bind(wx.EVT_CONTEXT_MENU, self.OnContextMenu, self.listctrl) def OnContextMenu(self, event): self.PopupMenu(MyPopupMenu(), self.ScreenToClient(event.GetPosition()))
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
wxSYS_COLOUR_BTNFACE is hit in the debugger, but the color is the same as default
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
I think there may be a difference. In dark mode, we draw menus in the menu bar by ourselves when handling an undocumented WM_MENUBAR_DRAWMENUITEM:
https://github.com/wxWidgets/wxWidgets/blob/c456ccb28f96f536774896b312aca1aa9ebb5b0a/src/msw/darkmode.cpp#L722-L725
But we let the theme draw the menu item in wxMenuItem::OnDrawItem():
https://github.com/wxWidgets/wxWidgets/blob/c456ccb28f96f536774896b312aca1aa9ebb5b0a/src/msw/menuitem.cpp#L1000-L1003
i.e., wxDarkModeSettings::GetMenuColour() does not seem to be called there.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Thanks for the reply, I don’t need the behavior changed. Just testing how close I can align with AutoCAD’s theme. Dark mode looks amazing!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Well, I would still consider it a bug. Not sure how difficult it would be to fix.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()