1. wxMSW seems to work (please test and send your bug reports!)
2. accelerators in the menus a la GTK (actually slightly better) implemented 3. wxSplitter now uses events (and so the code which was broken by recent changes works again) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2504 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -60,6 +60,8 @@
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxNavigationKeyEvent, wxCommandEvent)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxPaletteChangedEvent, wxEvent)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxQueryNewPaletteEvent, wxEvent)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxWindowCreateEvent, wxEvent)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxWindowDestroyEvent, wxEvent)
|
||||
|
||||
const wxEventTable *wxEvtHandler::GetEventTable() const
|
||||
{ return &wxEvtHandler::sm_eventTable; }
|
||||
@@ -91,7 +93,6 @@ wxEvent::wxEvent(int theId)
|
||||
{
|
||||
m_eventType = wxEVT_NULL;
|
||||
m_eventObject = (wxObject *) NULL;
|
||||
m_eventHandle = (char *) NULL;
|
||||
m_timeStamp = 0;
|
||||
m_id = theId;
|
||||
m_skipped = FALSE;
|
||||
@@ -106,7 +107,6 @@ void wxEvent::CopyObject(wxObject& object_dest) const
|
||||
|
||||
obj->m_eventType = m_eventType;
|
||||
obj->m_eventObject = m_eventObject;
|
||||
obj->m_eventHandle = m_eventHandle;
|
||||
obj->m_timeStamp = m_timeStamp;
|
||||
obj->m_id = m_id;
|
||||
obj->m_skipped = m_skipped;
|
||||
@@ -467,6 +467,18 @@ void wxQueryNewPaletteEvent::CopyObject(wxObject& obj_d) const
|
||||
obj->m_paletteRealized = m_paletteRealized;
|
||||
}
|
||||
|
||||
wxWindowCreateEvent::wxWindowCreateEvent(wxWindow *win)
|
||||
: wxEvent(wxEVT_CREATE)
|
||||
{
|
||||
SetEventObject(win);
|
||||
}
|
||||
|
||||
wxWindowDestroyEvent::wxWindowDestroyEvent(wxWindow *win)
|
||||
: wxEvent(wxEVT_DESTROY)
|
||||
{
|
||||
SetEventObject(win);
|
||||
}
|
||||
|
||||
/*
|
||||
* Event handler
|
||||
*/
|
||||
|
@@ -57,7 +57,7 @@
|
||||
// static data
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
int wxWindowBase::ms_lastControlId = -2;
|
||||
int wxWindowBase::ms_lastControlId = -200;
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxWindowBase, wxEvtHandler)
|
||||
|
||||
@@ -309,6 +309,14 @@ void wxWindowBase::Fit()
|
||||
while ( node )
|
||||
{
|
||||
wxWindow *win = node->GetData();
|
||||
if ( win->IsKindOf(CLASSINFO(wxFrame)) ||
|
||||
win->IsKindOf(CLASSINFO(wxDialog)) )
|
||||
{
|
||||
// dialogs and frames line in different top level windows - don't
|
||||
// deal with them here
|
||||
continue;
|
||||
}
|
||||
|
||||
int wx, wy, ww, wh;
|
||||
win->GetPosition(&wx, &wy);
|
||||
win->GetSize(&ww, &wh);
|
||||
|
@@ -24,7 +24,6 @@
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "wx/string.h"
|
||||
@@ -33,11 +32,16 @@
|
||||
|
||||
#if !USE_SHARED_LIBRARY
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxSplitterWindow, wxWindow)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxSplitterEvent, wxCommandEvent)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxSplitterWindow, wxWindow)
|
||||
EVT_PAINT(wxSplitterWindow::OnPaint)
|
||||
EVT_SIZE(wxSplitterWindow::OnSize)
|
||||
EVT_MOUSE_EVENTS(wxSplitterWindow::OnMouseEvent)
|
||||
|
||||
EVT_SPLITTER_SASH_POS_CHANGED(-1, wxSplitterWindow::OnSashPosChanged)
|
||||
EVT_SPLITTER_DCLICK(-1, wxSplitterWindow::OnDoubleClick)
|
||||
EVT_SPLITTER_UNSPLIT(-1, wxSplitterWindow::OnUnsplitEvent)
|
||||
END_EVENT_TABLE()
|
||||
#endif
|
||||
|
||||
@@ -195,8 +199,18 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
|
||||
int new_sash_position =
|
||||
(int) ( m_splitMode == wxSPLIT_VERTICAL ? x : y );
|
||||
|
||||
if ( !OnSashPositionChange(new_sash_position) )
|
||||
return;
|
||||
wxSplitterEvent eventSplitter(wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED,
|
||||
this);
|
||||
eventSplitter.m_data.pos = new_sash_position;
|
||||
if ( GetEventHandler()->ProcessEvent(eventSplitter) )
|
||||
{
|
||||
new_sash_position = eventSplitter.GetSashPosition();
|
||||
if ( new_sash_position == -1 )
|
||||
{
|
||||
// change not allowed
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( new_sash_position == 0 )
|
||||
{
|
||||
@@ -204,7 +218,7 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
|
||||
wxWindow *removedWindow = m_windowOne;
|
||||
m_windowOne = m_windowTwo;
|
||||
m_windowTwo = (wxWindow *) NULL;
|
||||
OnUnsplit(removedWindow);
|
||||
SendUnsplitEvent(removedWindow);
|
||||
m_sashPosition = 0;
|
||||
}
|
||||
else if ( new_sash_position == window_size )
|
||||
@@ -212,13 +226,14 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
|
||||
// We remove the second window from the view
|
||||
wxWindow *removedWindow = m_windowTwo;
|
||||
m_windowTwo = (wxWindow *) NULL;
|
||||
OnUnsplit(removedWindow);
|
||||
SendUnsplitEvent(removedWindow);
|
||||
m_sashPosition = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_sashPosition = new_sash_position;
|
||||
}
|
||||
|
||||
SizeWindows();
|
||||
} // left up && dragging
|
||||
else if (event.Moving() && !event.Dragging())
|
||||
@@ -237,11 +252,11 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
|
||||
}
|
||||
#ifdef __WXGTK__
|
||||
else
|
||||
{
|
||||
// where else do we unset the cursor?
|
||||
{
|
||||
// where else do we unset the cursor?
|
||||
SetCursor(* wxSTANDARD_CURSOR);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif // __WXGTK__
|
||||
}
|
||||
else if (event.Dragging() && (m_dragMode == wxSPLIT_DRAG_DRAGGING))
|
||||
{
|
||||
@@ -256,7 +271,12 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
|
||||
}
|
||||
else if ( event.LeftDClick() )
|
||||
{
|
||||
OnDoubleClickSash(x, y);
|
||||
wxSplitterEvent eventSplitter(wxEVT_COMMAND_SPLITTER_DOUBLECLICKED,
|
||||
this);
|
||||
eventSplitter.m_data.pt.x = x;
|
||||
eventSplitter.m_data.pt.y = y;
|
||||
|
||||
(void)GetEventHandler()->ProcessEvent(eventSplitter);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -614,7 +634,7 @@ bool wxSplitterWindow::Unsplit(wxWindow *toRemove)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
OnUnsplit(win);
|
||||
SendUnsplitEvent(win);
|
||||
m_sashPosition = 0;
|
||||
SizeWindows();
|
||||
|
||||
@@ -657,56 +677,6 @@ void wxSplitterWindow::SetSashPosition(int position, bool redraw)
|
||||
}
|
||||
}
|
||||
|
||||
bool wxSplitterWindow::OnSashPositionChange(int& newSashPosition)
|
||||
{
|
||||
// If within UNSPLIT_THRESHOLD from edge, set to edge to cause closure.
|
||||
const int UNSPLIT_THRESHOLD = 4;
|
||||
|
||||
if (newSashPosition <= UNSPLIT_THRESHOLD) // threshold top / left check
|
||||
{
|
||||
newSashPosition = 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Obtain relevant window dimension for bottom / right threshold check
|
||||
int w, h;
|
||||
GetClientSize(&w, &h);
|
||||
int window_size = (m_splitMode == wxSPLIT_VERTICAL) ? w : h ;
|
||||
|
||||
if ( newSashPosition >= window_size - UNSPLIT_THRESHOLD )
|
||||
{
|
||||
newSashPosition = window_size;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// If resultant pane would be too small, enlarge it.
|
||||
|
||||
// Check upper / left pane
|
||||
if ( newSashPosition < m_minimumPaneSize )
|
||||
newSashPosition = m_minimumPaneSize; // NB: don't return just yet
|
||||
|
||||
// Check lower / right pane (check even if sash was just adjusted)
|
||||
if ( newSashPosition > window_size - m_minimumPaneSize )
|
||||
newSashPosition = window_size - m_minimumPaneSize;
|
||||
|
||||
// If the result is out of bounds it means minimum size is too big, so
|
||||
// split window in half as best compromise.
|
||||
if (newSashPosition < 0 || newSashPosition > window_size)
|
||||
newSashPosition = window_size / 2;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Called when the sash is double-clicked.
|
||||
// The default behaviour is to remove the sash if the
|
||||
// minimum pane size is zero.
|
||||
void wxSplitterWindow::OnDoubleClickSash(int WXUNUSED(x), int WXUNUSED(y) )
|
||||
{
|
||||
if ( GetMinimumPaneSize() == 0 )
|
||||
{
|
||||
Unsplit();
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize colours
|
||||
void wxSplitterWindow::InitColours()
|
||||
{
|
||||
@@ -744,3 +714,84 @@ void wxSplitterWindow::InitColours()
|
||||
#endif // Win32/!Win32
|
||||
}
|
||||
|
||||
void wxSplitterWindow::SendUnsplitEvent(wxWindow *winRemoved)
|
||||
{
|
||||
wxSplitterEvent event(wxEVT_COMMAND_SPLITTER_UNSPLIT, this);
|
||||
event.m_data.win = winRemoved;
|
||||
|
||||
(void)GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// splitter event handlers
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
void wxSplitterWindow::OnSashPosChanged(wxSplitterEvent& event)
|
||||
{
|
||||
// If within UNSPLIT_THRESHOLD from edge, set to edge to cause closure.
|
||||
const int UNSPLIT_THRESHOLD = 4;
|
||||
|
||||
int newSashPosition = event.GetSashPosition();
|
||||
|
||||
// Obtain relevant window dimension for bottom / right threshold check
|
||||
int w, h;
|
||||
GetClientSize(&w, &h);
|
||||
int window_size = (m_splitMode == wxSPLIT_VERTICAL) ? w : h ;
|
||||
|
||||
if ( newSashPosition <= UNSPLIT_THRESHOLD )
|
||||
{
|
||||
// threshold top / left check
|
||||
newSashPosition = 0;
|
||||
}
|
||||
else if ( newSashPosition >= window_size - UNSPLIT_THRESHOLD )
|
||||
{
|
||||
// threshold bottom/right check
|
||||
newSashPosition = window_size;
|
||||
}
|
||||
|
||||
// If resultant pane would be too small, enlarge it.
|
||||
|
||||
// Check upper / left pane
|
||||
if ( newSashPosition < m_minimumPaneSize )
|
||||
newSashPosition = m_minimumPaneSize;
|
||||
|
||||
// Check lower / right pane (check even if sash was just adjusted)
|
||||
if ( newSashPosition > window_size - m_minimumPaneSize )
|
||||
newSashPosition = window_size - m_minimumPaneSize;
|
||||
|
||||
// If the result is out of bounds it means minimum size is too big,
|
||||
// so split window in half as best compromise.
|
||||
if ( newSashPosition < 0 || newSashPosition > window_size )
|
||||
newSashPosition = window_size / 2;
|
||||
|
||||
// for compatibility, call the virtual function
|
||||
if ( !OnSashPositionChange(newSashPosition) )
|
||||
{
|
||||
newSashPosition = -1;
|
||||
}
|
||||
|
||||
event.SetSashPosition(newSashPosition);
|
||||
}
|
||||
|
||||
// Called when the sash is double-clicked. The default behaviour is to remove
|
||||
// the sash if the minimum pane size is zero.
|
||||
void wxSplitterWindow::OnDoubleClick(wxSplitterEvent& event)
|
||||
{
|
||||
// for compatibility, call the virtual function
|
||||
OnDoubleClickSash(event.GetX(), event.GetY());
|
||||
|
||||
if ( GetMinimumPaneSize() == 0 )
|
||||
{
|
||||
Unsplit();
|
||||
}
|
||||
}
|
||||
|
||||
void wxSplitterWindow::OnUnsplitEvent(wxSplitterEvent& event)
|
||||
{
|
||||
wxWindow *win = event.GetWindowBeingRemoved();
|
||||
|
||||
// for compatibility, call the virtual function
|
||||
OnUnsplit(win);
|
||||
|
||||
win->Show(FALSE);
|
||||
}
|
||||
|
@@ -30,10 +30,6 @@
|
||||
|
||||
#include "wx/msw/private.h"
|
||||
|
||||
#ifdef LoadAccelerators
|
||||
#undef LoadAccelerators
|
||||
#endif
|
||||
|
||||
#if !USE_SHARED_LIBRARIES
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxAcceleratorTable, wxObject)
|
||||
#endif
|
||||
|
182
src/msw/app.cpp
182
src/msw/app.cpp
@@ -100,7 +100,7 @@ extern void wxSetKeyboardHook(bool doIt);
|
||||
extern wxCursor *g_globalCursor;
|
||||
|
||||
HINSTANCE wxhInstance = 0;
|
||||
static MSG s_currentMsg;
|
||||
MSG s_currentMsg;
|
||||
wxApp *wxTheApp = NULL;
|
||||
|
||||
// FIXME why not const? and not static?
|
||||
@@ -150,8 +150,6 @@ LRESULT APIENTRY wxWndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
END_EVENT_TABLE()
|
||||
#endif
|
||||
|
||||
long wxApp::sm_lastMessageTime = 0;
|
||||
|
||||
//// Initialize
|
||||
bool wxApp::Initialize()
|
||||
{
|
||||
@@ -169,7 +167,8 @@ bool wxApp::Initialize()
|
||||
wxGetResource("wxWindows", "OsVersion", &wxOsVersion);
|
||||
#endif
|
||||
|
||||
// I'm annoyed ... I don't know where to put this and I don't want to create // a module for that as it's part of the core.
|
||||
// I'm annoyed ... I don't know where to put this and I don't want to
|
||||
// create a module for that as it's part of the core.
|
||||
#if wxUSE_THREADS
|
||||
wxPendingEvents = new wxList();
|
||||
wxPendingEventsLocker = new wxCriticalSection();
|
||||
@@ -205,18 +204,6 @@ bool wxApp::Initialize()
|
||||
int iMsg = 96;
|
||||
while (!SetMessageQueue(iMsg) && (iMsg -= 8));
|
||||
|
||||
/*
|
||||
DWORD dwOleVer;
|
||||
dwOleVer = CoBuildVersion();
|
||||
|
||||
// check the OLE library version
|
||||
if (rmm != HIWORD(dwOleVer))
|
||||
{
|
||||
wxMessageBox("Incorrect version of OLE libraries.");
|
||||
return FALSE;
|
||||
}
|
||||
*/
|
||||
|
||||
#if wxUSE_OLE
|
||||
// we need to initialize OLE library
|
||||
if ( FAILED(::OleInitialize(NULL)) )
|
||||
@@ -244,11 +231,11 @@ bool wxApp::Initialize()
|
||||
|
||||
// Create the brush for disabling bitmap buttons
|
||||
|
||||
LOGBRUSH lb ;
|
||||
LOGBRUSH lb;
|
||||
lb.lbStyle = BS_PATTERN;
|
||||
lb.lbHatch = (int)LoadBitmap( wxhInstance, "wxDISABLE_BUTTON_BITMAP" ) ;
|
||||
wxDisableButtonBrush = ::CreateBrushIndirect( & lb ) ;
|
||||
::DeleteObject( (HGDIOBJ)lb.lbHatch ) ;
|
||||
lb.lbHatch = (int)LoadBitmap( wxhInstance, "wxDISABLE_BUTTON_BITMAP" );
|
||||
wxDisableButtonBrush = ::CreateBrushIndirect( & lb );
|
||||
::DeleteObject( (HGDIOBJ)lb.lbHatch );
|
||||
|
||||
#if wxUSE_PENWINDOWS
|
||||
wxRegisterPenWin();
|
||||
@@ -271,131 +258,88 @@ bool wxApp::Initialize()
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//// RegisterWindowClasses
|
||||
// ---------------------------------------------------------------------------
|
||||
// RegisterWindowClasses
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
bool wxApp::RegisterWindowClasses()
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// Register the frame window class.
|
||||
WNDCLASS wndclass; // Structure used to register Windows class.
|
||||
WNDCLASS wndclass;
|
||||
|
||||
wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS ;
|
||||
// the fields which are common to all classes
|
||||
wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
|
||||
wndclass.lpfnWndProc = (WNDPROC)wxWndProc;
|
||||
wndclass.cbClsExtra = 0;
|
||||
wndclass.cbWndExtra = sizeof( DWORD ); // was 4
|
||||
wndclass.cbWndExtra = sizeof( DWORD ); // what is this DWORD used for?
|
||||
wndclass.hInstance = wxhInstance;
|
||||
wndclass.hIcon = (HICON) NULL; // wxSTD_FRAME_ICON;
|
||||
wndclass.hCursor = LoadCursor( (HINSTANCE) NULL, IDC_ARROW );
|
||||
wndclass.hbrBackground = (HBRUSH)(COLOR_APPWORKSPACE+1) ;
|
||||
// wndclass.hbrBackground = GetStockObject( WHITE_BRUSH );
|
||||
wndclass.hIcon = (HICON) NULL;
|
||||
wndclass.hCursor = ::LoadCursor((HINSTANCE)NULL, IDC_ARROW);
|
||||
wndclass.lpszMenuName = NULL;
|
||||
|
||||
// Register the frame window class.
|
||||
wndclass.hbrBackground = (HBRUSH)(COLOR_APPWORKSPACE + 1);
|
||||
#ifdef _MULTIPLE_INSTANCES
|
||||
sprintf( wxFrameClassName,"wxFrameClass%d", wxhInstance );
|
||||
#endif
|
||||
wndclass.lpszClassName = wxFrameClassName;
|
||||
|
||||
if (!RegisterClass( &wndclass ))
|
||||
if ( !RegisterClass(&wndclass) )
|
||||
{
|
||||
// wxFatalError("Can't register Frame Window class");
|
||||
wxLogLastError("RegisterClass(frame)");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// Register the MDI frame window class.
|
||||
WNDCLASS wndclass1; // Structure used to register Windows class.
|
||||
wndclass.hbrBackground = (HBRUSH)NULL; // paint MDI frame ourselves
|
||||
wndclass.lpszClassName = wxMDIFrameClassName;
|
||||
|
||||
wndclass1.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS ;
|
||||
wndclass1.lpfnWndProc = (WNDPROC)wxWndProc;
|
||||
wndclass1.cbClsExtra = 0;
|
||||
wndclass1.cbWndExtra = sizeof( DWORD ); // was 4
|
||||
wndclass1.hInstance = wxhInstance;
|
||||
wndclass1.hIcon = (HICON) NULL; // wxSTD_MDIPARENTFRAME_ICON;
|
||||
wndclass1.hCursor = LoadCursor( (HINSTANCE) NULL, IDC_ARROW );
|
||||
// wndclass1.hbrBackground = (HBRUSH)(COLOR_APPWORKSPACE+1) ;
|
||||
wndclass1.hbrBackground = (HBRUSH) NULL;
|
||||
wndclass1.lpszMenuName = NULL;
|
||||
|
||||
wndclass1.lpszClassName = wxMDIFrameClassName;
|
||||
if (!RegisterClass( &wndclass1 ))
|
||||
if ( !RegisterClass(&wndclass) )
|
||||
{
|
||||
// wxFatalError("Can't register MDI Frame window class");
|
||||
// return FALSE;
|
||||
wxLogLastError("RegisterClass(MDI parent)");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// Register the MDI child frame window class.
|
||||
WNDCLASS wndclass4; // Structure used to register Windows class.
|
||||
wndclass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
|
||||
wndclass.lpszClassName = wxMDIChildFrameClassName;
|
||||
|
||||
wndclass4.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS ;
|
||||
wndclass4.lpfnWndProc = (WNDPROC)wxWndProc;
|
||||
wndclass4.cbClsExtra = 0;
|
||||
wndclass4.cbWndExtra = sizeof( DWORD ); // was 4
|
||||
wndclass4.hInstance = wxhInstance;
|
||||
wndclass4.hIcon = (HICON) NULL; // wxSTD_MDICHILDFRAME_ICON;
|
||||
wndclass4.hCursor = LoadCursor( (HINSTANCE) NULL, IDC_ARROW );
|
||||
// TODO: perhaps this should be NULL so that Windows doesn't
|
||||
// paint the background itself (would OnEraseBackground duplicate
|
||||
// this?)
|
||||
wndclass4.hbrBackground = (HBRUSH)(COLOR_WINDOW+1) ;
|
||||
// wndclass4.hbrBackground = NULL;
|
||||
wndclass4.lpszMenuName = NULL;
|
||||
wndclass4.lpszClassName = wxMDIChildFrameClassName;
|
||||
|
||||
if (!RegisterClass( &wndclass4 ))
|
||||
if ( !RegisterClass(&wndclass) )
|
||||
{
|
||||
// wxFatalError("Can't register MDI child frame window class");
|
||||
// return FALSE;
|
||||
wxLogLastError("RegisterClass(MDI child)");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// Register the panel window class.
|
||||
WNDCLASS wndclass2; // Structure used to register Windows class.
|
||||
memset(&wndclass2, 0, sizeof(WNDCLASS)); // start with NULL defaults
|
||||
wndclass2.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS ;
|
||||
wndclass2.lpfnWndProc = (WNDPROC)wxWndProc;
|
||||
wndclass2.cbClsExtra = 0;
|
||||
wndclass2.cbWndExtra = sizeof( DWORD ); // was 4
|
||||
wndclass2.hInstance = wxhInstance;
|
||||
wndclass2.hIcon = (HICON) NULL;
|
||||
wndclass2.hCursor = LoadCursor( (HINSTANCE) NULL, IDC_ARROW );
|
||||
// wndclass2.hbrBackground = (HBRUSH)(COLOR_BTNFACE+1) ;
|
||||
wndclass2.hbrBackground = (HBRUSH) GetStockObject( LTGRAY_BRUSH );
|
||||
wndclass2.lpszMenuName = NULL;
|
||||
wndclass2.lpszClassName = wxPanelClassName;
|
||||
if (!RegisterClass( &wndclass2 ))
|
||||
wndclass.hbrBackground = (HBRUSH) GetStockObject( LTGRAY_BRUSH );
|
||||
wndclass.lpszClassName = wxPanelClassName;
|
||||
|
||||
if ( !RegisterClass(&wndclass) )
|
||||
{
|
||||
// wxFatalError("Can't register Panel Window class");
|
||||
// return FALSE;
|
||||
wxLogLastError("RegisterClass(panel)");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// Register the canvas and textsubwindow class name
|
||||
WNDCLASS wndclass3; // Structure used to register Windows class.
|
||||
memset(&wndclass3, 0, sizeof(WNDCLASS)); // start with NULL defaults
|
||||
// Use CS_OWNDC to avoid messing about restoring the context
|
||||
// for every graphic operation.
|
||||
// wndclass3.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC | CS_DBLCLKS ;
|
||||
// wxWin 2.0
|
||||
wndclass3.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS ;
|
||||
wndclass3.lpfnWndProc = (WNDPROC)wxWndProc;
|
||||
wndclass3.cbClsExtra = 0;
|
||||
wndclass3.cbWndExtra = sizeof( DWORD ); // was 4
|
||||
wndclass3.hInstance = wxhInstance;
|
||||
wndclass3.hIcon = (HICON) NULL;
|
||||
wndclass3.hCursor = LoadCursor( (HINSTANCE) NULL, IDC_ARROW );
|
||||
// wndclass3.hbrBackground = (HBRUSH)(COLOR_WINDOW+1) ;
|
||||
wndclass3.hbrBackground = (HBRUSH) NULL;
|
||||
wndclass3.lpszMenuName = NULL;
|
||||
wndclass3.lpszClassName = wxCanvasClassName;
|
||||
if (!RegisterClass( &wndclass3))
|
||||
wndclass.hbrBackground = (HBRUSH)NULL;
|
||||
wndclass.lpszClassName = wxCanvasClassName;
|
||||
|
||||
if ( !RegisterClass(&wndclass) )
|
||||
{
|
||||
// wxFatalError("Can't register Canvas class");
|
||||
// return FALSE;
|
||||
wxLogLastError("RegisterClass(canvas)");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//// Convert Windows to argc, argv style
|
||||
// ---------------------------------------------------------------------------
|
||||
// Convert Windows to argc, argv style
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
void wxApp::ConvertToStandardCommandArgs(char* lpCmdLine)
|
||||
{
|
||||
@@ -499,7 +443,7 @@ void wxApp::CleanUp()
|
||||
delete g_globalCursor;
|
||||
g_globalCursor = NULL;
|
||||
|
||||
wxDeleteStockObjects() ;
|
||||
wxDeleteStockObjects();
|
||||
|
||||
// Destroy all GDI lists, etc.
|
||||
wxDeleteStockLists();
|
||||
@@ -544,7 +488,7 @@ void wxApp::CleanUp()
|
||||
DestroyIcon(wxDEFAULT_MDIPARENTFRAME_ICON);
|
||||
|
||||
if ( wxDisableButtonBrush )
|
||||
::DeleteObject( wxDisableButtonBrush ) ;
|
||||
::DeleteObject( wxDisableButtonBrush );
|
||||
|
||||
#if wxUSE_OLE
|
||||
::OleUninitialize();
|
||||
@@ -555,7 +499,7 @@ void wxApp::CleanUp()
|
||||
#endif
|
||||
|
||||
if (wxWinHandleList)
|
||||
delete wxWinHandleList ;
|
||||
delete wxWinHandleList;
|
||||
|
||||
// GL: I'm annoyed ... I don't know where to put this and I don't want to
|
||||
// create a module for that as it's part of the core.
|
||||
@@ -646,7 +590,7 @@ int wxEntry(WXHINSTANCE hInstance,
|
||||
|
||||
// GUI-specific initialisation. In fact on Windows we don't have any,
|
||||
// but this call is provided for compatibility across platforms.
|
||||
wxTheApp->OnInitGui() ;
|
||||
wxTheApp->OnInitGui();
|
||||
|
||||
int retValue = 0;
|
||||
|
||||
@@ -759,16 +703,11 @@ wxApp::wxApp()
|
||||
{
|
||||
m_topWindow = NULL;
|
||||
wxTheApp = this;
|
||||
m_className = "";
|
||||
m_wantDebugOutput = TRUE ;
|
||||
m_appName = "";
|
||||
m_wantDebugOutput = TRUE;
|
||||
|
||||
argc = 0;
|
||||
argv = NULL;
|
||||
#ifdef __WXMSW__
|
||||
m_printMode = wxPRINT_WINDOWS;
|
||||
#else
|
||||
m_printMode = wxPRINT_POSTSCRIPT;
|
||||
#endif
|
||||
m_exitOnFrameDelete = TRUE;
|
||||
m_auto3D = TRUE;
|
||||
}
|
||||
@@ -875,7 +814,6 @@ bool wxApp::DoMessage()
|
||||
if ( !ProcessMessage((WXMSG *)&s_currentMsg) )
|
||||
{
|
||||
::TranslateMessage(&s_currentMsg);
|
||||
wxApp::sm_lastMessageTime = s_currentMsg.time; /* MATTHEW: timeStamp impl. */
|
||||
::DispatchMessage(&s_currentMsg);
|
||||
}
|
||||
}
|
||||
@@ -955,7 +893,7 @@ void wxApp::ExitMainLoop()
|
||||
|
||||
bool wxApp::Pending()
|
||||
{
|
||||
return (::PeekMessage(&s_currentMsg, 0, 0, 0, PM_NOREMOVE) != 0) ;
|
||||
return (::PeekMessage(&s_currentMsg, 0, 0, 0, PM_NOREMOVE) != 0);
|
||||
}
|
||||
|
||||
void wxApp::Dispatch()
|
||||
@@ -1064,7 +1002,7 @@ bool wxApp::SendIdleEvents(wxWindow* win)
|
||||
|
||||
node = node->Next();
|
||||
}
|
||||
return needMore ;
|
||||
return needMore;
|
||||
}
|
||||
|
||||
void wxApp::DeletePendingObjects()
|
||||
|
@@ -72,20 +72,25 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
|
||||
if ( height == -1 && bitmap.Ok())
|
||||
height = bitmap.GetHeight() + 2*m_marginY;
|
||||
|
||||
HWND wx_button =
|
||||
CreateWindowEx(0, "BUTTON", "", BS_OWNERDRAW | WS_TABSTOP | WS_CHILD,
|
||||
0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId,
|
||||
wxGetInstance(), NULL);
|
||||
|
||||
m_hWnd = (WXHWND)wx_button;
|
||||
m_hWnd = (WXHWND)CreateWindowEx
|
||||
(
|
||||
0,
|
||||
"BUTTON",
|
||||
"",
|
||||
WS_VISIBLE | WS_TABSTOP | WS_CHILD | BS_OWNERDRAW ,
|
||||
0, 0, 0, 0,
|
||||
GetWinHwnd(parent),
|
||||
(HMENU)m_windowId,
|
||||
wxGetInstance(),
|
||||
NULL
|
||||
);
|
||||
|
||||
// Subclass again for purposes of dialog editing mode
|
||||
SubclassWin((WXHWND)wx_button);
|
||||
SubclassWin(m_hWnd);
|
||||
|
||||
SetFont(parent->GetFont()) ;
|
||||
|
||||
SetSize(x, y, width, height);
|
||||
ShowWindow(wx_button, SW_SHOW);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -101,9 +106,6 @@ bool wxBitmapButton::MSWOnDraw(WXDRAWITEMSTRUCT *item)
|
||||
long style = GetWindowLong((HWND) GetHWND(), GWL_STYLE);
|
||||
if (style & BS_BITMAP)
|
||||
{
|
||||
// Should we call Default() here?
|
||||
// Default();
|
||||
|
||||
// Let default procedure draw the bitmap, which is defined
|
||||
// in the Windows resource.
|
||||
return FALSE;
|
||||
@@ -114,33 +116,33 @@ bool wxBitmapButton::MSWOnDraw(WXDRAWITEMSTRUCT *item)
|
||||
|
||||
wxBitmap* bitmap = &m_buttonBitmap;
|
||||
|
||||
UINT state = lpDIS->itemState;
|
||||
if ((state & ODS_SELECTED) && m_buttonBitmapSelected.Ok())
|
||||
bitmap = &m_buttonBitmapSelected;
|
||||
else if ((state & ODS_FOCUS) && m_buttonBitmapFocus.Ok())
|
||||
bitmap = &m_buttonBitmapFocus;
|
||||
else if ((state & ODS_DISABLED) && m_buttonBitmapDisabled.Ok())
|
||||
bitmap = &m_buttonBitmapDisabled;
|
||||
UINT state = lpDIS->itemState;
|
||||
if ((state & ODS_SELECTED) && m_buttonBitmapSelected.Ok())
|
||||
bitmap = &m_buttonBitmapSelected;
|
||||
else if ((state & ODS_FOCUS) && m_buttonBitmapFocus.Ok())
|
||||
bitmap = &m_buttonBitmapFocus;
|
||||
else if ((state & ODS_DISABLED) && m_buttonBitmapDisabled.Ok())
|
||||
bitmap = &m_buttonBitmapDisabled;
|
||||
|
||||
if ( !bitmap->Ok() )
|
||||
return FALSE;
|
||||
if ( !bitmap->Ok() )
|
||||
return FALSE;
|
||||
|
||||
HDC hDC = lpDIS->hDC;
|
||||
HDC memDC = ::CreateCompatibleDC(hDC);
|
||||
HDC hDC = lpDIS->hDC;
|
||||
HDC memDC = ::CreateCompatibleDC(hDC);
|
||||
|
||||
HBITMAP old = (HBITMAP) ::SelectObject(memDC, (HBITMAP) bitmap->GetHBITMAP());
|
||||
HBITMAP old = (HBITMAP) ::SelectObject(memDC, (HBITMAP) bitmap->GetHBITMAP());
|
||||
|
||||
if (!old)
|
||||
return FALSE;
|
||||
if (!old)
|
||||
return FALSE;
|
||||
|
||||
int x = lpDIS->rcItem.left;
|
||||
int y = lpDIS->rcItem.top;
|
||||
int width = lpDIS->rcItem.right - x;
|
||||
int height = lpDIS->rcItem.bottom - y;
|
||||
int x = lpDIS->rcItem.left;
|
||||
int y = lpDIS->rcItem.top;
|
||||
int width = lpDIS->rcItem.right - x;
|
||||
int height = lpDIS->rcItem.bottom - y;
|
||||
|
||||
// Draw the face, if auto-drawing
|
||||
if ( GetWindowStyleFlag() & wxBU_AUTODRAW )
|
||||
DrawFace((WXHDC) hDC, lpDIS->rcItem.left, lpDIS->rcItem.top, lpDIS->rcItem.right, lpDIS->rcItem.bottom,
|
||||
// Draw the face, if auto-drawing
|
||||
if ( GetWindowStyleFlag() & wxBU_AUTODRAW )
|
||||
DrawFace((WXHDC) hDC, lpDIS->rcItem.left, lpDIS->rcItem.top, lpDIS->rcItem.right, lpDIS->rcItem.bottom,
|
||||
((state & ODS_SELECTED) == ODS_SELECTED));
|
||||
|
||||
// Centre the bitmap in the control area
|
||||
|
@@ -72,21 +72,25 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
|
||||
else
|
||||
m_windowId = id;
|
||||
|
||||
DWORD exStyle = MakeExtendedStyle(m_windowStyle);
|
||||
HWND wx_button =
|
||||
CreateWindowEx(exStyle, "BUTTON", label, BS_PUSHBUTTON | WS_TABSTOP | WS_CHILD,
|
||||
0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId,
|
||||
wxGetInstance(), NULL);
|
||||
|
||||
m_hWnd = (WXHWND)wx_button;
|
||||
m_hWnd = (WXHWND)CreateWindowEx
|
||||
(
|
||||
MakeExtendedStyle(m_windowStyle),
|
||||
"BUTTON",
|
||||
label,
|
||||
WS_VISIBLE | WS_TABSTOP | WS_CHILD,
|
||||
0, 0, 0, 0,
|
||||
GetWinHwnd(parent),
|
||||
(HMENU)m_windowId,
|
||||
wxGetInstance(),
|
||||
NULL
|
||||
);
|
||||
|
||||
// Subclass again for purposes of dialog editing mode
|
||||
SubclassWin((WXHWND)wx_button);
|
||||
SubclassWin(m_hWnd);
|
||||
|
||||
SetFont(parent->GetFont());
|
||||
|
||||
SetSize(x, y, width, height);
|
||||
ShowWindow(wx_button, SW_SHOW);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@@ -313,7 +313,7 @@ long wxChoice::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
|
||||
// with x = 65535 and y = 65535.
|
||||
// Filter out this nonsense.
|
||||
if (x == 65535 && y == 65535)
|
||||
return Default();
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -34,11 +34,6 @@
|
||||
#include <commctrl.h>
|
||||
#endif
|
||||
|
||||
#ifdef GetCharWidth
|
||||
#undef GetCharWidth
|
||||
#undef GetWindowProc
|
||||
#endif
|
||||
|
||||
#if !USE_SHARED_LIBRARY
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
|
||||
|
||||
@@ -48,75 +43,43 @@ END_EVENT_TABLE()
|
||||
#endif
|
||||
|
||||
// Item members
|
||||
wxControl::wxControl(void)
|
||||
wxControl::wxControl()
|
||||
{
|
||||
m_backgroundColour = *wxWHITE;
|
||||
m_foregroundColour = *wxBLACK;
|
||||
|
||||
#if WXWIN_COMPATIBILITY
|
||||
m_callback = 0;
|
||||
// m_windowCursor = wxNullCursor; // To avoid the standard cursor being used
|
||||
#endif // WXWIN_COMPATIBILITY
|
||||
}
|
||||
|
||||
wxControl::~wxControl(void)
|
||||
wxControl::~wxControl()
|
||||
{
|
||||
m_isBeingDeleted = TRUE;
|
||||
m_isBeingDeleted = TRUE;
|
||||
|
||||
// If we delete an item, we should initialize the parent panel,
|
||||
// because it could now be invalid.
|
||||
wxWindow *parent = (wxWindow *)GetParent();
|
||||
if (parent)
|
||||
{
|
||||
if (parent->GetDefaultItem() == (wxButton*) this)
|
||||
parent->SetDefaultItem(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void wxControl::SetLabel(const wxString& label)
|
||||
{
|
||||
if (GetHWND())
|
||||
SetWindowText((HWND) GetHWND(), (const char *)label);
|
||||
}
|
||||
|
||||
wxString wxControl::GetLabel(void) const
|
||||
{
|
||||
wxBuffer[0] = 0;
|
||||
if (GetHWND())
|
||||
// If we delete an item, we should initialize the parent panel,
|
||||
// because it could now be invalid.
|
||||
wxWindow *parent = (wxWindow *)GetParent();
|
||||
if (parent)
|
||||
{
|
||||
int len = GetWindowText((HWND)GetHWND(), wxBuffer, 256);
|
||||
wxBuffer[len] = 0;
|
||||
if (parent->GetDefaultItem() == (wxButton*) this)
|
||||
parent->SetDefaultItem(NULL);
|
||||
}
|
||||
|
||||
return wxString(wxBuffer);
|
||||
}
|
||||
|
||||
// Call this repeatedly for several wnds to find the overall size
|
||||
// of the widget.
|
||||
// Call it initially with -1 for all values in rect.
|
||||
// Keep calling for other widgets, and rect will be modified
|
||||
// to calculate largest bounding rectangle.
|
||||
void wxFindMaxSize(WXHWND wnd, RECT *rect)
|
||||
bool wxControl::ProcessCommand(wxCommandEvent& event)
|
||||
{
|
||||
int left = rect->left;
|
||||
int right = rect->right;
|
||||
int top = rect->top;
|
||||
int bottom = rect->bottom;
|
||||
#if WXWIN_COMPATIBILITY
|
||||
if ( m_callback )
|
||||
{
|
||||
(void)(*m_callback)(this, event);
|
||||
|
||||
GetWindowRect((HWND) wnd, rect);
|
||||
|
||||
if (left < 0)
|
||||
return;
|
||||
|
||||
if (left < rect->left)
|
||||
rect->left = left;
|
||||
|
||||
if (right > rect->right)
|
||||
rect->right = right;
|
||||
|
||||
if (top < rect->top)
|
||||
rect->top = top;
|
||||
|
||||
if (bottom > rect->bottom)
|
||||
rect->bottom = bottom;
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
#endif // WXWIN_COMPATIBILITY
|
||||
|
||||
return GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
|
||||
#ifdef __WIN95__
|
||||
@@ -168,70 +131,57 @@ bool wxControl::MSWOnNotify(int idCtrl,
|
||||
}
|
||||
#endif // Win95
|
||||
|
||||
void wxControl::ProcessCommand (wxCommandEvent & event)
|
||||
{
|
||||
// Tries:
|
||||
// 1) A callback function (to become obsolete)
|
||||
// 2) OnCommand, starting at this window and working up parent hierarchy
|
||||
// 3) OnCommand then calls ProcessEvent to search the event tables.
|
||||
if (m_callback)
|
||||
{
|
||||
(void) (*(m_callback)) (*this, event);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetEventHandler()->OnCommand(*this, event);
|
||||
}
|
||||
}
|
||||
|
||||
void wxControl::OnEraseBackground(wxEraseEvent& event)
|
||||
{
|
||||
// In general, you don't want to erase the background of a control,
|
||||
// or you'll get a flicker.
|
||||
// TODO: move this 'null' function into each control that
|
||||
// might flicker.
|
||||
// In general, you don't want to erase the background of a control,
|
||||
// or you'll get a flicker.
|
||||
// TODO: move this 'null' function into each control that
|
||||
// might flicker.
|
||||
|
||||
RECT rect;
|
||||
::GetClientRect((HWND) GetHWND(), &rect);
|
||||
RECT rect;
|
||||
::GetClientRect((HWND) GetHWND(), &rect);
|
||||
|
||||
HBRUSH hBrush = ::CreateSolidBrush(PALETTERGB(GetBackgroundColour().Red(), GetBackgroundColour().Green(), GetBackgroundColour().Blue()));
|
||||
int mode = ::SetMapMode((HDC) event.GetDC()->GetHDC(), MM_TEXT);
|
||||
HBRUSH hBrush = ::CreateSolidBrush(PALETTERGB(GetBackgroundColour().Red(),
|
||||
GetBackgroundColour().Green(),
|
||||
GetBackgroundColour().Blue()));
|
||||
int mode = ::SetMapMode((HDC) event.GetDC()->GetHDC(), MM_TEXT);
|
||||
|
||||
::FillRect ((HDC) event.GetDC()->GetHDC(), &rect, hBrush);
|
||||
::DeleteObject(hBrush);
|
||||
::SetMapMode((HDC) event.GetDC()->GetHDC(), mode);
|
||||
::FillRect ((HDC) event.GetDC()->GetHDC(), &rect, hBrush);
|
||||
::DeleteObject(hBrush);
|
||||
::SetMapMode((HDC) event.GetDC()->GetHDC(), mode);
|
||||
}
|
||||
|
||||
void wxControl::SetClientSize (int width, int height)
|
||||
// ---------------------------------------------------------------------------
|
||||
// global functions
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// Call this repeatedly for several wnds to find the overall size
|
||||
// of the widget.
|
||||
// Call it initially with -1 for all values in rect.
|
||||
// Keep calling for other widgets, and rect will be modified
|
||||
// to calculate largest bounding rectangle.
|
||||
void wxFindMaxSize(WXHWND wnd, RECT *rect)
|
||||
{
|
||||
SetSize (-1, -1, width, height);
|
||||
int left = rect->left;
|
||||
int right = rect->right;
|
||||
int top = rect->top;
|
||||
int bottom = rect->bottom;
|
||||
|
||||
GetWindowRect((HWND) wnd, rect);
|
||||
|
||||
if (left < 0)
|
||||
return;
|
||||
|
||||
if (left < rect->left)
|
||||
rect->left = left;
|
||||
|
||||
if (right > rect->right)
|
||||
rect->right = right;
|
||||
|
||||
if (top < rect->top)
|
||||
rect->top = top;
|
||||
|
||||
if (bottom > rect->bottom)
|
||||
rect->bottom = bottom;
|
||||
}
|
||||
|
||||
void wxControl::Centre (int direction)
|
||||
{
|
||||
int x, y, width, height, panel_width, panel_height, new_x, new_y;
|
||||
|
||||
wxWindow *parent = (wxWindow *) GetParent ();
|
||||
if (!parent)
|
||||
return;
|
||||
|
||||
parent->GetClientSize (&panel_width, &panel_height);
|
||||
GetSize (&width, &height);
|
||||
GetPosition (&x, &y);
|
||||
|
||||
new_x = x;
|
||||
new_y = y;
|
||||
|
||||
if (direction & wxHORIZONTAL)
|
||||
new_x = (int) ((panel_width - width) / 2);
|
||||
|
||||
if (direction & wxVERTICAL)
|
||||
new_y = (int) ((panel_height - height) / 2);
|
||||
|
||||
SetSize (new_x, new_y, width, height);
|
||||
int temp_x, temp_y;
|
||||
GetPosition (&temp_x, &temp_y);
|
||||
GetPosition (&temp_x, &temp_y);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -669,7 +669,6 @@ END_EVENT_TABLE()
|
||||
BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
|
||||
EVT_CHAR(wxTextCtrl::OnChar)
|
||||
EVT_DROP_FILES(wxTextCtrl::OnDropFiles)
|
||||
EVT_ERASE_BACKGROUND(wxTextCtrl::OnEraseBackground)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
#ifdef __WXMSW__
|
||||
|
@@ -52,18 +52,6 @@
|
||||
#include <print.h>
|
||||
#endif
|
||||
|
||||
#ifdef DrawText
|
||||
#undef DrawText
|
||||
#endif
|
||||
|
||||
#ifdef GetCharWidth
|
||||
#undef GetCharWidth
|
||||
#endif
|
||||
|
||||
#ifdef StartDoc
|
||||
#undef StartDoc
|
||||
#endif
|
||||
|
||||
#if !USE_SHARED_LIBRARY
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject)
|
||||
#endif
|
||||
@@ -72,14 +60,63 @@
|
||||
// constants
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#define VIEWPORT_EXTENT 1000
|
||||
static const int VIEWPORT_EXTENT = 1000;
|
||||
|
||||
static const int MM_POINTS = 9;
|
||||
static const int MM_METRIC = 10;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// macros
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// Logical to device
|
||||
// Absolute
|
||||
#define XLOG2DEV(x) (x)
|
||||
#define YLOG2DEV(y) (y)
|
||||
|
||||
// Relative
|
||||
#define XLOG2DEVREL(x) (x)
|
||||
#define YLOG2DEVREL(y) (y)
|
||||
|
||||
// Device to logical
|
||||
// Absolute
|
||||
#define XDEV2LOG(x) (x)
|
||||
|
||||
#define YDEV2LOG(y) (y)
|
||||
|
||||
// Relative
|
||||
#define XDEV2LOGREL(x) (x)
|
||||
#define YDEV2LOGREL(y) (y)
|
||||
|
||||
/*
|
||||
* Have the same macros as for XView but not for every operation:
|
||||
* just for calculating window/viewport extent (a better way of scaling).
|
||||
*/
|
||||
|
||||
// Logical to device
|
||||
// Absolute
|
||||
#define MS_XLOG2DEV(x) LogicalToDevice(x)
|
||||
|
||||
#define MS_YLOG2DEV(y) LogicalToDevice(y)
|
||||
|
||||
// Relative
|
||||
#define MS_XLOG2DEVREL(x) LogicalToDeviceXRel(x)
|
||||
#define MS_YLOG2DEVREL(y) LogicalToDeviceYRel(y)
|
||||
|
||||
// Device to logical
|
||||
// Absolute
|
||||
#define MS_XDEV2LOG(x) DeviceToLogicalX(x)
|
||||
|
||||
#define MS_YDEV2LOG(y) DeviceToLogicalY(y)
|
||||
|
||||
// Relative
|
||||
#define MS_XDEV2LOGREL(x) DeviceToLogicalXRel(x)
|
||||
#define MS_YDEV2LOGREL(y) DeviceToLogicalYRel(y)
|
||||
|
||||
#define YSCALE(y) (yorigin - (y))
|
||||
|
||||
#define wx_round(a) (int)((a)+.5)
|
||||
|
||||
// ===========================================================================
|
||||
// implementation
|
||||
// ===========================================================================
|
||||
|
@@ -27,7 +27,7 @@
|
||||
#include "wx/log.h"
|
||||
#include "math.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include "wx/msw/private.h"
|
||||
|
||||
#if wxUSE_COMMON_DIALOGS
|
||||
#include <commdlg.h>
|
||||
@@ -37,18 +37,6 @@
|
||||
#include <print.h>
|
||||
#endif
|
||||
|
||||
#ifdef DrawText
|
||||
#undef DrawText
|
||||
#endif
|
||||
|
||||
#ifdef GetCharWidth
|
||||
#undef GetCharWidth
|
||||
#endif
|
||||
|
||||
#ifdef StartDoc
|
||||
#undef StartDoc
|
||||
#endif
|
||||
|
||||
#if !USE_SHARED_LIBRARY
|
||||
IMPLEMENT_CLASS(wxPrinterDC, wxDC)
|
||||
#endif
|
||||
|
@@ -627,3 +627,27 @@ void wxDialog::OnSysColourChanged(wxSysColourChangedEvent& event)
|
||||
Refresh();
|
||||
#endif
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// dialog window proc
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
long wxDialog::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
||||
{
|
||||
long rc = 0;
|
||||
bool processed = FALSE;
|
||||
|
||||
switch ( message )
|
||||
{
|
||||
case WM_CLOSE:
|
||||
// if we can't close, tell the system that we processed the
|
||||
// message - otherwise it would close us
|
||||
processed = !Close();
|
||||
break;
|
||||
}
|
||||
|
||||
if ( !processed )
|
||||
rc = wxWindow::MSWWindowProc(message, wParam, lParam);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
@@ -37,10 +37,6 @@
|
||||
#include "wx/menuitem.h"
|
||||
#include "wx/log.h"
|
||||
|
||||
#ifdef LoadAccelerators
|
||||
#undef LoadAccelerators
|
||||
#endif
|
||||
|
||||
#if wxUSE_NATIVE_STATUSBAR
|
||||
#include <wx/msw/statbr95.h>
|
||||
#endif
|
||||
@@ -94,7 +90,6 @@ bool wxFrame::Create(wxWindow *parent,
|
||||
wxTopLevelWindows.Append(this);
|
||||
|
||||
SetName(name);
|
||||
// m_modalShowing = FALSE;
|
||||
m_windowStyle = style;
|
||||
m_frameMenuBar = NULL;
|
||||
m_frameToolBar = NULL ;
|
||||
@@ -163,16 +158,11 @@ wxFrame::~wxFrame()
|
||||
::BringWindowToTop((HWND) GetParent()->GetHWND());
|
||||
}
|
||||
|
||||
WXHMENU wxFrame::GetWinMenu() const
|
||||
{
|
||||
return m_hMenu;
|
||||
}
|
||||
|
||||
// Get size *available for subwindows* i.e. excluding menu bar, toolbar etc.
|
||||
void wxFrame::DoGetClientSize(int *x, int *y) const
|
||||
{
|
||||
RECT rect;
|
||||
::GetClientRect((HWND) GetHWND(), &rect);
|
||||
::GetClientRect(GetHwnd(), &rect);
|
||||
|
||||
if ( GetStatusBar() )
|
||||
{
|
||||
@@ -193,7 +183,7 @@ void wxFrame::DoGetClientSize(int *x, int *y) const
|
||||
// to wxWindows)
|
||||
void wxFrame::DoSetClientSize(int width, int height)
|
||||
{
|
||||
HWND hWnd = (HWND) GetHWND();
|
||||
HWND hWnd = GetHwnd();
|
||||
|
||||
RECT rect;
|
||||
::GetClientRect(hWnd, &rect);
|
||||
@@ -232,7 +222,7 @@ void wxFrame::DoSetClientSize(int width, int height)
|
||||
void wxFrame::DoGetSize(int *width, int *height) const
|
||||
{
|
||||
RECT rect;
|
||||
GetWindowRect((HWND) GetHWND(), &rect);
|
||||
GetWindowRect(GetHwnd(), &rect);
|
||||
*width = rect.right - rect.left;
|
||||
*height = rect.bottom - rect.top;
|
||||
}
|
||||
@@ -240,7 +230,7 @@ void wxFrame::DoGetSize(int *width, int *height) const
|
||||
void wxFrame::DoGetPosition(int *x, int *y) const
|
||||
{
|
||||
RECT rect;
|
||||
GetWindowRect((HWND) GetHWND(), &rect);
|
||||
GetWindowRect(GetHwnd(), &rect);
|
||||
POINT point;
|
||||
point.x = rect.left;
|
||||
point.y = rect.top;
|
||||
@@ -268,7 +258,7 @@ void wxFrame::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
if (width == -1) w1 = ww ;
|
||||
if (height==-1) h1 = hh ;
|
||||
|
||||
MoveWindow((HWND) GetHWND(), x1, y1, w1, h1, (BOOL)TRUE);
|
||||
MoveWindow(GetHwnd(), x1, y1, w1, h1, (BOOL)TRUE);
|
||||
|
||||
wxSizeEvent event(wxSize(width, height), m_windowId);
|
||||
event.SetEventObject( this );
|
||||
@@ -295,10 +285,10 @@ bool wxFrame::Show(bool show)
|
||||
}
|
||||
}
|
||||
|
||||
ShowWindow((HWND) GetHWND(), (BOOL)cshow);
|
||||
ShowWindow(GetHwnd(), (BOOL)cshow);
|
||||
if (show)
|
||||
{
|
||||
BringWindowToTop((HWND) GetHWND());
|
||||
BringWindowToTop(GetHwnd());
|
||||
|
||||
wxActivateEvent event(wxEVT_ACTIVATE, TRUE, m_windowId);
|
||||
event.SetEventObject( this );
|
||||
@@ -317,7 +307,7 @@ void wxFrame::Iconize(bool iconize)
|
||||
cshow = SW_MINIMIZE;
|
||||
else
|
||||
cshow = SW_RESTORE;
|
||||
ShowWindow((HWND) GetHWND(), (BOOL)cshow);
|
||||
ShowWindow(GetHwnd(), (BOOL)cshow);
|
||||
m_iconized = iconize;
|
||||
}
|
||||
|
||||
@@ -330,31 +320,20 @@ void wxFrame::Maximize(bool maximize)
|
||||
cshow = SW_MAXIMIZE;
|
||||
else
|
||||
cshow = SW_RESTORE;
|
||||
ShowWindow((HWND) GetHWND(), cshow);
|
||||
ShowWindow(GetHwnd(), cshow);
|
||||
m_iconized = FALSE;
|
||||
}
|
||||
|
||||
bool wxFrame::IsIconized() const
|
||||
{
|
||||
((wxFrame *)this)->m_iconized = (::IsIconic((HWND) GetHWND()) != 0);
|
||||
((wxFrame *)this)->m_iconized = (::IsIconic(GetHwnd()) != 0);
|
||||
return m_iconized;
|
||||
}
|
||||
|
||||
// Is it maximized?
|
||||
bool wxFrame::IsMaximized() const
|
||||
{
|
||||
return (::IsZoomed((HWND) GetHWND()) != 0) ;
|
||||
}
|
||||
|
||||
void wxFrame::SetTitle(const wxString& title)
|
||||
{
|
||||
SetWindowText((HWND) GetHWND(), (const char *)title);
|
||||
}
|
||||
|
||||
wxString wxFrame::GetTitle() const
|
||||
{
|
||||
GetWindowText((HWND) GetHWND(), wxBuffer, 1000);
|
||||
return wxString(wxBuffer);
|
||||
return (::IsZoomed(GetHwnd()) != 0) ;
|
||||
}
|
||||
|
||||
void wxFrame::SetIcon(const wxIcon& icon)
|
||||
@@ -362,7 +341,7 @@ void wxFrame::SetIcon(const wxIcon& icon)
|
||||
m_icon = icon;
|
||||
#if defined(__WIN95__)
|
||||
if ( m_icon.Ok() )
|
||||
SendMessage((HWND) GetHWND(), WM_SETICON,
|
||||
SendMessage(GetHwnd(), WM_SETICON,
|
||||
(WPARAM)TRUE, (LPARAM)(HICON) m_icon.GetHICON());
|
||||
#endif
|
||||
}
|
||||
@@ -470,64 +449,18 @@ void wxFrame::SetMenuBar(wxMenuBar *menu_bar)
|
||||
if ( !m_hMenu )
|
||||
return;
|
||||
|
||||
if ( !::SetMenu((HWND)GetHWND(), (HMENU)m_hMenu) )
|
||||
{
|
||||
wxLogLastError("SetMenu");
|
||||
}
|
||||
InternalSetMenuBar();
|
||||
|
||||
m_frameMenuBar = menu_bar;
|
||||
menu_bar->Attach(this);
|
||||
}
|
||||
|
||||
#if 0
|
||||
bool wxFrame::LoadAccelerators(const wxString& table)
|
||||
void wxFrame::InternalSetMenuBar()
|
||||
{
|
||||
m_acceleratorTable = (WXHANDLE)
|
||||
#ifdef __WIN32__
|
||||
#ifdef UNICODE
|
||||
::LoadAcceleratorsW(wxGetInstance(), (const char *)table);
|
||||
#else
|
||||
::LoadAcceleratorsA(wxGetInstance(), (const char *)table);
|
||||
#endif
|
||||
#else
|
||||
::LoadAccelerators(wxGetInstance(), (const char *)table);
|
||||
#endif
|
||||
|
||||
// The above is necessary because LoadAccelerators is a macro
|
||||
// which we have undefed earlier in the file to avoid confusion
|
||||
// with wxFrame::LoadAccelerators. Ugh!
|
||||
|
||||
return (m_acceleratorTable != (WXHANDLE) NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
void wxFrame::Fit()
|
||||
{
|
||||
// Work out max. size
|
||||
wxNode *node = GetChildren().First();
|
||||
int max_width = 0;
|
||||
int max_height = 0;
|
||||
while (node)
|
||||
{
|
||||
// Find a child that's a subwindow, but not a dialog box.
|
||||
wxWindow *win = (wxWindow *)node->Data();
|
||||
|
||||
if (!win->IsKindOf(CLASSINFO(wxFrame)) &&
|
||||
!win->IsKindOf(CLASSINFO(wxDialog)))
|
||||
if ( !::SetMenu(GetHwnd(), (HMENU)m_hMenu) )
|
||||
{
|
||||
int width, height;
|
||||
int x, y;
|
||||
win->GetSize(&width, &height);
|
||||
win->GetPosition(&x, &y);
|
||||
|
||||
if ((x + width) > max_width)
|
||||
max_width = x + width;
|
||||
if ((y + height) > max_height)
|
||||
max_height = y + height;
|
||||
wxLogLastError("SetMenu");
|
||||
}
|
||||
node = node->Next();
|
||||
}
|
||||
SetClientSize(max_width, max_height);
|
||||
}
|
||||
|
||||
// Responds to colour changes, and passes event on to children.
|
||||
@@ -618,162 +551,11 @@ bool wxFrame::MSWCreate(int id, wxWindow *parent, const char *wclass, wxWindow *
|
||||
// Seems to be necessary if we use WS_POPUP
|
||||
// style instead of WS_OVERLAPPED
|
||||
if (width > -1 && height > -1)
|
||||
::PostMessage((HWND) GetHWND(), WM_SIZE, SIZE_RESTORED, MAKELPARAM(width, height));
|
||||
::PostMessage(GetHwnd(), WM_SIZE, SIZE_RESTORED, MAKELPARAM(width, height));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxFrame::MSWOnPaint()
|
||||
{
|
||||
RECT rect;
|
||||
if (GetUpdateRect((HWND) GetHWND(), &rect, FALSE))
|
||||
{
|
||||
if (m_iconized)
|
||||
{
|
||||
HICON the_icon;
|
||||
if (m_icon.Ok())
|
||||
the_icon = (HICON) m_icon.GetHICON();
|
||||
else
|
||||
the_icon = (HICON) m_defaultIcon;
|
||||
|
||||
PAINTSTRUCT ps;
|
||||
// Hold a pointer to the dc so long as the OnPaint() message
|
||||
// is being processed
|
||||
HDC cdc = BeginPaint((HWND) GetHWND(), &ps);
|
||||
|
||||
// Erase background before painting or we get white background
|
||||
this->MSWDefWindowProc(WM_ICONERASEBKGND,(WORD)(LONG) ps.hdc,0L);
|
||||
|
||||
if (the_icon)
|
||||
{
|
||||
RECT rect;
|
||||
::GetClientRect((HWND) GetHWND(), &rect);
|
||||
int icon_width = 32;
|
||||
int icon_height = 32;
|
||||
int icon_x = (int)((rect.right - icon_width)/2);
|
||||
int icon_y = (int)((rect.bottom - icon_height)/2);
|
||||
DrawIcon(cdc, icon_x, icon_y, the_icon);
|
||||
}
|
||||
|
||||
EndPaint((HWND) GetHWND(), &ps);
|
||||
}
|
||||
else
|
||||
{
|
||||
wxPaintEvent event(m_windowId);
|
||||
event.m_eventObject = this;
|
||||
if (!GetEventHandler()->ProcessEvent(event))
|
||||
Default();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
WXHICON wxFrame::MSWOnQueryDragIcon()
|
||||
{
|
||||
if (m_icon.Ok() && (m_icon.GetHICON() != 0))
|
||||
return m_icon.GetHICON();
|
||||
else
|
||||
return m_defaultIcon;
|
||||
}
|
||||
|
||||
bool wxFrame::MSWOnSize(int x, int y, WXUINT id)
|
||||
{
|
||||
bool processed = FALSE;
|
||||
|
||||
switch ( id )
|
||||
{
|
||||
case SIZENORMAL:
|
||||
// only do it it if we were iconized before, otherwise resizing the
|
||||
// parent frame has a curious side effect of bringing it under it's
|
||||
// children
|
||||
if ( !m_iconized )
|
||||
break;
|
||||
|
||||
// restore all child frames too
|
||||
IconizeChildFrames(FALSE);
|
||||
|
||||
// fall through
|
||||
|
||||
case SIZEFULLSCREEN:
|
||||
m_iconized = FALSE;
|
||||
break;
|
||||
|
||||
case SIZEICONIC:
|
||||
// iconize all child frames too
|
||||
IconizeChildFrames(TRUE);
|
||||
|
||||
m_iconized = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( !m_iconized )
|
||||
{
|
||||
// forward WM_SIZE to status bar control
|
||||
#if wxUSE_NATIVE_STATUSBAR
|
||||
if (m_frameStatusBar && m_frameStatusBar->IsKindOf(CLASSINFO(wxStatusBar95)))
|
||||
{
|
||||
wxSizeEvent event(wxSize(x, y), m_frameStatusBar->GetId());
|
||||
event.SetEventObject( m_frameStatusBar );
|
||||
|
||||
((wxStatusBar95 *)m_frameStatusBar)->OnSize(event);
|
||||
}
|
||||
#endif // wxUSE_NATIVE_STATUSBAR
|
||||
|
||||
PositionStatusBar();
|
||||
PositionToolBar();
|
||||
|
||||
wxSizeEvent event(wxSize(x, y), m_windowId);
|
||||
event.SetEventObject( this );
|
||||
processed = GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
|
||||
return processed;
|
||||
}
|
||||
|
||||
bool wxFrame::MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control)
|
||||
{
|
||||
if (cmd == 0 || cmd == 1 ) // Can be either a menu command or an accelerator.
|
||||
{
|
||||
// In case it's e.g. a toolbar.
|
||||
wxWindow *win = wxFindWinFromHandle(control);
|
||||
if (win)
|
||||
return win->MSWCommand(cmd, id);
|
||||
|
||||
if (wxCurrentPopupMenu)
|
||||
{
|
||||
wxMenu *popupMenu = wxCurrentPopupMenu;
|
||||
wxCurrentPopupMenu = NULL;
|
||||
if (popupMenu->MSWCommand(cmd, id))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (GetMenuBar() && GetMenuBar()->FindItemForId(id))
|
||||
{
|
||||
ProcessCommand(id);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
return wxWindow::MSWOnCommand(id, cmd, control);
|
||||
}
|
||||
|
||||
bool wxFrame::MSWProcessMessage(WXMSG* 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;
|
||||
}
|
||||
|
||||
// Default resizing behaviour - if only ONE subwindow, resize to client
|
||||
// rectangle size
|
||||
void wxFrame::OnSize(wxSizeEvent& event)
|
||||
@@ -835,7 +617,7 @@ void wxFrame::OnActivate(wxActivateEvent& event)
|
||||
// The default implementation for the close window event.
|
||||
void wxFrame::OnCloseWindow(wxCloseEvent& event)
|
||||
{
|
||||
this->Destroy();
|
||||
Destroy();
|
||||
}
|
||||
|
||||
// Destroy the window (delayed, if a managed window)
|
||||
@@ -871,53 +653,26 @@ wxMenuBar *wxFrame::GetMenuBar() const
|
||||
return m_frameMenuBar;
|
||||
}
|
||||
|
||||
void wxFrame::Centre(int direction)
|
||||
bool wxFrame::ProcessCommand(int id)
|
||||
{
|
||||
int display_width, display_height, width, height, x, y;
|
||||
wxDisplaySize(&display_width, &display_height);
|
||||
wxMenuBar *bar = GetMenuBar() ;
|
||||
if ( !bar )
|
||||
return FALSE;
|
||||
|
||||
GetSize(&width, &height);
|
||||
GetPosition(&x, &y);
|
||||
wxMenuItem *item = bar->FindItemForId(id);
|
||||
if ( !item )
|
||||
return FALSE;
|
||||
|
||||
if (direction & wxHORIZONTAL)
|
||||
x = (int)((display_width - width)/2);
|
||||
if (direction & wxVERTICAL)
|
||||
y = (int)((display_height - height)/2);
|
||||
if ( item->IsCheckable() )
|
||||
{
|
||||
bar->Check(id, !bar->IsChecked(id)) ;
|
||||
}
|
||||
|
||||
SetSize(x, y, width, height);
|
||||
}
|
||||
wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, id);
|
||||
commandEvent.SetInt( id );
|
||||
commandEvent.SetEventObject( this );
|
||||
|
||||
// Call this to simulate a menu command
|
||||
void wxFrame::Command(int id)
|
||||
{
|
||||
ProcessCommand(id);
|
||||
}
|
||||
|
||||
void wxFrame::ProcessCommand(int id)
|
||||
{
|
||||
wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, id);
|
||||
commandEvent.SetInt( id );
|
||||
commandEvent.SetEventObject( this );
|
||||
|
||||
wxMenuBar *bar = GetMenuBar() ;
|
||||
if (!bar)
|
||||
return;
|
||||
|
||||
wxMenuItem *item = bar->FindItemForId(id) ;
|
||||
if (item && item->IsCheckable())
|
||||
{
|
||||
bar->Check(id,!bar->Checked(id)) ;
|
||||
}
|
||||
|
||||
/*
|
||||
// Process events starting with the window with the focus, if any.
|
||||
wxWindow* focusWin = wxFindFocusDescendant(this);
|
||||
|
||||
wxEvtHandler* evtHandler = focusWin ? focusWin->GetEventHandler() : GetEventHandler();
|
||||
*/
|
||||
|
||||
wxEvtHandler* evtHandler = GetEventHandler();
|
||||
evtHandler->ProcessEvent(commandEvent);
|
||||
return GetEventHandler()->ProcessEvent(commandEvent);
|
||||
}
|
||||
|
||||
// Checks if there is a toolbar, and returns the first free client position
|
||||
@@ -968,7 +723,7 @@ void wxFrame::ClientToScreen(int *x, int *y) const
|
||||
wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
|
||||
{
|
||||
wxCHECK_MSG( m_frameToolBar == NULL, FALSE,
|
||||
"recreating toolbar in wxFrame" );
|
||||
"recreating toolbar in wxFrame" );
|
||||
|
||||
wxToolBar* toolBar = OnCreateToolBar(style, id, name);
|
||||
if (toolBar)
|
||||
@@ -991,7 +746,7 @@ wxToolBar* wxFrame::OnCreateToolBar(long style, wxWindowID id, const wxString& n
|
||||
void wxFrame::PositionToolBar()
|
||||
{
|
||||
RECT rect;
|
||||
::GetClientRect((HWND) GetHWND(), &rect);
|
||||
::GetClientRect(GetHwnd(), &rect);
|
||||
|
||||
if ( GetStatusBar() )
|
||||
{
|
||||
@@ -1037,9 +792,170 @@ void wxFrame::IconizeChildFrames(bool bIconize)
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
// our private (non virtual) message handlers
|
||||
// message processing
|
||||
// ===========================================================================
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// preprocessing
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
bool wxFrame::MSWTranslateMessage(WXMSG* pMsg)
|
||||
{
|
||||
if ( wxWindow::MSWTranslateMessage(pMsg) )
|
||||
return TRUE;
|
||||
|
||||
// try the menu bar accels
|
||||
wxMenuBar *menuBar = GetMenuBar();
|
||||
if ( !menuBar )
|
||||
return FALSE;
|
||||
|
||||
const wxAcceleratorTable& acceleratorTable = menuBar->GetAccelTable();
|
||||
return acceleratorTable.Ok() &&
|
||||
::TranslateAccelerator(GetHwnd(),
|
||||
GetTableHaccel(acceleratorTable),
|
||||
(MSG *)pMsg);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// our private (non virtual) message handlers
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
bool wxFrame::HandlePaint()
|
||||
{
|
||||
RECT rect;
|
||||
if ( GetUpdateRect(GetHwnd(), &rect, FALSE) )
|
||||
{
|
||||
if ( m_iconized )
|
||||
{
|
||||
HICON hIcon = m_icon.Ok() ? GetIconHicon(m_icon)
|
||||
: (HICON)m_defaultIcon;
|
||||
|
||||
// Hold a pointer to the dc so long as the OnPaint() message
|
||||
// is being processed
|
||||
PAINTSTRUCT ps;
|
||||
HDC hdc = ::BeginPaint(GetHwnd(), &ps);
|
||||
|
||||
// Erase background before painting or we get white background
|
||||
MSWDefWindowProc(WM_ICONERASEBKGND, (WORD)(LONG)ps.hdc, 0L);
|
||||
|
||||
if ( hIcon )
|
||||
{
|
||||
RECT rect;
|
||||
::GetClientRect(GetHwnd(), &rect);
|
||||
|
||||
// FIXME: why hardcoded?
|
||||
static const int icon_width = 32;
|
||||
static const int icon_height = 32;
|
||||
|
||||
int icon_x = (int)((rect.right - icon_width)/2);
|
||||
int icon_y = (int)((rect.bottom - icon_height)/2);
|
||||
|
||||
::DrawIcon(hdc, icon_x, icon_y, hIcon);
|
||||
}
|
||||
|
||||
::EndPaint(GetHwnd(), &ps);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
wxPaintEvent event(m_windowId);
|
||||
event.m_eventObject = this;
|
||||
|
||||
return GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// nothing to paint - processed
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
bool wxFrame::HandleSize(int x, int y, WXUINT id)
|
||||
{
|
||||
bool processed = FALSE;
|
||||
|
||||
switch ( id )
|
||||
{
|
||||
case SIZENORMAL:
|
||||
// only do it it if we were iconized before, otherwise resizing the
|
||||
// parent frame has a curious side effect of bringing it under it's
|
||||
// children
|
||||
if ( !m_iconized )
|
||||
break;
|
||||
|
||||
// restore all child frames too
|
||||
IconizeChildFrames(FALSE);
|
||||
|
||||
// fall through
|
||||
|
||||
case SIZEFULLSCREEN:
|
||||
m_iconized = FALSE;
|
||||
break;
|
||||
|
||||
case SIZEICONIC:
|
||||
// iconize all child frames too
|
||||
IconizeChildFrames(TRUE);
|
||||
|
||||
m_iconized = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( !m_iconized )
|
||||
{
|
||||
// forward WM_SIZE to status bar control
|
||||
#if wxUSE_NATIVE_STATUSBAR
|
||||
if (m_frameStatusBar && m_frameStatusBar->IsKindOf(CLASSINFO(wxStatusBar95)))
|
||||
{
|
||||
wxSizeEvent event(wxSize(x, y), m_frameStatusBar->GetId());
|
||||
event.SetEventObject( m_frameStatusBar );
|
||||
|
||||
((wxStatusBar95 *)m_frameStatusBar)->OnSize(event);
|
||||
}
|
||||
#endif // wxUSE_NATIVE_STATUSBAR
|
||||
|
||||
PositionStatusBar();
|
||||
PositionToolBar();
|
||||
|
||||
wxSizeEvent event(wxSize(x, y), m_windowId);
|
||||
event.SetEventObject( this );
|
||||
processed = GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
|
||||
return processed;
|
||||
}
|
||||
|
||||
bool wxFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control)
|
||||
{
|
||||
if ( control )
|
||||
{
|
||||
// In case it's e.g. a toolbar.
|
||||
wxWindow *win = wxFindWinFromHandle(control);
|
||||
if ( win )
|
||||
return win->MSWCommand(cmd, id);
|
||||
}
|
||||
|
||||
// handle here commands from menus and accelerators
|
||||
if ( cmd == 0 || cmd == 1 )
|
||||
{
|
||||
if ( wxCurrentPopupMenu )
|
||||
{
|
||||
wxMenu *popupMenu = wxCurrentPopupMenu;
|
||||
wxCurrentPopupMenu = NULL;
|
||||
|
||||
return popupMenu->MSWCommand(cmd, id);
|
||||
}
|
||||
|
||||
if ( ProcessCommand(id) )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxFrame::HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu)
|
||||
{
|
||||
int item;
|
||||
@@ -1074,19 +990,49 @@ long wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
||||
|
||||
switch ( message )
|
||||
{
|
||||
case WM_CLOSE:
|
||||
// if we can't close, tell the system that we processed the
|
||||
// message - otherwise it would close us
|
||||
processed = !Close();
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
{
|
||||
WORD id, cmd;
|
||||
WXHWND hwnd;
|
||||
UnpackCommand((WXWPARAM)wParam, (WXLPARAM)lParam,
|
||||
&id, &hwnd, &cmd);
|
||||
|
||||
processed = HandleCommand(id, cmd, (WXHWND)hwnd);
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_MENUSELECT:
|
||||
{
|
||||
WORD item = (WORD)wParam;
|
||||
#ifdef __WIN32__
|
||||
WORD flags = HIWORD(wParam);
|
||||
HMENU sysmenu = (HMENU)lParam;
|
||||
#else
|
||||
WORD flags = LOWORD(lParam);
|
||||
HMENU sysmenu = (HMENU)HIWORD(lParam);
|
||||
#endif
|
||||
processed = HandleMenuSelect(item, flags, (WXHMENU)sysmenu);
|
||||
WXWORD item, flags;
|
||||
WXHMENU hmenu;
|
||||
UnpackMenuSelect(wParam, lParam, &item, &flags, &hmenu);
|
||||
|
||||
processed = HandleMenuSelect(item, flags, hmenu);
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_PAINT:
|
||||
processed = HandlePaint();
|
||||
break;
|
||||
|
||||
case WM_QUERYDRAGICON:
|
||||
{
|
||||
HICON hIcon = m_icon.Ok() ? GetIconHicon(m_icon)
|
||||
: (HICON)(m_defaultIcon);
|
||||
rc = (long)hIcon;
|
||||
processed = rc != 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_SIZE:
|
||||
processed = HandleSize(LOWORD(lParam), HIWORD(lParam), wParam);
|
||||
break;
|
||||
}
|
||||
|
||||
if ( !processed )
|
||||
|
@@ -39,10 +39,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef GetCharWidth
|
||||
#undef GetCharWidth
|
||||
#endif
|
||||
|
||||
#if wxUSE_OWNER_DRAWN
|
||||
#include "wx/ownerdrw.h"
|
||||
#endif
|
||||
@@ -165,7 +161,8 @@ bool wxListBox::Create(wxWindow *parent,
|
||||
int height = size.y;
|
||||
m_windowStyle = style;
|
||||
|
||||
DWORD wstyle = WS_VSCROLL | WS_TABSTOP | LBS_NOTIFY | LBS_HASSTRINGS;
|
||||
DWORD wstyle = WS_VISIBLE | WS_VSCROLL | WS_TABSTOP |
|
||||
LBS_NOTIFY | LBS_HASSTRINGS;
|
||||
if (m_windowStyle & wxLB_MULTIPLE)
|
||||
wstyle |= LBS_MULTIPLESEL;
|
||||
else if (m_windowStyle & wxLB_EXTENDED)
|
||||
|
965
src/msw/mdi.cpp
965
src/msw/mdi.cpp
File diff suppressed because it is too large
Load Diff
136
src/msw/menu.cpp
136
src/msw/menu.cpp
@@ -145,6 +145,67 @@ void wxMenu::Append(wxMenuItem *pItem)
|
||||
{
|
||||
wxCHECK_RET( pItem != NULL, "can't append NULL item to the menu" );
|
||||
|
||||
// check for accelerators: they are given after '\t'
|
||||
wxString label = pItem->GetName();
|
||||
int posTab = label.Find('\t');
|
||||
if ( posTab != wxNOT_FOUND ) {
|
||||
// parse the accelerator string
|
||||
int keyCode = 0;
|
||||
int accelFlags = wxACCEL_NORMAL;
|
||||
wxString current;
|
||||
for ( size_t n = (size_t)posTab + 1; n < label.Len(); n++ ) {
|
||||
if ( (label[n] == '+') || (label[n] == '-') ) {
|
||||
if ( current == _("ctrl") )
|
||||
accelFlags |= wxACCEL_CTRL;
|
||||
else if ( current == _("alt") )
|
||||
accelFlags |= wxACCEL_ALT;
|
||||
else if ( current == _("shift") )
|
||||
accelFlags |= wxACCEL_SHIFT;
|
||||
else {
|
||||
wxLogDebug(_T("Unknown accel modifier: '%s'"),
|
||||
current.c_str());
|
||||
}
|
||||
|
||||
current.Empty();
|
||||
}
|
||||
else {
|
||||
current += wxTolower(label[n]);
|
||||
}
|
||||
}
|
||||
|
||||
if ( current.IsEmpty() ) {
|
||||
wxLogDebug(_T("No accel key found, accel string ignored."));
|
||||
}
|
||||
else {
|
||||
if ( current.Len() == 1 ) {
|
||||
// it's a letter
|
||||
keyCode = wxToupper(current[0]);
|
||||
}
|
||||
else {
|
||||
// it should be a function key
|
||||
if ( current[0] == 'f' && isdigit(current[1]) &&
|
||||
(current.Len() == 2 ||
|
||||
(current.Len() == 3 && isdigit(current[2]))) ) {
|
||||
int n;
|
||||
sscanf(current.c_str() + 1, "%d", &n);
|
||||
|
||||
keyCode = VK_F1 + n - 1;
|
||||
}
|
||||
else {
|
||||
wxLogDebug(_T("Unreckognized accel key '%s', accel "
|
||||
"string ignored."), current.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( keyCode ) {
|
||||
// do add an entry
|
||||
m_accelKeyCodes.Add(keyCode);
|
||||
m_accelFlags.Add(accelFlags);
|
||||
m_accelIds.Add(pItem->GetId());
|
||||
}
|
||||
}
|
||||
|
||||
UINT flags = 0;
|
||||
|
||||
// if "Break" has just been called, insert a menu break before this item
|
||||
@@ -190,13 +251,7 @@ void wxMenu::Append(wxMenuItem *pItem)
|
||||
{
|
||||
// menu is just a normal string (passed in data parameter)
|
||||
flags |= MF_STRING;
|
||||
pData = pItem->GetName();
|
||||
}
|
||||
|
||||
// visually select the menu title
|
||||
if ( id == idMenuTitle )
|
||||
{
|
||||
// TODO use SetMenuItemInfo(MFS_DEFAULT) to put it in bold face
|
||||
pData = label;
|
||||
}
|
||||
|
||||
if ( !::AppendMenu(GetHMENU(), flags, id, pData) )
|
||||
@@ -205,6 +260,22 @@ void wxMenu::Append(wxMenuItem *pItem)
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef __WIN32__
|
||||
if ( id == idMenuTitle )
|
||||
{
|
||||
// visually select the menu title
|
||||
MENUITEMINFO mii;
|
||||
mii.cbSize = sizeof(mii);
|
||||
mii.fMask = MIIM_STATE;
|
||||
mii.fState = MFS_DEFAULT;
|
||||
|
||||
if ( !SetMenuItemInfo(GetHMENU(), (unsigned)id, FALSE, &mii) )
|
||||
{
|
||||
wxLogLastError("SetMenuItemInfo");
|
||||
}
|
||||
}
|
||||
#endif // __WIN32__
|
||||
|
||||
m_menuItems.Append(pItem);
|
||||
m_noItems++;
|
||||
}
|
||||
@@ -272,6 +343,23 @@ void wxMenu::Delete(int id)
|
||||
delete item;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// accelerator helpers
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// create the wxAcceleratorEntries for our accels and put them into provided
|
||||
// array - return the number of accels we have
|
||||
size_t wxMenu::CopyAccels(wxAcceleratorEntry *accels) const
|
||||
{
|
||||
size_t count = GetAccelCount();
|
||||
for ( size_t n = 0; n < count; n++ )
|
||||
{
|
||||
(*accels++).Set(m_accelFlags[n], m_accelKeyCodes[n], m_accelIds[n]);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// wxMenu functions implemented in wxMenuItem
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -395,7 +483,7 @@ void wxMenu::SetTitle(const wxString& label)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef __WIN16__
|
||||
#ifdef __WIN32__
|
||||
// put the title string in bold face
|
||||
if ( !m_title.IsEmpty() )
|
||||
{
|
||||
@@ -438,7 +526,7 @@ bool wxMenu::MSWCommand(WXUINT WXUNUSED(param), WXWORD id)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wxMenu::ProcessCommand(wxCommandEvent & event)
|
||||
bool wxMenu::ProcessCommand(wxCommandEvent & event)
|
||||
{
|
||||
bool processed = FALSE;
|
||||
|
||||
@@ -462,6 +550,8 @@ void wxMenu::ProcessCommand(wxCommandEvent & event)
|
||||
wxWindow *win = GetInvokingWindow();
|
||||
if ( !processed && win )
|
||||
processed = win->GetEventHandler()->ProcessEvent(event);
|
||||
|
||||
return processed;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -917,6 +1007,34 @@ void wxMenuBar::Delete(wxMenu * menu, int i)
|
||||
}
|
||||
}
|
||||
|
||||
void wxMenuBar::Attach(wxFrame *frame)
|
||||
{
|
||||
wxASSERT_MSG( !m_menuBarFrame, _T("menubar already attached!") );
|
||||
|
||||
m_menuBarFrame = frame;
|
||||
|
||||
// create the accel table - we consider that the toolbar construction is
|
||||
// finished
|
||||
size_t nAccelCount = 0;
|
||||
int i;
|
||||
for ( i = 0; i < m_menuCount; i++ )
|
||||
{
|
||||
nAccelCount += m_menus[i]->GetAccelCount();
|
||||
}
|
||||
|
||||
wxAcceleratorEntry *accelEntries = new wxAcceleratorEntry[nAccelCount];
|
||||
|
||||
nAccelCount = 0;
|
||||
for ( i = 0; i < m_menuCount; i++ )
|
||||
{
|
||||
nAccelCount += m_menus[i]->CopyAccels(&accelEntries[nAccelCount]);
|
||||
}
|
||||
|
||||
m_accelTable = wxAcceleratorTable(nAccelCount, accelEntries);
|
||||
|
||||
delete [] accelEntries;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// wxMenuBar searching for menu items
|
||||
// ---------------------------------------------------------------------------
|
||||
|
@@ -40,15 +40,7 @@
|
||||
#include "wx/menuitem.h"
|
||||
#include "wx/log.h"
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#ifdef GetClassInfo
|
||||
#undef GetClassInfo
|
||||
#endif
|
||||
|
||||
#ifdef GetClassName
|
||||
#undef GetClassName
|
||||
#endif
|
||||
#include "wx/msw/private.h"
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// convenience macro
|
||||
|
@@ -202,10 +202,14 @@ void wxMetafileDC::GetTextExtent(const wxString& string, long *x, long *y,
|
||||
|
||||
ReleaseDC(NULL, dc);
|
||||
|
||||
*x = XDEV2LOGREL(sizeRect.cx);
|
||||
*y = YDEV2LOGREL(sizeRect.cy);
|
||||
if (descent) *descent = tm.tmDescent;
|
||||
if (externalLeading) *externalLeading = tm.tmExternalLeading;
|
||||
if ( x )
|
||||
*x = sizeRect.cx;
|
||||
if ( y )
|
||||
*y = sizeRect.cy;
|
||||
if ( descent )
|
||||
*descent = tm.tmDescent;
|
||||
if ( externalLeading )
|
||||
*externalLeading = tm.tmExternalLeading;
|
||||
}
|
||||
|
||||
wxMetafile *wxMetafileDC::Close(void)
|
||||
|
@@ -68,9 +68,10 @@
|
||||
BEGIN_EVENT_TABLE(wxNotebook, wxControl)
|
||||
EVT_NOTEBOOK_PAGE_CHANGED(-1, wxNotebook::OnSelChange)
|
||||
|
||||
EVT_SIZE(wxNotebook::OnSize)
|
||||
EVT_ERASE_BACKGROUND(wxNotebook::OnEraseBackground)
|
||||
EVT_WINDOW_CREATE(wxNotebook::OnWindowCreate)
|
||||
|
||||
EVT_SET_FOCUS(wxNotebook::OnSetFocus)
|
||||
|
||||
EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
@@ -164,7 +165,6 @@ bool wxNotebook::Create(wxWindow *parent,
|
||||
}
|
||||
|
||||
// Not all compilers recognise SetWindowFont
|
||||
// SetWindowFont((HWND)m_hwnd, ::GetStockObject(DEFAULT_GUI_FONT), FALSE);
|
||||
::SendMessage((HWND) m_hwnd, WM_SETFONT,
|
||||
(WPARAM)::GetStockObject(DEFAULT_GUI_FONT),TRUE);
|
||||
|
||||
@@ -272,6 +272,14 @@ void wxNotebook::SetImageList(wxImageList* imageList)
|
||||
TabCtrl_SetImageList(m_hwnd, (HIMAGELIST)imageList->GetHIMAGELIST());
|
||||
}
|
||||
|
||||
|
||||
// Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH
|
||||
// style.
|
||||
void wxNotebook::SetTabSize(const wxSize& sz)
|
||||
{
|
||||
::SendMessage(GetHwnd(), TCM_SETITEMSIZE, 0, MAKELPARAM(sz.x, sz.y));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxNotebook operations
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -371,9 +379,12 @@ bool wxNotebook::InsertPage(int nPage,
|
||||
m_nSelection = 0;
|
||||
|
||||
// don't show pages by default (we'll need to adjust their size first)
|
||||
HWND hwnd = (HWND)pPage->GetHWND();
|
||||
HWND hwnd = GetWinHwnd(pPage);
|
||||
SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_VISIBLE);
|
||||
|
||||
// this updates internal flag too - otherwise it will get out of sync
|
||||
pPage->Show(FALSE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -381,7 +392,7 @@ bool wxNotebook::InsertPage(int nPage,
|
||||
// wxNotebook callbacks
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void wxNotebook::OnSize(wxSizeEvent& event)
|
||||
void wxNotebook::OnWindowCreate(wxWindowCreateEvent& event)
|
||||
{
|
||||
// make sure the current page is shown and has focus (it's useful because all
|
||||
// pages are created invisible initially)
|
||||
@@ -459,11 +470,6 @@ bool wxNotebook::DoPhase(int /* nPhase */)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wxNotebook::Command(wxCommandEvent& event)
|
||||
{
|
||||
wxFAIL_MSG("wxNotebook::Command not implemented");
|
||||
}
|
||||
|
||||
bool wxNotebook::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM* result)
|
||||
{
|
||||
wxNotebookEvent event(wxEVT_NULL, m_windowId);
|
||||
@@ -538,16 +544,3 @@ void wxNotebook::ChangePage(int nOldSel, int nSel)
|
||||
m_nSelection = nSel;
|
||||
s_bInsideChangePage = FALSE;
|
||||
}
|
||||
|
||||
void wxNotebook::OnEraseBackground(wxEraseEvent& event)
|
||||
{
|
||||
Default();
|
||||
}
|
||||
|
||||
// Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH
|
||||
// style.
|
||||
void wxNotebook::SetTabSize(const wxSize& sz)
|
||||
{
|
||||
::SendMessage((HWND) GetHWND(), TCM_SETITEMSIZE, 0, MAKELPARAM(sz.x, sz.y));
|
||||
}
|
||||
|
||||
|
@@ -21,17 +21,16 @@
|
||||
#endif
|
||||
|
||||
#include "wx/log.h"
|
||||
#include "wx/msw/ole/automtn.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include <ole2ver.h>
|
||||
#include <oleauto.h>
|
||||
#include <math.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef GetObject
|
||||
#undef GetObject
|
||||
#endif
|
||||
#include "wx/msw/ole/automtn.h"
|
||||
|
||||
#include "wx/msw/private.h"
|
||||
|
||||
#include <ole2ver.h>
|
||||
#include <oleauto.h>
|
||||
|
||||
// wrapper around BSTR type (by Vadim Zeitlin)
|
||||
|
||||
|
@@ -31,11 +31,7 @@
|
||||
#include "wx/ownerdrw.h"
|
||||
#include "wx/menuitem.h"
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#ifdef DrawText
|
||||
#undef DrawText
|
||||
#endif
|
||||
#include "wx/msw/private.h"
|
||||
|
||||
// ============================================================================
|
||||
// implementation of wxOwnerDrawn class
|
||||
|
@@ -37,18 +37,15 @@
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include "wx/msw/private.h"
|
||||
|
||||
#include <commdlg.h>
|
||||
|
||||
#ifndef __WIN32__
|
||||
#include <print.h>
|
||||
#endif
|
||||
|
||||
// Clash with Windows header files
|
||||
#ifdef StartDoc
|
||||
#undef StartDoc
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// wxWin macros
|
||||
// ---------------------------------------------------------------------------
|
||||
|
@@ -44,13 +44,10 @@
|
||||
#include "wx/msw/private.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <windows.h>
|
||||
#include <commdlg.h>
|
||||
|
||||
// Clash with Windows header files
|
||||
#ifdef StartDoc
|
||||
#undef StartDoc
|
||||
#endif
|
||||
#include "wx/msw/private.h"
|
||||
|
||||
#include <commdlg.h>
|
||||
|
||||
#ifndef __WIN32__
|
||||
#include <print.h>
|
||||
|
@@ -52,16 +52,16 @@ LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hWnd,
|
||||
UINT message,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam);
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// global vars
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// the pointer to standard radio button wnd proc
|
||||
// static WNDPROC s_wndprocRadioBtn = (WNDPROC)NULL;
|
||||
static WXFARPROC s_wndprocRadioBtn = (WXFARPROC)NULL;
|
||||
|
||||
#endif // __WIN32__
|
||||
|
||||
// ===========================================================================
|
||||
// implementation
|
||||
// ===========================================================================
|
||||
@@ -94,9 +94,9 @@ int wxRadioBox::GetNumHor() const
|
||||
}
|
||||
}
|
||||
|
||||
bool wxRadioBox::MSWCommand(WXUINT param, WXWORD id)
|
||||
bool wxRadioBox::MSWCommand(WXUINT cmd, WXWORD id)
|
||||
{
|
||||
if ( param == BN_CLICKED )
|
||||
if ( cmd == BN_CLICKED )
|
||||
{
|
||||
int selectedButton = -1;
|
||||
|
||||
@@ -192,12 +192,6 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
|
||||
|
||||
bool want3D;
|
||||
WXDWORD exStyle = Determine3DEffects(0, &want3D);
|
||||
// Even with extended styles, need to combine with WS_BORDER
|
||||
// for them to look right.
|
||||
/*
|
||||
if ( want3D || wxStyleHasBorder(m_windowStyle) )
|
||||
msStyle |= WS_BORDER;
|
||||
*/
|
||||
|
||||
HWND hwndParent = (HWND)parent->GetHWND();
|
||||
|
||||
@@ -249,6 +243,7 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
|
||||
NULL);
|
||||
|
||||
m_radioButtons[i] = (WXHWND)hwndBtn;
|
||||
|
||||
SubclassRadioButton((WXHWND)hwndBtn);
|
||||
|
||||
wxFont& font = GetFont();
|
||||
@@ -258,7 +253,7 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
|
||||
(WPARAM)font.GetResourceHandle(), 0L);
|
||||
}
|
||||
|
||||
m_subControls.Append((wxObject *)newId);
|
||||
m_subControls.Append((wxObject *)(WXWORD)newId);
|
||||
}
|
||||
|
||||
// Create a dummy radio control to end the group.
|
||||
@@ -281,29 +276,21 @@ wxRadioBox::~wxRadioBox()
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < m_noItems; i++)
|
||||
DestroyWindow((HWND) m_radioButtons[i]);
|
||||
::DestroyWindow((HWND)m_radioButtons[i]);
|
||||
delete[] m_radioButtons;
|
||||
}
|
||||
|
||||
if (m_radioWidth)
|
||||
delete[] m_radioWidth;
|
||||
if (m_radioHeight)
|
||||
delete[] m_radioHeight;
|
||||
if (m_hWnd)
|
||||
::DestroyWindow((HWND) m_hWnd);
|
||||
m_hWnd = 0;
|
||||
|
||||
}
|
||||
|
||||
wxString wxRadioBox::GetLabel(int item) const
|
||||
{
|
||||
GetWindowText((HWND)m_radioButtons[item], wxBuffer, 300);
|
||||
return wxString(wxBuffer);
|
||||
}
|
||||
|
||||
void wxRadioBox::SetLabel(int item, const wxString& label)
|
||||
{
|
||||
m_radioWidth[item] = m_radioHeight[item] = -1;
|
||||
SetWindowText((HWND)m_radioButtons[item], (const char *)label);
|
||||
SetWindowText((HWND)m_radioButtons[item], label.c_str());
|
||||
}
|
||||
|
||||
void wxRadioBox::SetLabel(int item, wxBitmap *bitmap)
|
||||
@@ -312,18 +299,18 @@ void wxRadioBox::SetLabel(int item, wxBitmap *bitmap)
|
||||
m_radioWidth[item] = bitmap->GetWidth() + FB_MARGIN;
|
||||
m_radioHeight[item] = bitmap->GetHeight() + FB_MARGIN;
|
||||
*/
|
||||
wxFAIL_MSG("not implemented");
|
||||
}
|
||||
|
||||
int wxRadioBox::FindString(const wxString& s) const
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < m_noItems; i++)
|
||||
for (int i = 0; i < m_noItems; i++)
|
||||
{
|
||||
GetWindowText((HWND) m_radioButtons[i], wxBuffer, 1000);
|
||||
if (s == wxBuffer)
|
||||
if ( s == wxGetWindowText(m_radioButtons[i]) )
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
|
||||
return wxNOT_FOUND;
|
||||
}
|
||||
|
||||
void wxRadioBox::SetSelection(int N)
|
||||
@@ -536,22 +523,6 @@ void wxRadioBox::GetPosition(int *x, int *y) const
|
||||
*y = point.y;
|
||||
}
|
||||
|
||||
wxString wxRadioBox::GetLabel() const
|
||||
{
|
||||
if (m_hWnd)
|
||||
{
|
||||
GetWindowText((HWND) m_hWnd, wxBuffer, 300);
|
||||
return wxString(wxBuffer);
|
||||
}
|
||||
else return wxString("");
|
||||
}
|
||||
|
||||
void wxRadioBox::SetLabel(const wxString& label)
|
||||
{
|
||||
if (m_hWnd)
|
||||
SetWindowText((HWND) m_hWnd, label);
|
||||
}
|
||||
|
||||
void wxRadioBox::SetFocus()
|
||||
{
|
||||
if (m_noItems > 0)
|
||||
@@ -566,27 +537,25 @@ void wxRadioBox::SetFocus()
|
||||
|
||||
bool wxRadioBox::Show(bool show)
|
||||
{
|
||||
m_isShown = show;
|
||||
int cshow;
|
||||
if (show)
|
||||
cshow = SW_SHOW;
|
||||
else
|
||||
cshow = SW_HIDE;
|
||||
if (m_hWnd)
|
||||
ShowWindow((HWND) m_hWnd, cshow);
|
||||
int i;
|
||||
for (i = 0; i < m_noItems; i++)
|
||||
ShowWindow((HWND) m_radioButtons[i], cshow);
|
||||
if ( !wxControl::Show(show) )
|
||||
return FALSE;
|
||||
|
||||
int nCmdShow = show ? SW_SHOW : SW_HIDE;
|
||||
for ( int i = 0; i < m_noItems; i++ )
|
||||
{
|
||||
::ShowWindow((HWND)m_radioButtons[i], nCmdShow);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Enable a specific button
|
||||
void wxRadioBox::Enable(int item, bool enable)
|
||||
{
|
||||
if (item<0)
|
||||
wxWindow::Enable(enable);
|
||||
else if (item < m_noItems)
|
||||
::EnableWindow((HWND) m_radioButtons[item], enable);
|
||||
wxCHECK_RET( item >= 0 && item < m_noItems,
|
||||
_T("invalid item in wxRadioBox::Enable()") );
|
||||
|
||||
::EnableWindow((HWND) m_radioButtons[item], enable);
|
||||
}
|
||||
|
||||
// Enable all controls
|
||||
@@ -595,8 +564,7 @@ bool wxRadioBox::Enable(bool enable)
|
||||
if ( !wxControl::Enable(enable) )
|
||||
return FALSE;
|
||||
|
||||
int i;
|
||||
for (i = 0; i < m_noItems; i++)
|
||||
for (int i = 0; i < m_noItems; i++)
|
||||
::EnableWindow((HWND) m_radioButtons[i], enable);
|
||||
|
||||
return TRUE;
|
||||
@@ -605,17 +573,10 @@ bool wxRadioBox::Enable(bool enable)
|
||||
// Show a specific button
|
||||
void wxRadioBox::Show(int item, bool show)
|
||||
{
|
||||
if (item<0)
|
||||
wxRadioBox::Show(show);
|
||||
else if (item < m_noItems)
|
||||
{
|
||||
int cshow;
|
||||
if (show)
|
||||
cshow = SW_SHOW;
|
||||
else
|
||||
cshow = SW_HIDE;
|
||||
ShowWindow((HWND) m_radioButtons[item], cshow);
|
||||
}
|
||||
wxCHECK_RET( item >= 0 && item < m_noItems,
|
||||
_T("invalid item in wxRadioBox::Show()") );
|
||||
|
||||
::ShowWindow((HWND)m_radioButtons[item], show ? SW_SHOW : SW_HIDE);
|
||||
}
|
||||
|
||||
WXHBRUSH wxRadioBox::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
||||
@@ -639,9 +600,6 @@ WXHBRUSH wxRadioBox::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
||||
|
||||
wxBrush *backgroundBrush = wxTheBrushList->FindOrCreateBrush(GetBackgroundColour(), wxSOLID);
|
||||
|
||||
// Note that this will be cleaned up in wxApp::OnIdle, if backgroundBrush
|
||||
// has a zero usage count.
|
||||
// backgroundBrush->RealizeResource();
|
||||
return (WXHBRUSH) backgroundBrush->GetResourceHandle();
|
||||
}
|
||||
|
||||
@@ -672,8 +630,11 @@ bool wxRadioBox::ContainsHWND(WXHWND hWnd) const
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < Number(); i++)
|
||||
{
|
||||
if (GetRadioButtons()[i] == hWnd)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -683,36 +644,49 @@ void wxRadioBox::Command (wxCommandEvent & event)
|
||||
ProcessCommand (event);
|
||||
}
|
||||
|
||||
long wxRadioBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
|
||||
long wxRadioBox::MSWWindowProc(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam)
|
||||
{
|
||||
if (nMsg == WM_NCHITTEST)
|
||||
long rc = 0;
|
||||
bool processed = FALSE;
|
||||
|
||||
switch ( msg )
|
||||
{
|
||||
int xPos = LOWORD(lParam); // horizontal position of cursor
|
||||
int yPos = HIWORD(lParam); // vertical position of cursor
|
||||
case WM_NCHITTEST:
|
||||
{
|
||||
int xPos = LOWORD(lParam); // horizontal position of cursor
|
||||
int yPos = HIWORD(lParam); // vertical position of cursor
|
||||
|
||||
ScreenToClient(&xPos, &yPos);
|
||||
ScreenToClient(&xPos, &yPos);
|
||||
|
||||
// Make sure you can drag by the top of the groupbox, but let
|
||||
// other (enclosed) controls get mouse events also
|
||||
if (yPos < 10)
|
||||
return (long)HTCLIENT;
|
||||
// Make sure you can drag by the top of the groupbox, but let
|
||||
// other (enclosed) controls get mouse events also
|
||||
if ( yPos < 10 )
|
||||
{
|
||||
rc = HTCLIENT;
|
||||
processed = TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return wxControl::MSWWindowProc(nMsg, wParam, lParam);
|
||||
if ( !processed )
|
||||
rc = wxControl::MSWWindowProc(msg, wParam, lParam);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
void wxRadioBox::SubclassRadioButton(WXHWND hWndBtn)
|
||||
{
|
||||
#ifdef __WIN32__
|
||||
HWND hwndBtn = (HWND)hWndBtn;
|
||||
|
||||
if ( !s_wndprocRadioBtn )
|
||||
s_wndprocRadioBtn = (WXFARPROC)::GetWindowLong(hwndBtn, GWL_WNDPROC);
|
||||
|
||||
// No GWL_USERDATA in Win16, so omit this subclassing.
|
||||
#ifdef __WIN32__
|
||||
::SetWindowLong(hwndBtn, GWL_WNDPROC, (long)wxRadioBtnWndProc);
|
||||
::SetWindowLong(hwndBtn, GWL_USERDATA, (long)this);
|
||||
#endif
|
||||
#endif // __WIN32__
|
||||
}
|
||||
|
||||
void wxRadioBox::SendNotificationEvent()
|
||||
@@ -797,5 +771,6 @@ LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hwnd,
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __WIN32__
|
||||
|
||||
|
@@ -6,7 +6,7 @@
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart and Markus Holzem
|
||||
// Licence: wxWindows license
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
@@ -32,7 +32,7 @@
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxStaticBox, wxControl)
|
||||
EVT_ERASE_BACKGROUND(wxStaticBox::OnEraseBackground)
|
||||
EVT_ERASE_BACKGROUND(wxStaticBox::OnEraseBackground)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
#endif
|
||||
@@ -56,9 +56,9 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id,
|
||||
SetForegroundColour(parent->GetForegroundColour()) ;
|
||||
|
||||
if ( id == -1 )
|
||||
m_windowId = (int)NewControlId();
|
||||
m_windowId = (int)NewControlId();
|
||||
else
|
||||
m_windowId = id;
|
||||
m_windowId = id;
|
||||
|
||||
int x = pos.x;
|
||||
int y = pos.y;
|
||||
@@ -80,7 +80,7 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id,
|
||||
if (want3D)
|
||||
{
|
||||
Ctl3dSubclassCtl(wx_button);
|
||||
m_useCtl3D = TRUE;
|
||||
m_useCtl3D = TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -144,7 +144,7 @@ void wxStaticBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
}
|
||||
|
||||
WXHBRUSH wxStaticBox::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
||||
WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
||||
WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
||||
{
|
||||
#if wxUSE_CTL3D
|
||||
if ( m_useCtl3D )
|
||||
@@ -206,12 +206,14 @@ void wxStaticBox::OnEraseBackground(wxEraseEvent& event)
|
||||
::SetMapMode((HDC) event.GetDC()->GetHDC(), mode);
|
||||
}
|
||||
else
|
||||
Default();
|
||||
{
|
||||
event.Skip();
|
||||
}
|
||||
}
|
||||
|
||||
long wxStaticBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
|
||||
{
|
||||
if (nMsg == WM_NCHITTEST)
|
||||
if (nMsg == WM_NCHITTEST)
|
||||
{
|
||||
int xPos = LOWORD(lParam); // horizontal position of cursor
|
||||
int yPos = HIWORD(lParam); // vertical position of cursor
|
||||
@@ -224,6 +226,6 @@ long wxStaticBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
|
||||
return (long)HTCLIENT;
|
||||
}
|
||||
|
||||
return wxControl::MSWWindowProc(nMsg, wParam, lParam);
|
||||
return wxControl::MSWWindowProc(nMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
|
@@ -33,19 +33,11 @@
|
||||
#include "wx/generic/statusbr.h"
|
||||
#include "wx/msw/statbr95.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
#include "wx/msw/private.h"
|
||||
#include <windowsx.h>
|
||||
|
||||
#if !defined(__GNUWIN32__) || defined(__TWIN32__)
|
||||
#include <commctrl.h>
|
||||
#endif
|
||||
|
||||
#ifdef GetClassInfo
|
||||
#undef GetClassInfo
|
||||
#endif
|
||||
|
||||
#ifdef GetClassName
|
||||
#undef GetClassName
|
||||
#include <commctrl.h>
|
||||
#endif
|
||||
|
||||
#if wxUSE_NATIVE_STATUSBAR
|
||||
|
@@ -6,7 +6,7 @@
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart
|
||||
// Licence: wxWindows license
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
@@ -52,10 +52,6 @@
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxTabCtrl, wxControl)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxTabCtrl, wxControl)
|
||||
EVT_SIZE(wxTabCtrl::OnSize)
|
||||
EVT_PAINT(wxTabCtrl::OnPaint)
|
||||
EVT_KILL_FOCUS(wxTabCtrl::OnKillFocus)
|
||||
EVT_MOUSE_EVENTS(wxTabCtrl::OnMouseEvent)
|
||||
EVT_SYS_COLOUR_CHANGED(wxTabCtrl::OnSysColourChanged)
|
||||
END_EVENT_TABLE()
|
||||
#endif
|
||||
@@ -71,7 +67,7 @@ bool wxTabCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
|
||||
m_imageList = NULL;
|
||||
|
||||
m_backgroundColour = wxColour(GetRValue(GetSysColor(COLOR_BTNFACE)),
|
||||
GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE)));
|
||||
GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE)));
|
||||
m_foregroundColour = *wxBLACK ;
|
||||
|
||||
SetName(name);
|
||||
@@ -139,29 +135,20 @@ wxTabCtrl::~wxTabCtrl()
|
||||
UnsubclassWin();
|
||||
}
|
||||
|
||||
void wxTabCtrl::Command(wxCommandEvent& event)
|
||||
{
|
||||
}
|
||||
|
||||
bool wxTabCtrl::MSWCommand(WXUINT cmd, WXWORD id)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxTabCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
|
||||
{
|
||||
wxTabEvent event(wxEVT_NULL, m_windowId);
|
||||
wxEventType eventType = wxEVT_NULL;
|
||||
NMHDR* hdr1 = (NMHDR*) lParam;
|
||||
switch ( hdr1->code )
|
||||
{
|
||||
case TCN_SELCHANGE:
|
||||
eventType = wxEVT_COMMAND_TAB_SEL_CHANGED;
|
||||
break;
|
||||
wxTabEvent event(wxEVT_NULL, m_windowId);
|
||||
wxEventType eventType = wxEVT_NULL;
|
||||
NMHDR* hdr1 = (NMHDR*) lParam;
|
||||
switch ( hdr1->code )
|
||||
{
|
||||
case TCN_SELCHANGE:
|
||||
eventType = wxEVT_COMMAND_TAB_SEL_CHANGED;
|
||||
break;
|
||||
|
||||
case TCN_SELCHANGING:
|
||||
eventType = wxEVT_COMMAND_TAB_SEL_CHANGING;
|
||||
break;
|
||||
case TCN_SELCHANGING:
|
||||
eventType = wxEVT_COMMAND_TAB_SEL_CHANGING;
|
||||
break;
|
||||
|
||||
case TTN_NEEDTEXT:
|
||||
{
|
||||
@@ -170,27 +157,23 @@ bool wxTabCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
|
||||
// ttText->lpszText = (char *) (const char *)tool->m_shortHelpString;
|
||||
}
|
||||
|
||||
default :
|
||||
return wxControl::MSWOnNotify(idCtrl, lParam, result);
|
||||
}
|
||||
default :
|
||||
return wxControl::MSWOnNotify(idCtrl, lParam, result);
|
||||
}
|
||||
|
||||
event.SetEventObject( this );
|
||||
event.SetEventType(eventType);
|
||||
event.SetInt(idCtrl) ;
|
||||
event.SetEventObject( this );
|
||||
event.SetEventType(eventType);
|
||||
event.SetInt(idCtrl) ;
|
||||
|
||||
return ProcessEvent(event);
|
||||
return ProcessEvent(event);
|
||||
}
|
||||
|
||||
// Responds to colour changes, and passes event on to children.
|
||||
void wxTabCtrl::OnSysColourChanged(wxSysColourChangedEvent& event)
|
||||
{
|
||||
m_backgroundColour = wxColour(GetRValue(GetSysColor(COLOR_BTNFACE)),
|
||||
GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE)));
|
||||
|
||||
// Remap the buttons
|
||||
// CreateTools();
|
||||
|
||||
Default();
|
||||
GetGValue(GetSysColor(COLOR_BTNFACE)),
|
||||
GetBValue(GetSysColor(COLOR_BTNFACE)));
|
||||
|
||||
Refresh();
|
||||
|
||||
|
@@ -77,10 +77,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxToolBar95, wxToolBarBase)
|
||||
#endif
|
||||
|
||||
BEGIN_EVENT_TABLE(wxToolBar95, wxToolBarBase)
|
||||
EVT_SIZE(wxToolBar95::OnSize)
|
||||
EVT_PAINT(wxToolBar95::OnPaint)
|
||||
EVT_MOUSE_EVENTS(wxToolBar95::OnMouseEvent)
|
||||
EVT_KILL_FOCUS(wxToolBar95::OnKillFocus)
|
||||
EVT_SYS_COLOUR_CHANGED(wxToolBar95::OnSysColourChanged)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
@@ -527,8 +524,6 @@ void wxToolBar95::OnSysColourChanged(wxSysColourChangedEvent& event)
|
||||
// Remap the buttons
|
||||
CreateTools();
|
||||
|
||||
Default();
|
||||
|
||||
Refresh();
|
||||
|
||||
// Propagate the event to the non-top-level children
|
||||
@@ -545,7 +540,7 @@ void wxToolBar95::OnMouseEvent(wxMouseEvent& event)
|
||||
}
|
||||
else
|
||||
{
|
||||
Default();
|
||||
event.Skip();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -74,7 +74,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxControl)
|
||||
BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
|
||||
EVT_CHAR(wxTextCtrl::OnChar)
|
||||
EVT_DROP_FILES(wxTextCtrl::OnDropFiles)
|
||||
EVT_ERASE_BACKGROUND(wxTextCtrl::OnEraseBackground)
|
||||
|
||||
EVT_MENU(wxID_CUT, wxTextCtrl::OnCut)
|
||||
EVT_MENU(wxID_COPY, wxTextCtrl::OnCopy)
|
||||
@@ -1070,7 +1069,7 @@ WXHBRUSH wxTextCtrl::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
||||
|
||||
void wxTextCtrl::OnChar(wxKeyEvent& event)
|
||||
{
|
||||
switch( event.KeyCode() )
|
||||
switch ( event.KeyCode() )
|
||||
{
|
||||
case WXK_RETURN:
|
||||
if ( !(m_windowStyle & wxTE_MULTILINE) )
|
||||
@@ -1111,8 +1110,9 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
|
||||
// don't just call event.Skip() because this will cause TABs and ENTERs
|
||||
// be passed upwards and we don't always want this - instead process it
|
||||
// right here
|
||||
Default();
|
||||
// event.Skip();
|
||||
|
||||
// FIXME
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
long wxTextCtrl::MSWGetDlgCode()
|
||||
@@ -1135,27 +1135,6 @@ long wxTextCtrl::MSWGetDlgCode()
|
||||
return lRc;
|
||||
}
|
||||
|
||||
void wxTextCtrl::OnEraseBackground(wxEraseEvent& event)
|
||||
{
|
||||
if ( m_windowStyle & wxTE_MULTILINE )
|
||||
{
|
||||
// No flicker - only problem is we probably can't change the background
|
||||
Default();
|
||||
/*
|
||||
RECT rect;
|
||||
::GetClientRect((HWND) GetHWND(), &rect);
|
||||
|
||||
HBRUSH hBrush = ::CreateSolidBrush(PALETTERGB(GetBackgroundColour().Red(), GetBackgroundColour().Green(), GetBackgroundColour().Blue()));
|
||||
int mode = ::SetMapMode((HDC) event.GetDC()->GetHDC(), MM_TEXT);
|
||||
|
||||
::FillRect ((HDC) event.GetDC()->GetHDC(), &rect, hBrush);
|
||||
::DeleteObject(hBrush);
|
||||
::SetMapMode((HDC) event.GetDC()->GetHDC(), mode);
|
||||
*/
|
||||
}
|
||||
// wxWindow::OnEraseBackground(event);
|
||||
}
|
||||
|
||||
bool wxTextCtrl::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
|
||||
{
|
||||
/*
|
||||
|
@@ -441,7 +441,7 @@ bool wxThread::IsMain()
|
||||
}
|
||||
|
||||
#ifdef Yield
|
||||
#undef Yield
|
||||
#undef Yield
|
||||
#endif
|
||||
|
||||
void wxThread::Yield()
|
||||
|
@@ -48,22 +48,6 @@
|
||||
#include <commctrl.h>
|
||||
#endif
|
||||
|
||||
#ifdef GetFirstChild
|
||||
#undef GetFirstChild
|
||||
#endif
|
||||
|
||||
#ifdef GetNextChild
|
||||
#undef GetNextChild
|
||||
#endif
|
||||
|
||||
#ifdef GetNextSibling
|
||||
#undef GetNextSibling
|
||||
#endif
|
||||
|
||||
#ifdef GetClassInfo
|
||||
#undef GetClassInfo
|
||||
#endif
|
||||
|
||||
// Bug in headers, sometimes
|
||||
#ifndef TVIS_FOCUSED
|
||||
#define TVIS_FOCUSED 0x0001
|
||||
|
@@ -853,12 +853,12 @@ wxString WXDLLEXPORT wxGetWindowClass(WXHWND hWnd)
|
||||
return str;
|
||||
}
|
||||
|
||||
wxWindowID WXDLLEXPORT wxGetWindowId(WXHWND hWnd)
|
||||
WXWORD WXDLLEXPORT wxGetWindowId(WXHWND hWnd)
|
||||
{
|
||||
#ifndef __WIN32__
|
||||
return (wxWindowID)GetWindowWord((HWND)hWnd, GWW_ID);
|
||||
return GetWindowWord((HWND)hWnd, GWW_ID);
|
||||
#else // Win32
|
||||
return (wxWindowID)GetWindowLong((HWND)hWnd, GWL_ID);
|
||||
return GetWindowLong((HWND)hWnd, GWL_ID);
|
||||
#endif // Win16/32
|
||||
}
|
||||
|
||||
|
4696
src/msw/window.cpp
4696
src/msw/window.cpp
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user