we now send iconize events
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10391 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -199,10 +199,12 @@ An event object contains information about a specific event. Event handlers
|
||||
\twocolitem{\helpref{wxEvent}{wxevent}}{The event base class}
|
||||
\twocolitem{\helpref{wxFocusEvent}{wxfocusevent}}{A window focus event}
|
||||
\twocolitem{\helpref{wxKeyEvent}{wxkeyevent}}{A keypress event}
|
||||
\twocolitem{\helpref{wxIconizeEvent}{wxiconizeevent}}{An iconize/restore event}
|
||||
\twocolitem{\helpref{wxIdleEvent}{wxidleevent}}{An idle event}
|
||||
\twocolitem{\helpref{wxInitDialogEvent}{wxinitdialogevent}}{A dialog initialisation event}
|
||||
\twocolitem{\helpref{wxJoystickEvent}{wxjoystickevent}}{A joystick event}
|
||||
\twocolitem{\helpref{wxListEvent}{wxlistevent}}{A list control event}
|
||||
\twocolitem{\helpref{wxMaximizeEvent}{wxmaximizeevent}}{A maximize event}
|
||||
\twocolitem{\helpref{wxMenuEvent}{wxmenuevent}}{A menu event}
|
||||
\twocolitem{\helpref{wxMouseEvent}{wxmouseevent}}{A mouse event}
|
||||
\twocolitem{\helpref{wxMoveEvent}{wxmoveevent}}{A move event}
|
||||
|
@@ -276,7 +276,7 @@ Returns a pointer to the toolbar currently associated with the frame (if any).
|
||||
|
||||
\func{void}{Iconize}{\param{bool}{ iconize}}
|
||||
|
||||
Iconizes or restores the frame. Windows only.
|
||||
Iconizes or restores the frame.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
@@ -300,7 +300,7 @@ Returns TRUE if the frame is in fullscreen mode.
|
||||
|
||||
\constfunc{bool}{IsIconized}{\void}
|
||||
|
||||
Returns TRUE if the frame is iconized. Windows only.
|
||||
Returns TRUE if the frame is iconized.
|
||||
|
||||
\membersection{wxFrame::IsMaximized}\label{wxframeismaximized}
|
||||
|
||||
|
@@ -1,3 +1,18 @@
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%% Name: sizeevt.tex
|
||||
%% Purpose: wxSizeEvent and related event classes documentation
|
||||
%% Author: wxWindows team
|
||||
%% Modified by:
|
||||
%% Created:
|
||||
%% RCS-ID: $Id$
|
||||
%% Copyright: (c) wxWindows team
|
||||
%% License: wxWindows license
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%% wxSizeEvent
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
\section{\class{wxSizeEvent}}\label{wxsizeevent}
|
||||
|
||||
A size event holds information about size change events.
|
||||
@@ -23,7 +38,8 @@ function that takes a wxSizeEvent argument.
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{wxWindow::OnSize}{wxwindowonsize}, \helpref{wxSize}{wxsize}, \helpref{Event handling overview}{eventhandlingoverview}
|
||||
\helpref{wxSize}{wxsize},\rtfsp
|
||||
\helpref{Event handling overview}{eventhandlingoverview}
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
@@ -39,3 +55,94 @@ Constructor.
|
||||
|
||||
Returns the entire size of the window generating the size change event.
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%% wxIconizeEvent
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
\section{\class{wxIconizeEvent}}\label{wxiconizeevent}
|
||||
|
||||
An event being sent when the frame is iconized (minimized) or restored.
|
||||
|
||||
Currently only wxMSW and wxGTK generate such events.
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
\helpref{wxEvent}{wxevent}\\
|
||||
\helpref{wxObject}{wxobject}
|
||||
|
||||
\wxheading{Include files}
|
||||
|
||||
<wx/event.h>
|
||||
|
||||
\wxheading{Event table macros}
|
||||
|
||||
To process an iconize event, use this event handler macro to direct input to a
|
||||
member function that takes a wxIconizeEvent argument.
|
||||
|
||||
\twocolwidtha{7cm}
|
||||
\begin{twocollist}\itemsep=0pt
|
||||
\twocolitem{{\bf EVT\_ICONIZE(func)}}{Process a wxEVT\_ICONIZE event.}
|
||||
\end{twocollist}%
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{Event handling overview}{eventhandlingoverview},\rtfsp
|
||||
\helpref{wxFrame::Iconize}{wxframeiconize},\rtfsp
|
||||
\helpref{wxFrame::IsIconized}{wxframeisiconized}
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
\membersection{wxIconizeEvent::wxIconizeEvent}\label{wxiconizeeventctor}
|
||||
|
||||
\func{}{wxIconizeEvent}{\param{int }{id = 0}, \param{bool }{iconized = TRUE}}
|
||||
|
||||
Constructor.
|
||||
|
||||
\membersection{wxIconizeEvent::Iconized}\label{wxiconizeeventiconized}
|
||||
|
||||
\constfunc{bool}{Iconized}{\void}
|
||||
|
||||
Returns {\tt TRUE} if the frame has been iconized, {\tt FALSE} if it has been
|
||||
restored.
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%% wxMaximizeEvent
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
\section{\class{wxMaximizeEvent}}\label{wxmaximizeevent}
|
||||
|
||||
An event being sent when the frame is maximized (minimized) or restored.
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
\helpref{wxEvent}{wxevent}\\
|
||||
\helpref{wxObject}{wxobject}
|
||||
|
||||
\wxheading{Include files}
|
||||
|
||||
<wx/event.h>
|
||||
|
||||
\wxheading{Event table macros}
|
||||
|
||||
To process a maximize event, use this event handler macro to direct input to a
|
||||
member function that takes a wxMaximizeEvent argument.
|
||||
|
||||
\twocolwidtha{7cm}
|
||||
\begin{twocollist}\itemsep=0pt
|
||||
\twocolitem{{\bf EVT\_MAXIMIZE(func)}}{Process a wxEVT\_MAXIMIZE event.}
|
||||
\end{twocollist}%
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{Event handling overview}{eventhandlingoverview},\rtfsp
|
||||
\helpref{wxFrame::Maximize}{wxframemaximize},\rtfsp
|
||||
\helpref{wxFrame::IsMaximized}{wxframeismaximized}
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
\membersection{wxMaximizeEvent::wxMaximizeEvent}\label{wxmaximizeeventctor}
|
||||
|
||||
\func{}{wxMaximizeEvent}{\param{int }{id = 0}}
|
||||
|
||||
Constructor.
|
||||
|
||||
|
@@ -1043,10 +1043,7 @@ protected:
|
||||
|
||||
class WXDLLEXPORT wxShowEvent : public wxEvent
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxShowEvent)
|
||||
|
||||
public:
|
||||
|
||||
wxShowEvent(int id = 0, bool show = FALSE)
|
||||
{ m_eventType = wxEVT_SHOW; m_id = id; m_show = show; }
|
||||
|
||||
@@ -1057,6 +1054,8 @@ public:
|
||||
|
||||
protected:
|
||||
bool m_show;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxShowEvent)
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -1065,11 +1064,17 @@ protected:
|
||||
|
||||
class WXDLLEXPORT wxIconizeEvent : public wxEvent
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxIconizeEvent)
|
||||
|
||||
public:
|
||||
wxIconizeEvent(int id = 0)
|
||||
{ m_eventType = wxEVT_ICONIZE; m_id = id; }
|
||||
wxIconizeEvent(int id = 0, bool iconized = TRUE)
|
||||
{ m_eventType = wxEVT_ICONIZE; m_id = id; m_iconized = iconized; }
|
||||
|
||||
// return true if the frame was iconized, false if restored
|
||||
bool Iconized() const { return m_iconized; }
|
||||
|
||||
protected:
|
||||
bool m_iconized;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxIconizeEvent)
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -1078,11 +1083,11 @@ public:
|
||||
|
||||
class WXDLLEXPORT wxMaximizeEvent : public wxEvent
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxMaximizeEvent)
|
||||
|
||||
public:
|
||||
wxMaximizeEvent(int id = 0)
|
||||
{ m_eventType = wxEVT_MAXIMIZE; m_id = id; }
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxMaximizeEvent)
|
||||
};
|
||||
|
||||
// Joystick event class
|
||||
|
@@ -215,6 +215,9 @@ protected:
|
||||
virtual void DoClientToScreen(int *x, int *y) const;
|
||||
virtual void DoScreenToClient(int *x, int *y) const;
|
||||
|
||||
// send the iconize event, return TRUE if processed
|
||||
bool SendIconizeEvent(bool iconized = TRUE);
|
||||
|
||||
// the frame icon
|
||||
wxIcon m_icon;
|
||||
|
||||
|
@@ -106,6 +106,9 @@ public:
|
||||
virtual void GtkOnSize( int x, int y, int width, int height );
|
||||
virtual void OnInternalIdle();
|
||||
|
||||
// do *not* call this to iconize the frame, this is a private function!
|
||||
void SetIconizeState(bool iconic);
|
||||
|
||||
wxString m_title;
|
||||
int m_miniEdge,
|
||||
m_miniTitle;
|
||||
@@ -114,8 +117,6 @@ public:
|
||||
bool m_toolBarDetached;
|
||||
bool m_insertInClientArea; /* not from within OnCreateXXX */
|
||||
|
||||
bool m_isIconized;
|
||||
|
||||
bool m_fsIsShowing; /* full screen */
|
||||
long m_fsSaveStyle;
|
||||
long m_fsSaveFlag;
|
||||
@@ -133,6 +134,9 @@ protected:
|
||||
virtual void DoSetClientSize(int width, int height);
|
||||
virtual void DoGetClientSize( int *width, int *height ) const;
|
||||
|
||||
// is the frame currently iconized?
|
||||
bool m_isIconized;
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxFrame)
|
||||
};
|
||||
|
@@ -106,6 +106,9 @@ public:
|
||||
virtual void GtkOnSize( int x, int y, int width, int height );
|
||||
virtual void OnInternalIdle();
|
||||
|
||||
// do *not* call this to iconize the frame, this is a private function!
|
||||
void SetIconizeState(bool iconic);
|
||||
|
||||
wxString m_title;
|
||||
int m_miniEdge,
|
||||
m_miniTitle;
|
||||
@@ -114,8 +117,6 @@ public:
|
||||
bool m_toolBarDetached;
|
||||
bool m_insertInClientArea; /* not from within OnCreateXXX */
|
||||
|
||||
bool m_isIconized;
|
||||
|
||||
bool m_fsIsShowing; /* full screen */
|
||||
long m_fsSaveStyle;
|
||||
long m_fsSaveFlag;
|
||||
@@ -133,6 +134,9 @@ protected:
|
||||
virtual void DoSetClientSize(int width, int height);
|
||||
virtual void DoGetClientSize( int *width, int *height ) const;
|
||||
|
||||
// is the frame currently iconized?
|
||||
bool m_isIconized;
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxFrame)
|
||||
};
|
||||
|
@@ -290,6 +290,14 @@ void wxFrameBase::OnMenuHighlight(wxMenuEvent& event)
|
||||
#endif // wxUSE_STATUSBAR
|
||||
}
|
||||
|
||||
bool wxFrameBase::SendIconizeEvent(bool iconized)
|
||||
{
|
||||
wxIconizeEvent event(GetId(), iconized);
|
||||
event.SetEventObject(this);
|
||||
|
||||
return GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// status bar stuff
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -332,7 +332,7 @@ gtk_frame_map_callback( GtkWidget * WXUNUSED(widget),
|
||||
GdkEvent * WXUNUSED(event),
|
||||
wxFrame *win )
|
||||
{
|
||||
win->m_isIconized = FALSE;
|
||||
win->SetIconizeState(FALSE);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -344,7 +344,7 @@ gtk_frame_unmap_callback( GtkWidget * WXUNUSED(widget),
|
||||
GdkEvent * WXUNUSED(event),
|
||||
wxFrame *win )
|
||||
{
|
||||
win->m_isIconized = TRUE;
|
||||
win->SetIconizeState(TRUE);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -448,7 +448,7 @@ void wxFrame::Init()
|
||||
m_toolBarDetached = FALSE;
|
||||
m_insertInClientArea = TRUE;
|
||||
m_isFrame = TRUE;
|
||||
m_isIconized = FALSE;
|
||||
m_isIconized = TRUE;
|
||||
m_fsIsShowing = FALSE;
|
||||
m_themeEnabled = TRUE;
|
||||
}
|
||||
@@ -537,7 +537,7 @@ bool wxFrame::Create( wxWindow *parent,
|
||||
#endif
|
||||
|
||||
/* we donm't allow the frame to get the focus as otherwise
|
||||
the frame will grabit at arbitrary fcous changes. */
|
||||
the frame will grab it at arbitrary focus changes. */
|
||||
GTK_WIDGET_UNSET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
|
||||
|
||||
if (m_parent) m_parent->AddChild( this );
|
||||
@@ -1216,3 +1216,19 @@ bool wxFrame::IsIconized() const
|
||||
{
|
||||
return m_isIconized;
|
||||
}
|
||||
|
||||
void wxFrame::SetIconizeState(bool iconize)
|
||||
{
|
||||
if ( iconize != m_isIconized )
|
||||
{
|
||||
m_isIconized = iconize;
|
||||
(void)SendIconizeEvent(iconize);
|
||||
}
|
||||
else
|
||||
{
|
||||
// this is not supposed to happen if we're called only from
|
||||
// gtk_frame_(un)map_callback!
|
||||
wxFAIL_MSG( _T("unexpected call to SendIconizeEvent ignored") );
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -549,8 +549,7 @@ gtk_pizza_realize (GtkWidget *widget)
|
||||
attributes.wclass = GDK_INPUT_OUTPUT;
|
||||
attributes.visual = gtk_widget_get_visual (widget);
|
||||
attributes.colormap = gtk_widget_get_colormap (widget);
|
||||
attributes.event_mask =
|
||||
GDK_VISIBILITY_NOTIFY_MASK;
|
||||
attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK;
|
||||
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
|
||||
|
||||
widget->window = gdk_window_new(gtk_widget_get_parent_window (widget),
|
||||
@@ -561,8 +560,7 @@ gtk_pizza_realize (GtkWidget *widget)
|
||||
attributes.y = 0;
|
||||
|
||||
attributes.event_mask = gtk_widget_get_events (widget);
|
||||
attributes.event_mask |=
|
||||
GDK_EXPOSURE_MASK |
|
||||
attributes.event_mask |= GDK_EXPOSURE_MASK |
|
||||
GDK_POINTER_MOTION_MASK |
|
||||
GDK_POINTER_MOTION_HINT_MASK |
|
||||
GDK_BUTTON_MOTION_MASK |
|
||||
|
@@ -332,7 +332,7 @@ gtk_frame_map_callback( GtkWidget * WXUNUSED(widget),
|
||||
GdkEvent * WXUNUSED(event),
|
||||
wxFrame *win )
|
||||
{
|
||||
win->m_isIconized = FALSE;
|
||||
win->SetIconizeState(FALSE);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -344,7 +344,7 @@ gtk_frame_unmap_callback( GtkWidget * WXUNUSED(widget),
|
||||
GdkEvent * WXUNUSED(event),
|
||||
wxFrame *win )
|
||||
{
|
||||
win->m_isIconized = TRUE;
|
||||
win->SetIconizeState(TRUE);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -448,7 +448,7 @@ void wxFrame::Init()
|
||||
m_toolBarDetached = FALSE;
|
||||
m_insertInClientArea = TRUE;
|
||||
m_isFrame = TRUE;
|
||||
m_isIconized = FALSE;
|
||||
m_isIconized = TRUE;
|
||||
m_fsIsShowing = FALSE;
|
||||
m_themeEnabled = TRUE;
|
||||
}
|
||||
@@ -537,7 +537,7 @@ bool wxFrame::Create( wxWindow *parent,
|
||||
#endif
|
||||
|
||||
/* we donm't allow the frame to get the focus as otherwise
|
||||
the frame will grabit at arbitrary fcous changes. */
|
||||
the frame will grab it at arbitrary focus changes. */
|
||||
GTK_WIDGET_UNSET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
|
||||
|
||||
if (m_parent) m_parent->AddChild( this );
|
||||
@@ -1216,3 +1216,19 @@ bool wxFrame::IsIconized() const
|
||||
{
|
||||
return m_isIconized;
|
||||
}
|
||||
|
||||
void wxFrame::SetIconizeState(bool iconize)
|
||||
{
|
||||
if ( iconize != m_isIconized )
|
||||
{
|
||||
m_isIconized = iconize;
|
||||
(void)SendIconizeEvent(iconize);
|
||||
}
|
||||
else
|
||||
{
|
||||
// this is not supposed to happen if we're called only from
|
||||
// gtk_frame_(un)map_callback!
|
||||
wxFAIL_MSG( _T("unexpected call to SendIconizeEvent ignored") );
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -549,8 +549,7 @@ gtk_pizza_realize (GtkWidget *widget)
|
||||
attributes.wclass = GDK_INPUT_OUTPUT;
|
||||
attributes.visual = gtk_widget_get_visual (widget);
|
||||
attributes.colormap = gtk_widget_get_colormap (widget);
|
||||
attributes.event_mask =
|
||||
GDK_VISIBILITY_NOTIFY_MASK;
|
||||
attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK;
|
||||
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
|
||||
|
||||
widget->window = gdk_window_new(gtk_widget_get_parent_window (widget),
|
||||
@@ -561,8 +560,7 @@ gtk_pizza_realize (GtkWidget *widget)
|
||||
attributes.y = 0;
|
||||
|
||||
attributes.event_mask = gtk_widget_get_events (widget);
|
||||
attributes.event_mask |=
|
||||
GDK_EXPOSURE_MASK |
|
||||
attributes.event_mask |= GDK_EXPOSURE_MASK |
|
||||
GDK_POINTER_MOTION_MASK |
|
||||
GDK_POINTER_MOTION_HINT_MASK |
|
||||
GDK_BUTTON_MOTION_MASK |
|
||||
|
@@ -261,7 +261,8 @@ void wxFrame::DoSetClientSize(int width, int height)
|
||||
void wxFrame::DoGetSize(int *width, int *height) const
|
||||
{
|
||||
RECT rect;
|
||||
GetWindowRect(GetHwnd(), &rect);
|
||||
::GetWindowRect(GetHwnd(), &rect);
|
||||
|
||||
*width = rect.right - rect.left;
|
||||
*height = rect.bottom - rect.top;
|
||||
}
|
||||
@@ -269,13 +270,10 @@ void wxFrame::DoGetSize(int *width, int *height) const
|
||||
void wxFrame::DoGetPosition(int *x, int *y) const
|
||||
{
|
||||
RECT rect;
|
||||
GetWindowRect(GetHwnd(), &rect);
|
||||
POINT point;
|
||||
point.x = rect.left;
|
||||
point.y = rect.top;
|
||||
::GetWindowRect(GetHwnd(), &rect);
|
||||
|
||||
*x = point.x;
|
||||
*y = point.y;
|
||||
*x = rect.left;
|
||||
*y = rect.top;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -976,6 +974,8 @@ bool wxFrame::HandleSize(int x, int y, WXUINT id)
|
||||
// restore all child frames too
|
||||
IconizeChildFrames(FALSE);
|
||||
|
||||
(void)SendIconizeEvent(FALSE);
|
||||
|
||||
// fall through
|
||||
|
||||
case SIZEFULLSCREEN:
|
||||
@@ -986,6 +986,8 @@ bool wxFrame::HandleSize(int x, int y, WXUINT id)
|
||||
// iconize all child frames too
|
||||
IconizeChildFrames(TRUE);
|
||||
|
||||
(void)SendIconizeEvent();
|
||||
|
||||
m_iconized = TRUE;
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user