Menubar accelerators are now preserved in full screen mode, as per wxMSW and wxMac
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@49725 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -108,6 +108,7 @@ wxGTK:
|
||||
a background colour bug in the gtk-qt theme under KDE.
|
||||
- wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW) now returns the background
|
||||
colour of text controls.
|
||||
- wxFrame::ShowFullScreen now preserves the menubar's accelerators.
|
||||
|
||||
wxMac:
|
||||
|
||||
|
@@ -709,11 +709,79 @@ bool wxTopLevelWindowGTK::EnableCloseButton( bool enable )
|
||||
return true;
|
||||
}
|
||||
|
||||
// Helper for wxCreateAcceleratorTableForMenuBar
|
||||
static void wxAddAccelerators(wxList& accelEntries, wxMenu* menu)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < menu->GetMenuItems().GetCount(); i++)
|
||||
{
|
||||
wxMenuItem* item = (wxMenuItem*) menu->GetMenuItems().Item(i)->GetData();
|
||||
if (item->GetSubMenu())
|
||||
{
|
||||
wxAddAccelerators(accelEntries, item->GetSubMenu());
|
||||
}
|
||||
else if (!item->GetItemLabel().IsEmpty())
|
||||
{
|
||||
wxAcceleratorEntry* entry = wxAcceleratorEntry::Create(item->GetItemLabel());
|
||||
if (entry)
|
||||
{
|
||||
entry->Set(entry->GetFlags(), entry->GetKeyCode(), item->GetId());
|
||||
accelEntries.Append((wxObject*) entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create an accelerator table consisting of all the accelerators
|
||||
// from the menubar in the given menus
|
||||
static wxAcceleratorTable wxCreateAcceleratorTableForMenuBar(wxMenuBar* menuBar)
|
||||
{
|
||||
wxList accelEntries;
|
||||
|
||||
size_t i;
|
||||
for (i = 0; i < menuBar->GetMenuCount(); i++)
|
||||
{
|
||||
wxAddAccelerators(accelEntries, menuBar->GetMenu(i));
|
||||
}
|
||||
|
||||
size_t n = accelEntries.GetCount();
|
||||
|
||||
if (n == 0)
|
||||
return wxAcceleratorTable();
|
||||
|
||||
wxAcceleratorEntry* entries = new wxAcceleratorEntry[n];
|
||||
|
||||
for (i = 0; i < accelEntries.GetCount(); i++)
|
||||
{
|
||||
wxAcceleratorEntry* entry = (wxAcceleratorEntry*) accelEntries.Item(i)->GetData();
|
||||
entries[i] = (*entry);
|
||||
delete entry;
|
||||
|
||||
}
|
||||
|
||||
wxAcceleratorTable table(n, entries);
|
||||
delete[] entries;
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long style )
|
||||
{
|
||||
if (show == m_fsIsShowing)
|
||||
return false; // return what?
|
||||
|
||||
if (show)
|
||||
{
|
||||
// Preserve menubar accelerators during full-screen operation
|
||||
wxFrame* frame = wxDynamicCast(this, wxFrame);
|
||||
if (frame && frame->GetMenuBar())
|
||||
{
|
||||
wxAcceleratorTable table(wxCreateAcceleratorTableForMenuBar(frame->GetMenuBar()));
|
||||
if (table.IsOk())
|
||||
SetAcceleratorTable(table);
|
||||
}
|
||||
}
|
||||
|
||||
m_fsIsShowing = show;
|
||||
|
||||
wxX11FullScreenMethod method =
|
||||
|
Reference in New Issue
Block a user