git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@406
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
16 files changed:
typedef unsigned long WXHPALETTE;
typedef unsigned long WXHCURSOR;
typedef unsigned long WXHRGN;
typedef unsigned long WXHPALETTE;
typedef unsigned long WXHCURSOR;
typedef unsigned long WXHRGN;
+typedef unsigned long WXHACCEL;
typedef unsigned long WXHINSTANCE;
typedef unsigned long WXHBITMAP;
typedef unsigned long WXHIMAGELIST;
typedef unsigned long WXHINSTANCE;
typedef unsigned long WXHBITMAP;
typedef unsigned long WXHIMAGELIST;
#include "wx/window.h"
#include "wx/toolbar.h"
#include "wx/window.h"
#include "wx/toolbar.h"
+#include "wx/msw/accel.h"
WXDLLEXPORT_DATA(extern const char*) wxFrameNameStr;
WXDLLEXPORT_DATA(extern const char*) wxToolBarNameStr;
WXDLLEXPORT_DATA(extern const char*) wxFrameNameStr;
WXDLLEXPORT_DATA(extern const char*) wxToolBarNameStr;
inline bool Iconized(void) const { return IsIconized(); }
virtual void Maximize(bool maximize);
inline bool Iconized(void) const { return IsIconized(); }
virtual void Maximize(bool maximize);
- virtual bool LoadAccelerators(const wxString& table);
+// virtual bool LoadAccelerators(const wxString& table);
+
+ virtual void SetAcceleratorTable(const wxAcceleratorTable& accel);
// Responds to colour changes
void OnSysColourChanged(wxSysColourChangedEvent& event);
// Responds to colour changes
void OnSysColourChanged(wxSysColourChangedEvent& event);
bool MSWOnClose(void);
void MSWOnMenuHighlight(WXWORD item, WXWORD flags, WXHMENU sysmenu);
bool MSWProcessMessage(WXMSG *msg);
bool MSWOnClose(void);
void MSWOnMenuHighlight(WXWORD item, WXWORD flags, WXHMENU sysmenu);
bool MSWProcessMessage(WXMSG *msg);
+ bool MSWTranslateMessage(WXMSG *msg);
void MSWCreate(int id, wxWindow *parent, const char *WXUNUSED(wclass), wxWindow *wx_win, const char *title,
int x, int y, int width, int height, long style);
void MSWCreate(int id, wxWindow *parent, const char *WXUNUSED(wclass), wxWindow *wx_win, const char *title,
int x, int y, int width, int height, long style);
WXHICON m_defaultIcon;
static bool m_useNativeStatusBar;
wxToolBar * m_frameToolBar ;
WXHICON m_defaultIcon;
static bool m_useNativeStatusBar;
wxToolBar * m_frameToolBar ;
+ wxAcceleratorTable m_acceleratorTable;
bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control);
void MSWOnMenuHighlight(WXWORD item, WXWORD flags, WXHMENU sysmenu);
bool MSWProcessMessage(WXMSG *msg);
bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control);
void MSWOnMenuHighlight(WXWORD item, WXWORD flags, WXHMENU sysmenu);
bool MSWProcessMessage(WXMSG *msg);
+ bool MSWTranslateMessage(WXMSG *msg);
void MSWOnCreate(WXLPCREATESTRUCT cs);
long MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
bool MSWOnEraseBkgnd(WXHDC pDC);
void MSWOnCreate(WXLPCREATESTRUCT cs);
long MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
bool MSWOnEraseBkgnd(WXHDC pDC);
bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control);
long MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
bool MSWProcessMessage(WXMSG *msg);
bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control);
long MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
bool MSWProcessMessage(WXMSG *msg);
+ bool MSWTranslateMessage(WXMSG *msg);
void MSWDestroyWindow(void);
// Implementation
void MSWDestroyWindow(void);
// Implementation
// Calls an appropriate default window procedure
virtual long MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
virtual bool MSWProcessMessage(WXMSG* pMsg);
// Calls an appropriate default window procedure
virtual long MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
virtual bool MSWProcessMessage(WXMSG* pMsg);
+ virtual bool MSWTranslateMessage(WXMSG* pMsg);
virtual void MSWDestroyWindow(void);
// Detach "Window" menu from menu bar so it doesn't get deleted
virtual void MSWDestroyWindow(void);
// Detach "Window" menu from menu bar so it doesn't get deleted
- WXHANDLE m_acceleratorTable;
+// WXHANDLE m_acceleratorTable;
WXHMENU m_hMenu; // Menu, if any
wxList * m_children; // Window's children
int m_returnCode;
WXHMENU m_hMenu; // Menu, if any
wxList * m_children; // Window's children
int m_returnCode;
CreateToolBar(wxNO_BORDER|wxTB_FLAT|wxTB_HORIZONTAL);
InitToolBar(GetToolBar());
CreateToolBar(wxNO_BORDER|wxTB_FLAT|wxTB_HORIZONTAL);
InitToolBar(GetToolBar());
+
+#ifdef __WXMSW__
+ // Accelerators
+ wxAcceleratorEntry entries[3];
+ entries[0].Set(wxACCEL_CTRL, (int) 'N', MDI_NEW_WINDOW);
+ entries[1].Set(wxACCEL_CTRL, (int) 'X', MDI_QUIT);
+ entries[2].Set(wxACCEL_CTRL, (int) 'A', MDI_ABOUT);
+ wxAcceleratorTable accel(3, entries);
+ SetAcceleratorTable(accel);
+#endif
}
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event) )
}
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event) )
mondrian ICON "mondrian.ico"
#include "wx/msw/wx.rc"
mondrian ICON "mondrian.ico"
#include "wx/msw/wx.rc"
+#define MINIMAL_QUIT 1
+#define MINIMAL_ABOUT 102
+
- // Anyone for a message? Try youngest descendants first.
+ // Try translations first; find the youngest window with
+ // a translation table.
for (hWnd = msg->hwnd; hWnd != NULL; hWnd = ::GetParent(hWnd))
{
wxWindow *wnd = wxFindWinFromHandle((WXHWND) hWnd);
if (wnd)
{
for (hWnd = msg->hwnd; hWnd != NULL; hWnd = ::GetParent(hWnd))
{
wxWindow *wnd = wxFindWinFromHandle((WXHWND) hWnd);
if (wnd)
{
- if (wnd->MSWProcessMessage(Msg))
+ if (wnd->MSWTranslateMessage(Msg))
-
- // STOP if we've reached the top of the hierarchy!
-// if (m_topWindow && (wnd == m_topWindow))
-// return FALSE;
- // TODO: Is this now obsolete, given that m_topWindow may not be defined?
- // Does it do anything useful anyway?
-// if (m_topWindow && m_topWindow->MSWProcessMessage(Msg))
-// return TRUE;
- return FALSE;
+ // Anyone for a non-translation message? Try youngest descendants first.
+ for (hWnd = msg->hwnd; hWnd != NULL; hWnd = ::GetParent(hWnd))
+ {
+ wxWindow *wnd = wxFindWinFromHandle((WXHWND) hWnd);
+ if (wnd)
+ {
+ if (wnd->MSWProcessMessage(Msg))
+ return TRUE;
+ }
+ }
+ return FALSE;
}
void wxApp::OnIdle(wxIdleEvent& event)
}
void wxApp::OnIdle(wxIdleEvent& event)
wxCursor *wxCROSS_CURSOR = NULL;
// 'Null' objects
wxCursor *wxCROSS_CURSOR = NULL;
// 'Null' objects
+wxAcceleratorTable wxNullAcceleratorTable;
wxBitmap wxNullBitmap;
wxIcon wxNullIcon;
wxCursor wxNullCursor;
wxBitmap wxNullBitmap;
wxIcon wxNullIcon;
wxCursor wxNullCursor;
+void wxFrame::SetAcceleratorTable(const wxAcceleratorTable& accel)
+{
+ m_acceleratorTable = accel;
+}
+
wxStatusBar *wxFrame::OnCreateStatusBar(int number, long style, wxWindowID id,
const wxString& name)
{
wxStatusBar *wxFrame::OnCreateStatusBar(int number, long style, wxWindowID id,
const wxString& name)
{
menu_bar->m_menuBarFrame = this;
}
menu_bar->m_menuBarFrame = this;
}
bool wxFrame::LoadAccelerators(const wxString& table)
{
m_acceleratorTable = (WXHANDLE)
bool wxFrame::LoadAccelerators(const wxString& table)
{
m_acceleratorTable = (WXHANDLE)
return (m_acceleratorTable != (WXHANDLE) NULL);
}
return (m_acceleratorTable != (WXHANDLE) NULL);
}
void wxFrame::Fit(void)
{
void wxFrame::Fit(void)
{
bool wxFrame::MSWProcessMessage(WXMSG* pMsg)
{
bool wxFrame::MSWProcessMessage(WXMSG* pMsg)
{
- if (m_acceleratorTable != 0 &&
- ::TranslateAccelerator((HWND) GetHWND(), (HACCEL) m_acceleratorTable, (MSG *)pMsg))
+ return FALSE;
+}
+
+bool wxFrame::MSWTranslateMessage(WXMSG* pMsg)
+{
+ if (m_acceleratorTable.Ok() &&
+ ::TranslateAccelerator((HWND) GetHWND(), (HACCEL) m_acceleratorTable.GetHACCEL(), (MSG *)pMsg))
return TRUE;
return FALSE;
return TRUE;
return FALSE;
# $(MSWDIR)\matrix.obj \
MSWOBJS = \
# $(MSWDIR)\matrix.obj \
MSWOBJS = \
$(MSWDIR)\app.obj \
$(MSWDIR)\bitmap.obj \
$(MSWDIR)\bmpbuttn.obj \
$(MSWDIR)\app.obj \
$(MSWDIR)\bitmap.obj \
$(MSWDIR)\bmpbuttn.obj \
#$(OBJECTS): $(WXDIR)\include\wx\setup.h
#$(OBJECTS): $(WXDIR)\include\wx\setup.h
+$(MSWDIR)\accel.obj: $(MSWDIR)\accel.$(SRCSUFF)
+
$(MSWDIR)\app.obj: $(MSWDIR)\app.$(SRCSUFF)
$(MSWDIR)\bitmap.obj: $(MSWDIR)\bitmap.$(SRCSUFF)
$(MSWDIR)\app.obj: $(MSWDIR)\app.$(SRCSUFF)
$(MSWDIR)\bitmap.obj: $(MSWDIR)\bitmap.$(SRCSUFF)
# $(COMMDIR)\fileconf.obj # Doens't compile (nested classes)
MSWOBJS = \
# $(COMMDIR)\fileconf.obj # Doens't compile (nested classes)
MSWOBJS = \
$(MSWDIR)\app.obj \
$(MSWDIR)\bitmap.obj \
$(MSWDIR)\bmpbuttn.obj \
$(MSWDIR)\app.obj \
$(MSWDIR)\bitmap.obj \
$(MSWDIR)\bmpbuttn.obj \
$(CPPFLAGS) /YcWX/WXPREC.H /c /Tp $*.$(SRCSUFF)
<<
$(CPPFLAGS) /YcWX/WXPREC.H /c /Tp $*.$(SRCSUFF)
<<
+$(MSWDIR)/accel.obj: $*.$(SRCSUFF)
+ cl @<<
+$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
+<<
+
$(MSWDIR)/app.obj: $*.$(SRCSUFF)
cl @<<
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
$(MSWDIR)/app.obj: $*.$(SRCSUFF)
cl @<<
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
$(COMMDIR)/wincmn.$(OBJSUFF)
MSWOBJS = \
$(COMMDIR)/wincmn.$(OBJSUFF)
MSWOBJS = \
app.$(OBJSUFF) \
bitmap.$(OBJSUFF) \
bmpbuttn.$(OBJSUFF) \
app.$(OBJSUFF) \
bitmap.$(OBJSUFF) \
bmpbuttn.$(OBJSUFF) \
$(MSWDIR)\app.obj \
$(MSWDIR)\bitmap.obj \
$(MSWDIR)\bmpbuttn.obj \
$(MSWDIR)\app.obj \
$(MSWDIR)\bitmap.obj \
$(MSWDIR)\bmpbuttn.obj \
$(CPPFLAGS) $(MAKEPRECOMP) /c /Tp $*.$(SRCSUFF)
<<
$(CPPFLAGS) $(MAKEPRECOMP) /c /Tp $*.$(SRCSUFF)
<<
+$(MSWDIR)/accel.obj: $*.$(SRCSUFF)
+ cl @<<
+$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@
+<<
+
$(MSWDIR)/app.obj: $*.$(SRCSUFF)
cl @<<
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@
$(MSWDIR)/app.obj: $*.$(SRCSUFF)
cl @<<
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@
bool wxMDIParentFrame::MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control)
{
bool wxMDIParentFrame::MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control)
{
+// if (cmd == 0) // Why did I do this test?
{
// In case it's e.g. a toolbar.
wxWindow *win = wxFindWinFromHandle(control);
{
// In case it's e.g. a toolbar.
wxWindow *win = wxFindWinFromHandle(control);
if ((m_currentChild != (wxWindow *)NULL) && (m_currentChild->GetHWND() != (WXHWND) NULL) && m_currentChild->MSWProcessMessage(msg))
return TRUE;
if ((m_currentChild != (wxWindow *)NULL) && (m_currentChild->GetHWND() != (WXHWND) NULL) && m_currentChild->MSWProcessMessage(msg))
return TRUE;
- if (m_acceleratorTable != (WXHANDLE) NULL &&
- ::TranslateAccelerator((HWND) GetHWND(), (HACCEL) m_acceleratorTable, pMsg))
+ return FALSE;
+}
+
+bool wxMDIParentFrame::MSWTranslateMessage(WXMSG* msg)
+{
+ MSG *pMsg = (MSG *)msg;
+
+ if ((m_currentChild != (wxWindow *)NULL) && (m_currentChild->GetHWND() != (WXHWND) NULL) && m_currentChild->MSWTranslateMessage(msg))
+ return TRUE;
+
+ if (m_acceleratorTable.Ok() &&
+ ::TranslateAccelerator((HWND) GetHWND(), (HACCEL) m_acceleratorTable.GetHACCEL(), pMsg))
return TRUE;
if (pMsg->message == WM_KEYDOWN || pMsg->message == WM_SYSKEYDOWN)
return TRUE;
if (pMsg->message == WM_KEYDOWN || pMsg->message == WM_SYSKEYDOWN)
bool wxMDIParentFrame::MSWOnEraseBkgnd(WXHDC WXUNUSED(pDC))
{
return TRUE;
bool wxMDIParentFrame::MSWOnEraseBkgnd(WXHDC WXUNUSED(pDC))
{
return TRUE;
#if WXDEBUG > 1
wxDebugMsg("wxMDIChildFrame::MSWOnCommand %d\n", GetHWND());
#endif
#if WXDEBUG > 1
wxDebugMsg("wxMDIChildFrame::MSWOnCommand %d\n", GetHWND());
#endif
- if ((cmd == 0) && GetHWND())
+// if ((cmd == 0) && GetHWND())
+ if (GetHWND())
{
// In case it's e.g. a toolbar.
wxWindow *win = wxFindWinFromHandle(control);
{
// In case it's e.g. a toolbar.
wxWindow *win = wxFindWinFromHandle(control);
}
bool wxMDIChildFrame::MSWProcessMessage(WXMSG *msg)
}
bool wxMDIChildFrame::MSWProcessMessage(WXMSG *msg)
+{
+ return FALSE;
+}
+
+bool wxMDIChildFrame::MSWTranslateMessage(WXMSG* msg)
{
MSG *pMsg = (MSG *)msg;
{
MSG *pMsg = (MSG *)msg;
- if (m_acceleratorTable && GetHWND())
+ if (m_acceleratorTable.Ok())
{
wxFrame *parent = (wxFrame *)GetParent();
HWND parent_hwnd = (HWND) parent->GetHWND();
{
wxFrame *parent = (wxFrame *)GetParent();
HWND parent_hwnd = (HWND) parent->GetHWND();
- return (::TranslateAccelerator(parent_hwnd, (HACCEL) m_acceleratorTable, pMsg) != 0);
+ return (::TranslateAccelerator(parent_hwnd, (HACCEL) m_acceleratorTable.GetHACCEL(), pMsg) != 0);
#include "wx/log.h"
// Windows headers
#include "wx/log.h"
// Windows headers
#define STRICT
#define WIN32_LEAN_AND_MEAN
#define STRICT
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
// other std headers
#include <windows.h>
// other std headers
m_lastMsg = 0;
m_lastWParam = 0;
m_lastLParam = 0;
m_lastMsg = 0;
m_lastWParam = 0;
m_lastLParam = 0;
- m_acceleratorTable = 0;
+// m_acceleratorTable = 0;
m_hMenu = 0;
m_xThumbSize = 0;
m_hMenu = 0;
m_xThumbSize = 0;
m_lastMsg = 0;
m_lastWParam = 0;
m_lastLParam = 0;
m_lastMsg = 0;
m_lastWParam = 0;
m_lastLParam = 0;
- m_acceleratorTable = 0;
+// m_acceleratorTable = 0;
m_hMenu = 0;
m_xThumbSize = 0;
m_hMenu = 0;
m_xThumbSize = 0;
+bool wxWindow::MSWTranslateMessage(WXMSG* WXUNUSED(pMsg))
+{
+ return FALSE;
+}
+
long wxWindow::MSWOnMDIActivate(long WXUNUSED(flag), WXHWND WXUNUSED(activate), WXHWND WXUNUSED(deactivate))
{
#if WXDEBUG > 1
long wxWindow::MSWOnMDIActivate(long WXUNUSED(flag), WXHWND WXUNUSED(activate), WXHWND WXUNUSED(deactivate))
{
#if WXDEBUG > 1