DECLARE_EVENT_TYPE(wxEVT_INIT_DIALOG, 438)
DECLARE_EVENT_TYPE(wxEVT_IDLE, 439)
DECLARE_EVENT_TYPE(wxEVT_UPDATE_UI, 440)
+ DECLARE_EVENT_TYPE(wxEVT_SIZING, 441)
+ DECLARE_EVENT_TYPE(wxEVT_MOVING, 4442)
// Generic command events
// Note: a click is a higher-level event than button down/up
{ }
wxSizeEvent(const wxSizeEvent & event)
: wxEvent(event),
- m_size(event.m_size)
+ m_size(event.m_size), m_rect(event.m_rect)
{ }
+ wxSizeEvent(const wxRect& rect, int id = 0)
+ : m_rect(rect), m_size(rect.GetSize())
+ { m_eventType = wxEVT_SIZING; m_id = id; }
wxSize GetSize() const { return m_size; }
+ wxRect GetRect() const { return m_rect; }
+ void SetRect(wxRect rect) { m_rect = rect; }
virtual wxEvent *Clone() const { return new wxSizeEvent(*this); }
public:
wxSize m_size;
+ wxRect m_rect; // Used for wxEVT_SIZING
private:
DECLARE_DYNAMIC_CLASS(wxSizeEvent)
: wxEvent(event),
m_pos(event.m_pos)
{ }
+ wxMoveEvent(const wxRect& rect, int id = 0)
+ : m_pos(rect.GetPosition()), m_rect(rect)
+ { m_eventType = wxEVT_MOVING; m_id = id; }
wxPoint GetPosition() const { return m_pos; }
+ wxRect GetRect() const { return m_rect; }
+ void SetRect(wxRect rect) { m_rect = rect; }
virtual wxEvent *Clone() const { return new wxMoveEvent(*this); }
wxPoint m_pos;
+ wxRect m_rect;
private:
DECLARE_DYNAMIC_CLASS(wxMoveEvent)
// Miscellaneous
#define EVT_SIZE(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_SIZE, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxSizeEventFunction) & func, (wxObject *) NULL ),
+#define EVT_SIZING(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_SIZING, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxSizeEventFunction) & func, (wxObject *) NULL ),
#define EVT_MOVE(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_MOVE, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxMoveEventFunction) & func, (wxObject *) NULL ),
+#define EVT_MOVING(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_MOVING, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMoveEventFunction) & func, (wxObject *) NULL ),
#define EVT_CLOSE(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_CLOSE_WINDOW, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCloseEventFunction) & func, (wxObject *) NULL ),
#define EVT_END_SESSION(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_END_SESSION, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCloseEventFunction) & func, (wxObject *) NULL ),
#define EVT_QUERY_END_SESSION(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_QUERY_END_SESSION, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCloseEventFunction) & func, (wxObject *) NULL ),
bool HandleMinimize();
bool HandleMaximize();
bool HandleSize(int x, int y, WXUINT flag);
+ bool HandleSizing(wxRect& rect);
bool HandleGetMinMaxInfo(void *mmInfo);
bool HandleShow(bool show, int status);
// the (non-virtual) handlers for the events
bool HandleMove(int x, int y);
+ bool HandleMoving(wxRect& rect);
bool HandleJoystickEvent(WXUINT msg, int x, int y, WXUINT flags);
#ifdef __WIN95__
// System events
DEFINE_EVENT_TYPE(wxEVT_SIZE)
+DEFINE_EVENT_TYPE(wxEVT_SIZING)
DEFINE_EVENT_TYPE(wxEVT_MOVE)
+DEFINE_EVENT_TYPE(wxEVT_MOVING)
DEFINE_EVENT_TYPE(wxEVT_CLOSE_WINDOW)
DEFINE_EVENT_TYPE(wxEVT_END_SESSION)
DEFINE_EVENT_TYPE(wxEVT_QUERY_END_SESSION)
DEFINE_ONE_SHOT_HANDLER_GETTER( wxMacWindowEventHandler )
+// Patch 531199 defined a window event handler, as follows.
+// TODO: merge the moving/sizing event handling with the event
+// handler above.
+#if 0
+static pascal OSStatus
+WindowHandler( EventHandlerCallRef inHandler, EventRef inEvent, void* userData )
+{
+ Rect bounds;
+ SInt16 height, width;
+ UInt32 attributes;
+ OSStatus result = eventNotHandledErr;
+
+ GetEventParameter( inEvent, kEventParamAttributes, typeUInt32, NULL, sizeof( UInt32 ), NULL, &attributes );
+
+ if ((attributes & (kWindowBoundsChangeSizeChanged | kWindowBoundsChangeOriginChanged)) != 0)
+ {
+ // Extract the current bounds. This is the paramter you get to modify to
+ // alter the window position or size during a window resizing.
+ GetEventParameter( inEvent, kEventParamCurrentBounds, typeQDRectangle, NULL, sizeof( bounds ), NULL, &bounds );
+
+ wxRect rect;
+ rect.SetLeft(bounds.left);
+ rect.SetTop(bounds.top);
+ rect.SetRight(bounds.right);
+ rect.SetBottom(bounds.bottom);
+
+ bool rc;
+ wxWindowMac *pWindow = (wxWindowMac*)userData;
+ if ((attributes & kWindowBoundsChangeSizeChanged) != 0) {
+ wxSizeEvent event(rect, pWindow->GetId());
+ event.SetEventObject(pWindow);
+ rc = pWindow->GetEventHandler()->ProcessEvent(event);
+ rect = event.GetRect();
+ }
+ else {
+ wxMoveEvent event(rect, pWindow->GetId());
+ event.SetEventObject(pWindow);
+ rc = pWindow->GetEventHandler()->ProcessEvent(event);
+ rect = event.GetRect();
+ }
+
+ if (rc) {
+ bounds.left = rect.GetLeft();
+ bounds.top = rect.GetTop();
+ bounds.right = rect.GetRight();
+ bounds.bottom = rect.GetBottom();
+ }
+
+ // Set the current bounds parameter to our adjusted bounds. Return
+ // noErr to indicate we handled this event.
+ SetEventParameter( inEvent, kEventParamCurrentBounds, typeQDRectangle, sizeof( bounds ), &bounds );
+ result = noErr;
+ }
+ return result;
+}
+#endif
+ // WindowHandler
+
#endif
// ---------------------------------------------------------------------------
InstallStandardEventHandler( GetWindowEventTarget(MAC_WXHWND(m_macWindow)) ) ;
InstallWindowEventHandler(MAC_WXHWND(m_macWindow), GetwxMacWindowEventHandlerUPP(),
GetEventTypeCount(eventList), eventList, this, &((EventHandlerRef)m_macEventHandler));
+
+ // Patch 531199 also defined a window event handler, as follows:
+#if 0
+ // install a window event handler to send wxEVT_MOVING and wxEVT_SIZING events
+ EventTypeSpec events[] = { { kEventClassWindow, kEventWindowBoundsChanging } };
+ EventHandlerUPP handlerProc = NewEventHandlerUPP( WindowHandler );
+ EventHandlerRef eventHandlerRef;
+ InstallWindowEventHandler( m_macWindowData->m_macWindow, handlerProc, GetEventTypeCount(events),
+ events, (void*)this, &eventHandlerRef);
+#endif
+
#endif
m_macFocus = NULL ;
DEFINE_ONE_SHOT_HANDLER_GETTER( wxMacWindowEventHandler )
+// Patch 531199 defined a window event handler, as follows.
+// TODO: merge the moving/sizing event handling with the event
+// handler above.
+#if 0
+static pascal OSStatus
+WindowHandler( EventHandlerCallRef inHandler, EventRef inEvent, void* userData )
+{
+ Rect bounds;
+ SInt16 height, width;
+ UInt32 attributes;
+ OSStatus result = eventNotHandledErr;
+
+ GetEventParameter( inEvent, kEventParamAttributes, typeUInt32, NULL, sizeof( UInt32 ), NULL, &attributes );
+
+ if ((attributes & (kWindowBoundsChangeSizeChanged | kWindowBoundsChangeOriginChanged)) != 0)
+ {
+ // Extract the current bounds. This is the paramter you get to modify to
+ // alter the window position or size during a window resizing.
+ GetEventParameter( inEvent, kEventParamCurrentBounds, typeQDRectangle, NULL, sizeof( bounds ), NULL, &bounds );
+
+ wxRect rect;
+ rect.SetLeft(bounds.left);
+ rect.SetTop(bounds.top);
+ rect.SetRight(bounds.right);
+ rect.SetBottom(bounds.bottom);
+
+ bool rc;
+ wxWindowMac *pWindow = (wxWindowMac*)userData;
+ if ((attributes & kWindowBoundsChangeSizeChanged) != 0) {
+ wxSizeEvent event(rect, pWindow->GetId());
+ event.SetEventObject(pWindow);
+ rc = pWindow->GetEventHandler()->ProcessEvent(event);
+ rect = event.GetRect();
+ }
+ else {
+ wxMoveEvent event(rect, pWindow->GetId());
+ event.SetEventObject(pWindow);
+ rc = pWindow->GetEventHandler()->ProcessEvent(event);
+ rect = event.GetRect();
+ }
+
+ if (rc) {
+ bounds.left = rect.GetLeft();
+ bounds.top = rect.GetTop();
+ bounds.right = rect.GetRight();
+ bounds.bottom = rect.GetBottom();
+ }
+
+ // Set the current bounds parameter to our adjusted bounds. Return
+ // noErr to indicate we handled this event.
+ SetEventParameter( inEvent, kEventParamCurrentBounds, typeQDRectangle, sizeof( bounds ), &bounds );
+ result = noErr;
+ }
+ return result;
+}
+#endif
+ // WindowHandler
+
#endif
// ---------------------------------------------------------------------------
InstallStandardEventHandler( GetWindowEventTarget(MAC_WXHWND(m_macWindow)) ) ;
InstallWindowEventHandler(MAC_WXHWND(m_macWindow), GetwxMacWindowEventHandlerUPP(),
GetEventTypeCount(eventList), eventList, this, &((EventHandlerRef)m_macEventHandler));
+
+ // Patch 531199 also defined a window event handler, as follows:
+#if 0
+ // install a window event handler to send wxEVT_MOVING and wxEVT_SIZING events
+ EventTypeSpec events[] = { { kEventClassWindow, kEventWindowBoundsChanging } };
+ EventHandlerUPP handlerProc = NewEventHandlerUPP( WindowHandler );
+ EventHandlerRef eventHandlerRef;
+ InstallWindowEventHandler( m_macWindowData->m_macWindow, handlerProc, GetEventTypeCount(events),
+ events, (void*)this, &eventHandlerRef);
+#endif
+
#endif
m_macFocus = NULL ;
processed = HandleMove(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
break;
+ case WM_MOVING:
+ {
+ LPRECT pRect = (LPRECT)lParam;
+ wxRect rc;
+ rc.SetLeft(pRect->left);
+ rc.SetTop(pRect->top);
+ rc.SetRight(pRect->right);
+ rc.SetBottom(pRect->bottom);
+ processed = HandleMoving(rc);
+ if (processed) {
+ pRect->left = rc.GetLeft();
+ pRect->top = rc.GetTop();
+ pRect->right = rc.GetRight();
+ pRect->bottom = rc.GetBottom();
+ }
+ }
+ break;
+
case WM_SIZE:
switch ( wParam )
{
}
break;
+ case WM_SIZING:
+ {
+ LPRECT pRect = (LPRECT)lParam;
+ wxRect rc;
+ rc.SetLeft(pRect->left);
+ rc.SetTop(pRect->top);
+ rc.SetRight(pRect->right);
+ rc.SetBottom(pRect->bottom);
+ processed = HandleSizing(rc);
+ if (processed) {
+ pRect->left = rc.GetLeft();
+ pRect->top = rc.GetTop();
+ pRect->right = rc.GetRight();
+ pRect->bottom = rc.GetBottom();
+ }
+ }
+ break;
+
#ifndef __WXMICROWIN__
case WM_ACTIVATEAPP:
wxTheApp->SetActive(wParam != 0, FindFocus());
return GetEventHandler()->ProcessEvent(event);
}
+bool wxWindowMSW::HandleMoving(wxRect& rect)
+{
+ wxMoveEvent event(rect, m_windowId);
+ event.SetEventObject(this);
+
+ bool rc = GetEventHandler()->ProcessEvent(event);
+ if (rc)
+ rect = event.GetRect();
+ return rc;
+}
+
bool wxWindowMSW::HandleSize(int WXUNUSED(w), int WXUNUSED(h),
WXUINT WXUNUSED(flag))
{
return GetEventHandler()->ProcessEvent(event);
}
+bool wxWindowMSW::HandleSizing(wxRect& rect)
+{
+ wxSizeEvent event(rect, m_windowId);
+ event.SetEventObject(this);
+
+ bool rc = GetEventHandler()->ProcessEvent(event);
+ if (rc)
+ rect = event.GetRect();
+ return rc;
+}
+
bool wxWindowMSW::HandleGetMinMaxInfo(void *mmInfo)
{
MINMAXINFO *info = (MINMAXINFO *)mmInfo;