,int nFillStyle = wxODDEVEN_RULE
);
+#if wxUSE_PALETTE
+ void DoSelectPalette(bool bRealize = FALSE);
+ void InitializePalette(void);
+#endif // wxUSE_PALETTE
//
// common part of DoDrawText() and DoDrawRotatedText()
#define _WX_MENU_H_
#if wxUSE_ACCEL
- #include "wx/accel.h"
- #include "wx/dynarray.h"
+// #include "wx/accel.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
class WXDLLEXPORT wxFrame;
//
// Called by wxMenuBar to build its accel table from the accels of all menus
//
- bool HasAccels(void) const { return !m_vAccels.IsEmpty(); }
- size_t GetAccelCount(void) const { return m_vAccels.GetCount(); }
+ bool HasAccels(void) const { return m_vAccels[0] != NULL; }
+ size_t GetAccelCount(void) const { return (size_t)m_nNextAccel; }
size_t CopyAccels(wxAcceleratorEntry* pAccels) const;
//
//
// The accelerators for our menu items
//
- wxAcceleratorArray m_vAccels;
+ wxAcceleratorEntry* m_vAccels[128];
+ int m_nNextAccel;
#endif // wxUSE_ACCEL
DECLARE_DYNAMIC_CLASS(wxMenu)
// 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(
const wxPalette& rPalette
)
{
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
// DrawText() to OPAQUE as required, otherwise always TRANSPARENT,
// Default bg colour is pne of the window
//
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
void wxWindowDC::DoGetSize(
);
AppendSeparator();
}
+ for (int i = 0; i < 128; i++)
+ m_vAccels[i] = NULL;
+ m_nNextAccel = 0;
} // end of wxMenu::Init
//
// Delete accels
//
#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 // wxUSE_ACCEL
} // end of wxMenu::~wxMenu
) const
{
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)
- return n;
+ if (m_vAccels[n] != NULL)
+ {
+ if (m_vAccels[n]->m_command == nId)
+ return n;
+ }
}
return wxNOT_FOUND;
} // end of wxMenu::FindAccel
//
// Find the old one
//
- int n = FindAccel(pItem->GetId());
+ size_t n = FindAccel(pItem->GetId());
if (n == wxNOT_FOUND)
{
// No old, add new if any
//
if (pAccel)
- m_vAccels.Add(pAccel);
+ {
+ if (m_nNextAccel < 128)
+ {
+ m_vAccels[m_nNextAccel] = pAccel;
+ m_nNextAccel++;
+ }
+ else
+ return; // skipping RebuildAccelTable() below
+ }
else
return; // skipping RebuildAccelTable() below
}
//
// 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)
m_vAccels[n] = pAccel;
- else
- m_vAccels.RemoveAt(n);
}
if (IsAttached())
, size_t nPos
)
{
+ wxMenu* pSubmenu = pItem->GetSubMenu();
+ MENUITEM& rItem = (pSubmenu != NULL)?pSubmenu->m_vMenuData:
+ pItem->m_vMenuData;
+
ERRORID vError;
wxString sError;
char zMsg[128];
// 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)
{
wxASSERT_MSG(pSubmenu->GetHMenu(), wxT("invalid submenu"));
if (n != wxNOT_FOUND)
{
delete m_vAccels[n];
- m_vAccels.RemoveAt(n);
+ m_vAccels[n] = NULL;
}
#endif // wxUSE_ACCEL
#endif // owner drawn
{
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();
} // end of wxMenuItem::wxMenuItem
CODE LOADONCALL
EXPORTS
-;From library: H:\Dev\Wx2\WxWindows\lib\wx.lib
+;From library: H:\DEV\Wx2\WxWindows\lib\wx.lib
;From object file: dummy.cpp
;PUBDEFs (Symbols available from object file):
wxDummyChar
QueryTextBkColor__FUl
;wxDC::SelectOldObjects(unsigned long)
SelectOldObjects__4wxDCFUl
+ ;wxDC::DoSelectPalette(unsigned long)
+ DoSelectPalette__4wxDCFUl
;SetBkMode(unsigned long,int)
SetBkMode__FUli
;wxDC::DoSetClippingRegion(int,int,int,int)
DoDrawIcon__4wxDCFRC6wxIconiT2
;wxDC::StartPage()
StartPage__4wxDCFv
+ ;wxDC::InitializePalette()
+ InitializePalette__4wxDCFv
;wxDC::GetCharWidth() const
GetCharWidth__4wxDCCFv
;wxDC::DoDrawRotatedText(const wxString&,int,int,double)
OnCut__10wxTextCtrlFR14wxCommandEvent
;wxTextCtrl::OnCopy(wxCommandEvent&)
OnCopy__10wxTextCtrlFR14wxCommandEvent
+ ;wxTextCtrl::EmulateKeyPress(const wxKeyEvent&)
+ EmulateKeyPress__10wxTextCtrlFRC10wxKeyEvent
;wxConstructorForwxTextCtrl()
wxConstructorForwxTextCtrl__Fv
;wxTextCtrl::wxTextCtrl()