Menuing and statusbar updates
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15087 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -333,6 +333,10 @@ protected:
|
|||||||
,int nFillStyle = wxODDEVEN_RULE
|
,int nFillStyle = wxODDEVEN_RULE
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#if wxUSE_PALETTE
|
||||||
|
void DoSelectPalette(bool bRealize = FALSE);
|
||||||
|
void InitializePalette(void);
|
||||||
|
#endif // wxUSE_PALETTE
|
||||||
|
|
||||||
//
|
//
|
||||||
// common part of DoDrawText() and DoDrawRotatedText()
|
// common part of DoDrawText() and DoDrawRotatedText()
|
||||||
|
@@ -13,10 +13,11 @@
|
|||||||
#define _WX_MENU_H_
|
#define _WX_MENU_H_
|
||||||
|
|
||||||
#if wxUSE_ACCEL
|
#if wxUSE_ACCEL
|
||||||
#include "wx/accel.h"
|
// #include "wx/accel.h"
|
||||||
#include "wx/dynarray.h"
|
// #include "wx/list.h" // for "template" list classes
|
||||||
|
// #include "wx/dynarray.h"
|
||||||
|
|
||||||
WX_DEFINE_EXPORTED_ARRAY(wxAcceleratorEntry *, wxAcceleratorArray);
|
// WX_DECLARE_EXPORTED_LIST(wxAcceleratorEntry, wxAcceleratorList);
|
||||||
#endif // wxUSE_ACCEL
|
#endif // wxUSE_ACCEL
|
||||||
|
|
||||||
class WXDLLEXPORT wxFrame;
|
class WXDLLEXPORT wxFrame;
|
||||||
@@ -99,8 +100,8 @@ public:
|
|||||||
//
|
//
|
||||||
// Called by wxMenuBar to build its accel table from the accels of all menus
|
// Called by wxMenuBar to build its accel table from the accels of all menus
|
||||||
//
|
//
|
||||||
bool HasAccels(void) const { return !m_vAccels.IsEmpty(); }
|
bool HasAccels(void) const { return m_vAccels[0] != NULL; }
|
||||||
size_t GetAccelCount(void) const { return m_vAccels.GetCount(); }
|
size_t GetAccelCount(void) const { return (size_t)m_nNextAccel; }
|
||||||
size_t CopyAccels(wxAcceleratorEntry* pAccels) const;
|
size_t CopyAccels(wxAcceleratorEntry* pAccels) const;
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -170,7 +171,8 @@ private:
|
|||||||
//
|
//
|
||||||
// The accelerators for our menu items
|
// The accelerators for our menu items
|
||||||
//
|
//
|
||||||
wxAcceleratorArray m_vAccels;
|
wxAcceleratorEntry* m_vAccels[128];
|
||||||
|
int m_nNextAccel;
|
||||||
#endif // wxUSE_ACCEL
|
#endif // wxUSE_ACCEL
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxMenu)
|
DECLARE_DYNAMIC_CLASS(wxMenu)
|
||||||
|
@@ -1366,6 +1366,52 @@ void wxDC::DoDrawRotatedText(
|
|||||||
// set GDI objects
|
// set GDI objects
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void wxDC::DoSelectPalette(
|
||||||
|
bool bRealize
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Set the old object temporarily, in case the assignment deletes an object
|
||||||
|
// that's not yet selected out.
|
||||||
|
//
|
||||||
|
if (m_hOldPalette)
|
||||||
|
{
|
||||||
|
m_hOldPalette = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_palette.Ok())
|
||||||
|
{
|
||||||
|
HPALETTE hOldPal;
|
||||||
|
|
||||||
|
hOldPal = ::GpiSelectPalette((HDC) m_hPS, (HPALETTE) m_palette.GetHPALETTE());
|
||||||
|
if (!m_hOldPalette)
|
||||||
|
m_hOldPalette = (WXHPALETTE)hOldPal;
|
||||||
|
}
|
||||||
|
} // end of wxDC::DoSelectPalette
|
||||||
|
|
||||||
|
void wxDC::InitializePalette()
|
||||||
|
{
|
||||||
|
if (wxDisplayDepth() <= 8 )
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Look for any window or parent that has a custom palette. If any has
|
||||||
|
// one then we need to use it in drawing operations
|
||||||
|
//
|
||||||
|
wxWindow* pWin = m_pCanvas->GetAncestorWithCustomPalette();
|
||||||
|
|
||||||
|
m_hasCustomPalette = pWin && pWin->HasCustomPalette();
|
||||||
|
if (m_hasCustomPalette)
|
||||||
|
{
|
||||||
|
m_palette = pWin->GetPalette();
|
||||||
|
|
||||||
|
//
|
||||||
|
// turn on PM translation for this palette
|
||||||
|
//
|
||||||
|
DoSelectPalette();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // end of wxDC::InitializePalette
|
||||||
|
|
||||||
void wxDC::SetPalette(
|
void wxDC::SetPalette(
|
||||||
const wxPalette& rPalette
|
const wxPalette& rPalette
|
||||||
)
|
)
|
||||||
|
@@ -144,10 +144,6 @@ void wxWindowDC::InitDC()
|
|||||||
{
|
{
|
||||||
wxColour vColor;
|
wxColour vColor;
|
||||||
|
|
||||||
vColor.InitFromName("BLACK");
|
|
||||||
m_pen.SetColour(vColor);
|
|
||||||
vColor.Set("WHITE");
|
|
||||||
m_brush.SetColour(vColor);
|
|
||||||
//
|
//
|
||||||
// The background mode is only used for text background and is set in
|
// The background mode is only used for text background and is set in
|
||||||
// DrawText() to OPAQUE as required, otherwise always TRANSPARENT,
|
// DrawText() to OPAQUE as required, otherwise always TRANSPARENT,
|
||||||
@@ -158,6 +154,12 @@ void wxWindowDC::InitDC()
|
|||||||
// Default bg colour is pne of the window
|
// Default bg colour is pne of the window
|
||||||
//
|
//
|
||||||
SetBackground(wxBrush(m_pCanvas->GetBackgroundColour(), wxSOLID));
|
SetBackground(wxBrush(m_pCanvas->GetBackgroundColour(), wxSOLID));
|
||||||
|
|
||||||
|
vColor.InitFromName("BLACK");
|
||||||
|
m_pen.SetColour(vColor);
|
||||||
|
vColor.Set("WHITE");
|
||||||
|
m_brush.SetColour(vColor);
|
||||||
|
InitializePalette();
|
||||||
} // end of wxWindowDC::InitDC
|
} // end of wxWindowDC::InitDC
|
||||||
|
|
||||||
void wxWindowDC::DoGetSize(
|
void wxWindowDC::DoGetSize(
|
||||||
|
@@ -151,6 +151,9 @@ void wxMenu::Init()
|
|||||||
);
|
);
|
||||||
AppendSeparator();
|
AppendSeparator();
|
||||||
}
|
}
|
||||||
|
for (int i = 0; i < 128; i++)
|
||||||
|
m_vAccels[i] = NULL;
|
||||||
|
m_nNextAccel = 0;
|
||||||
} // end of wxMenu::Init
|
} // end of wxMenu::Init
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -175,7 +178,15 @@ wxMenu::~wxMenu()
|
|||||||
// Delete accels
|
// Delete accels
|
||||||
//
|
//
|
||||||
#if (!(defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 )))
|
#if (!(defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 )))
|
||||||
WX_CLEAR_ARRAY(m_vAccels);
|
for (int i = 0; i < 128; i++)
|
||||||
|
{
|
||||||
|
if (m_vAccels[i])
|
||||||
|
{
|
||||||
|
delete m_vAccels[i];
|
||||||
|
m_vAccels[i] = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// WX_CLEAR_ARRAY(m_vAccels);
|
||||||
#endif
|
#endif
|
||||||
#endif // wxUSE_ACCEL
|
#endif // wxUSE_ACCEL
|
||||||
} // end of wxMenu::~wxMenu
|
} // end of wxMenu::~wxMenu
|
||||||
@@ -201,12 +212,15 @@ int wxMenu::FindAccel(
|
|||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
size_t n;
|
size_t n;
|
||||||
size_t nCount = m_vAccels.GetCount();
|
// size_t nCount = m_vAccels.GetCount();
|
||||||
|
|
||||||
for (n = 0; n < nCount; n++)
|
for (n = 0; n < m_nNextAccel; n++)
|
||||||
{
|
{
|
||||||
if (m_vAccels[n]->m_command == nId)
|
if (m_vAccels[n] != NULL)
|
||||||
return n;
|
{
|
||||||
|
if (m_vAccels[n]->m_command == nId)
|
||||||
|
return n;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return wxNOT_FOUND;
|
return wxNOT_FOUND;
|
||||||
} // end of wxMenu::FindAccel
|
} // end of wxMenu::FindAccel
|
||||||
@@ -238,7 +252,7 @@ void wxMenu::UpdateAccel(
|
|||||||
//
|
//
|
||||||
// Find the old one
|
// Find the old one
|
||||||
//
|
//
|
||||||
int n = FindAccel(pItem->GetId());
|
size_t n = FindAccel(pItem->GetId());
|
||||||
|
|
||||||
if (n == wxNOT_FOUND)
|
if (n == wxNOT_FOUND)
|
||||||
{
|
{
|
||||||
@@ -246,7 +260,15 @@ void wxMenu::UpdateAccel(
|
|||||||
// No old, add new if any
|
// No old, add new if any
|
||||||
//
|
//
|
||||||
if (pAccel)
|
if (pAccel)
|
||||||
m_vAccels.Add(pAccel);
|
{
|
||||||
|
if (m_nNextAccel < 128)
|
||||||
|
{
|
||||||
|
m_vAccels[m_nNextAccel] = pAccel;
|
||||||
|
m_nNextAccel++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return; // skipping RebuildAccelTable() below
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return; // skipping RebuildAccelTable() below
|
return; // skipping RebuildAccelTable() below
|
||||||
}
|
}
|
||||||
@@ -255,12 +277,11 @@ void wxMenu::UpdateAccel(
|
|||||||
//
|
//
|
||||||
// Replace old with new or just remove the old one if no new
|
// Replace old with new or just remove the old one if no new
|
||||||
//
|
//
|
||||||
delete m_vAccels[n];
|
delete m_vAccels[n];
|
||||||
|
m_vAccels[n] = NULL;
|
||||||
|
|
||||||
if (pAccel)
|
if (pAccel)
|
||||||
m_vAccels[n] = pAccel;
|
m_vAccels[n] = pAccel;
|
||||||
else
|
|
||||||
m_vAccels.RemoveAt(n);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsAttached())
|
if (IsAttached())
|
||||||
@@ -280,6 +301,10 @@ bool wxMenu::DoInsertOrAppend(
|
|||||||
, size_t nPos
|
, size_t nPos
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
wxMenu* pSubmenu = pItem->GetSubMenu();
|
||||||
|
MENUITEM& rItem = (pSubmenu != NULL)?pSubmenu->m_vMenuData:
|
||||||
|
pItem->m_vMenuData;
|
||||||
|
|
||||||
ERRORID vError;
|
ERRORID vError;
|
||||||
wxString sError;
|
wxString sError;
|
||||||
char zMsg[128];
|
char zMsg[128];
|
||||||
@@ -292,9 +317,6 @@ bool wxMenu::DoInsertOrAppend(
|
|||||||
// MENUITEM for submenus as required by ::MM_INSERTITEM message API
|
// MENUITEM for submenus as required by ::MM_INSERTITEM message API
|
||||||
//
|
//
|
||||||
|
|
||||||
wxMenu* pSubmenu = pItem->GetSubMenu();
|
|
||||||
MENUITEM& rItem = (pSubmenu != NULL)?pSubmenu->m_vMenuData:
|
|
||||||
pItem->m_vMenuData;
|
|
||||||
if(pSubmenu != NULL)
|
if(pSubmenu != NULL)
|
||||||
{
|
{
|
||||||
wxASSERT_MSG(pSubmenu->GetHMenu(), wxT("invalid submenu"));
|
wxASSERT_MSG(pSubmenu->GetHMenu(), wxT("invalid submenu"));
|
||||||
@@ -521,7 +543,7 @@ wxMenuItem* wxMenu::DoRemove(
|
|||||||
if (n != wxNOT_FOUND)
|
if (n != wxNOT_FOUND)
|
||||||
{
|
{
|
||||||
delete m_vAccels[n];
|
delete m_vAccels[n];
|
||||||
m_vAccels.RemoveAt(n);
|
m_vAccels[n] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_ACCEL
|
#endif // wxUSE_ACCEL
|
||||||
|
@@ -153,6 +153,8 @@ wxMenuItem::wxMenuItem(
|
|||||||
#endif // owner drawn
|
#endif // owner drawn
|
||||||
{
|
{
|
||||||
wxASSERT_MSG(pParentMenu != NULL, wxT("a menu item should have a parent"));
|
wxASSERT_MSG(pParentMenu != NULL, wxT("a menu item should have a parent"));
|
||||||
|
memset(&m_vMenuData, '\0', sizeof(m_vMenuData));
|
||||||
|
m_vMenuData.id = (USHORT)nId;
|
||||||
|
|
||||||
Init();
|
Init();
|
||||||
} // end of wxMenuItem::wxMenuItem
|
} // end of wxMenuItem::wxMenuItem
|
||||||
|
@@ -4,7 +4,7 @@ DATA MULTIPLE NONSHARED READWRITE LOADONCALL
|
|||||||
CODE LOADONCALL
|
CODE LOADONCALL
|
||||||
|
|
||||||
EXPORTS
|
EXPORTS
|
||||||
;From library: H:\Dev\Wx2\WxWindows\lib\wx.lib
|
;From library: H:\DEV\Wx2\WxWindows\lib\wx.lib
|
||||||
;From object file: dummy.cpp
|
;From object file: dummy.cpp
|
||||||
;PUBDEFs (Symbols available from object file):
|
;PUBDEFs (Symbols available from object file):
|
||||||
wxDummyChar
|
wxDummyChar
|
||||||
@@ -12133,6 +12133,8 @@ EXPORTS
|
|||||||
QueryTextBkColor__FUl
|
QueryTextBkColor__FUl
|
||||||
;wxDC::SelectOldObjects(unsigned long)
|
;wxDC::SelectOldObjects(unsigned long)
|
||||||
SelectOldObjects__4wxDCFUl
|
SelectOldObjects__4wxDCFUl
|
||||||
|
;wxDC::DoSelectPalette(unsigned long)
|
||||||
|
DoSelectPalette__4wxDCFUl
|
||||||
;SetBkMode(unsigned long,int)
|
;SetBkMode(unsigned long,int)
|
||||||
SetBkMode__FUli
|
SetBkMode__FUli
|
||||||
;wxDC::DoSetClippingRegion(int,int,int,int)
|
;wxDC::DoSetClippingRegion(int,int,int,int)
|
||||||
@@ -12155,6 +12157,8 @@ EXPORTS
|
|||||||
DoDrawIcon__4wxDCFRC6wxIconiT2
|
DoDrawIcon__4wxDCFRC6wxIconiT2
|
||||||
;wxDC::StartPage()
|
;wxDC::StartPage()
|
||||||
StartPage__4wxDCFv
|
StartPage__4wxDCFv
|
||||||
|
;wxDC::InitializePalette()
|
||||||
|
InitializePalette__4wxDCFv
|
||||||
;wxDC::GetCharWidth() const
|
;wxDC::GetCharWidth() const
|
||||||
GetCharWidth__4wxDCCFv
|
GetCharWidth__4wxDCCFv
|
||||||
;wxDC::DoDrawRotatedText(const wxString&,int,int,double)
|
;wxDC::DoDrawRotatedText(const wxString&,int,int,double)
|
||||||
@@ -14276,6 +14280,8 @@ EXPORTS
|
|||||||
OnCut__10wxTextCtrlFR14wxCommandEvent
|
OnCut__10wxTextCtrlFR14wxCommandEvent
|
||||||
;wxTextCtrl::OnCopy(wxCommandEvent&)
|
;wxTextCtrl::OnCopy(wxCommandEvent&)
|
||||||
OnCopy__10wxTextCtrlFR14wxCommandEvent
|
OnCopy__10wxTextCtrlFR14wxCommandEvent
|
||||||
|
;wxTextCtrl::EmulateKeyPress(const wxKeyEvent&)
|
||||||
|
EmulateKeyPress__10wxTextCtrlFRC10wxKeyEvent
|
||||||
;wxConstructorForwxTextCtrl()
|
;wxConstructorForwxTextCtrl()
|
||||||
wxConstructorForwxTextCtrl__Fv
|
wxConstructorForwxTextCtrl__Fv
|
||||||
;wxTextCtrl::wxTextCtrl()
|
;wxTextCtrl::wxTextCtrl()
|
||||||
|
Reference in New Issue
Block a user