]> git.saurik.com Git - wxWidgets.git/commitdiff
we now send iconize events
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 31 May 2001 14:32:06 +0000 (14:32 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 31 May 2001 14:32:06 +0000 (14:32 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10391 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

13 files changed:
docs/latex/wx/category.tex
docs/latex/wx/frame.tex
docs/latex/wx/sizeevt.tex
include/wx/event.h
include/wx/frame.h
include/wx/gtk/frame.h
include/wx/gtk1/frame.h
src/common/framecmn.cpp
src/gtk/frame.cpp
src/gtk/win_gtk.c
src/gtk1/frame.cpp
src/gtk1/win_gtk.c
src/msw/frame.cpp

index 9a4cc3ca868b106a27f6e9c7bae75b7581ca3c78..02bd4f95fc30ae59175863fe0c6f94ef9b367bf9 100644 (file)
@@ -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}
index bb875b620646b57c937acb52b60d68a3892bc0ea..29c31e7c3b9bbcf7a2c04b3be3ebd3e24d65b36b 100644 (file)
@@ -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}
 
index 64256e167e15ffbfb245c6f6e17dca83baaa250c..c30c12614cc65533019916ba7d031cbba554e018 100644 (file)
@@ -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.
+
index 24cc14c0b4968dbf13260852d5115f3b76247400..cb13126bf640efda35f54da254d44c0bcf4250e3 100644 (file)
@@ -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; }
+    wxMaximizeEvent(int id = 0)
+        { m_eventType = wxEVT_MAXIMIZE; m_id = id; }
+
+    DECLARE_DYNAMIC_CLASS(wxMaximizeEvent)
 };
 
 // Joystick event class
index de126f6a5774dc50be3612337ff8e7835dc33853..61084a3f68139c3326e5b3925368e8d94e825922 100644 (file)
@@ -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;
 
index 702f5190059f0f07f0a6083b4759bed75e285d93..99aff948e1acb3607a8e95b467e5b9e874b8d14f 100644 (file)
@@ -99,13 +99,16 @@ public:
     // --------------------------
 
     // move the window to the specified location and resize it: this is called
-    // from both DoSetSize() and DoSetClientSize() 
+    // from both DoSetSize() and DoSetClientSize()
     virtual void DoMoveWindow(int x, int y, int width, int height);
-    
+
     // GTK callbacks
     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)
 };
index 702f5190059f0f07f0a6083b4759bed75e285d93..99aff948e1acb3607a8e95b467e5b9e874b8d14f 100644 (file)
@@ -99,13 +99,16 @@ public:
     // --------------------------
 
     // move the window to the specified location and resize it: this is called
-    // from both DoSetSize() and DoSetClientSize() 
+    // from both DoSetSize() and DoSetClientSize()
     virtual void DoMoveWindow(int x, int y, int width, int height);
-    
+
     // GTK callbacks
     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)
 };
index 3cc2dff527d745502ad526e86202dea0702c1870..5782c231eff4c8304a89d89d41ff6f1af5707dd5 100644 (file)
@@ -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
 // ----------------------------------------------------------------------------
index 71d58cae4d26fb01e701b0be41bf426fe5670144..cedfca99d59a3dd14f2ba34d52768851c51c6f5a 100644 (file)
@@ -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);
 }
 
 //-----------------------------------------------------------------------------
@@ -356,8 +356,8 @@ static int gtk_window_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_ev
     GtkPizza *pizza = GTK_PIZZA(widget);
 
     gtk_paint_flat_box (win->m_widget->style, pizza->bin_window, GTK_STATE_NORMAL,
-               GTK_SHADOW_NONE, &gdk_event->area, win->m_widget, "base", 0, 0, -1, -1);
-        
+                GTK_SHADOW_NONE, &gdk_event->area, win->m_widget, "base", 0, 0, -1, -1);
+
     return TRUE;
 }
 
@@ -370,8 +370,8 @@ static void gtk_window_draw_callback( GtkWidget *widget, GdkRectangle *rect, wxW
 {
     GtkPizza *pizza = GTK_PIZZA(widget);
 
-    gtk_paint_flat_box (win->m_widget->style, pizza->bin_window, GTK_STATE_NORMAL, 
-               GTK_SHADOW_NONE, rect, win->m_widget, "base", 0, 0, -1, -1);
+    gtk_paint_flat_box (win->m_widget->style, pizza->bin_window, GTK_STATE_NORMAL,
+                GTK_SHADOW_NONE, rect, win->m_widget, "base", 0, 0, -1, -1);
 }
 
 // ----------------------------------------------------------------------------
@@ -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;
 }
@@ -489,7 +489,7 @@ bool wxFrame::Create( wxWindow *parent,
     m_insertCallback = (wxInsertChildFunction) wxInsertChildInFrame;
 
     GtkWindowType win_type = GTK_WINDOW_TOPLEVEL;
-    
+
     if (style & wxFRAME_TOOL_WINDOW)
         win_type = GTK_WINDOW_POPUP;
 
@@ -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 );
@@ -601,24 +601,24 @@ bool wxFrame::ShowFullScreen(bool show, long style )
     if (show == m_fsIsShowing) return FALSE; // return what?
 
     m_fsIsShowing = show;
-    
+
     if (show)
     {
         m_fsSaveStyle = m_windowStyle;
         m_fsSaveFlag = style;
         GetPosition( &m_fsSaveFrame.x, &m_fsSaveFrame.y );
         GetSize( &m_fsSaveFrame.width, &m_fsSaveFrame.height );
-        
+
         gtk_widget_hide( m_widget );
         gtk_widget_unrealize( m_widget );
-        
+
         m_windowStyle = wxSIMPLE_BORDER;
-        
+
         int x;
         int y;
         wxDisplaySize( &x, &y );
         SetSize( 0, 0, x, y );
-        
+
         gtk_widget_realize( m_widget );
         gtk_widget_show( m_widget );
     }
@@ -626,15 +626,15 @@ bool wxFrame::ShowFullScreen(bool show, long style )
     {
         gtk_widget_hide( m_widget );
         gtk_widget_unrealize( m_widget );
-    
+
         m_windowStyle = m_fsSaveStyle;
-        
+
         SetSize( m_fsSaveFrame.x, m_fsSaveFrame.y, m_fsSaveFrame.width, m_fsSaveFrame.height );
-        
+
         gtk_widget_realize( m_widget );
         gtk_widget_show( m_widget );
     }
-    
+
     return TRUE;
 }
 
@@ -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") );
+    }
+}
+
index b1846597747f96c63f9c27c3e7ce5c00d797cde2..2e69c20eeff0ff50fe3958910d572c84f19ba9d5 100644 (file)
@@ -190,7 +190,7 @@ gtk_pizza_init (GtkPizza *pizza)
     pizza->height = 20;
 
     pizza->bin_window = NULL;
-    
+
     pizza->xoffset = 0;
     pizza->yoffset = 0;
 
@@ -251,7 +251,7 @@ gtk_pizza_set_clear (GtkPizza  *pizza,
     pizza->clear_on_draw = clear;
 }
 
-void       
+void
 gtk_pizza_set_filter (GtkPizza  *pizza,
                       gboolean   use)
 {
@@ -259,9 +259,9 @@ gtk_pizza_set_filter (GtkPizza  *pizza,
     g_return_if_fail (GTK_IS_PIZZA (pizza));
 
     pizza->use_filter = use;
-}      
-                                       
-void       
+}
+
+void
 gtk_pizza_set_external (GtkPizza  *pizza,
                         gboolean   expose)
 {
@@ -436,7 +436,7 @@ gtk_pizza_set_size (GtkPizza   *pizza,
     }
 }
 
-gint       
+gint
 gtk_pizza_child_resized  (GtkPizza   *pizza,
                           GtkWidget  *widget)
 {
@@ -459,10 +459,10 @@ gtk_pizza_child_resized  (GtkPizza   *pizza,
                     (child->height == widget->allocation.height));
         }
     }
-    
+
     return FALSE;
 }
-                                       
+
 static void
 gtk_pizza_map (GtkWidget *widget)
 {
@@ -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,21 +560,20 @@ gtk_pizza_realize (GtkWidget *widget)
     attributes.y = 0;
 
     attributes.event_mask = gtk_widget_get_events (widget);
-    attributes.event_mask |=
-       GDK_EXPOSURE_MASK        |
-       GDK_POINTER_MOTION_MASK        |
-       GDK_POINTER_MOTION_HINT_MASK  |
-       GDK_BUTTON_MOTION_MASK        |
-       GDK_BUTTON1_MOTION_MASK        |
-       GDK_BUTTON2_MOTION_MASK        |
-       GDK_BUTTON3_MOTION_MASK        |
-       GDK_BUTTON_PRESS_MASK        |
-       GDK_BUTTON_RELEASE_MASK        |
-       GDK_KEY_PRESS_MASK        |
-       GDK_KEY_RELEASE_MASK        |
-       GDK_ENTER_NOTIFY_MASK        |
-       GDK_LEAVE_NOTIFY_MASK        |
-       GDK_FOCUS_CHANGE_MASK;
+    attributes.event_mask |= GDK_EXPOSURE_MASK              |
+                             GDK_POINTER_MOTION_MASK        |
+                             GDK_POINTER_MOTION_HINT_MASK   |
+                             GDK_BUTTON_MOTION_MASK         |
+                             GDK_BUTTON1_MOTION_MASK        |
+                             GDK_BUTTON2_MOTION_MASK        |
+                             GDK_BUTTON3_MOTION_MASK        |
+                             GDK_BUTTON_PRESS_MASK          |
+                             GDK_BUTTON_RELEASE_MASK        |
+                             GDK_KEY_PRESS_MASK             |
+                             GDK_KEY_RELEASE_MASK           |
+                             GDK_ENTER_NOTIFY_MASK          |
+                             GDK_LEAVE_NOTIFY_MASK          |
+                             GDK_FOCUS_CHANGE_MASK;
 
     pizza->bin_window = gdk_window_new(widget->window,
                                           &attributes, attributes_mask);
@@ -775,7 +773,7 @@ gtk_pizza_expose (GtkWidget      *widget,
             gtk_widget_event (child->widget, (GdkEvent*) &child_event);
         }
     }
-    
+
     return TRUE;
 }
 
@@ -1189,29 +1187,29 @@ gtk_pizza_filter (GdkXEvent *gdk_xevent,
     GtkPizza *pizza;
 
     xevent = (XEvent *)gdk_xevent;
-    
+
     pizza = GTK_PIZZA (data);
-    
+
     if (!pizza->use_filter)
         return GDK_FILTER_CONTINUE;
 
     switch (xevent->type)
     {
-    case Expose:
-      if (xevent->xexpose.serial == pizza->configure_serial)
-        {
-          xevent->xexpose.x += pizza->scroll_x;
-          xevent->xexpose.y += pizza->scroll_y;
-        }
-      break;
+        case Expose:
+            if (xevent->xexpose.serial == pizza->configure_serial)
+            {
+                xevent->xexpose.x += pizza->scroll_x;
+                xevent->xexpose.y += pizza->scroll_y;
+            }
+            break;
 
-    case ConfigureNotify:
-        {
-          pizza->configure_serial = xevent->xconfigure.serial;
-          pizza->scroll_x = xevent->xconfigure.x;
-          pizza->scroll_y = xevent->xconfigure.y;
-        }
-      break;
+        case ConfigureNotify:
+            {
+                pizza->configure_serial = xevent->xconfigure.serial;
+                pizza->scroll_x = xevent->xconfigure.x;
+                pizza->scroll_y = xevent->xconfigure.y;
+            }
+            break;
     }
 
     return GDK_FILTER_CONTINUE;
@@ -1231,7 +1229,7 @@ gtk_pizza_main_filter (GdkXEvent *gdk_xevent,
 
     xevent = (XEvent *)gdk_xevent;
     pizza = GTK_PIZZA (data);
-    
+
     if (!pizza->use_filter)
         return GDK_FILTER_CONTINUE;
 
@@ -1251,7 +1249,7 @@ gtk_pizza_main_filter (GdkXEvent *gdk_xevent,
                 pizza->visibility = GDK_VISIBILITY_UNOBSCURED;
                 break;
         }
-        
+
         return GDK_FILTER_REMOVE;
     }
 
index 71d58cae4d26fb01e701b0be41bf426fe5670144..cedfca99d59a3dd14f2ba34d52768851c51c6f5a 100644 (file)
@@ -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);
 }
 
 //-----------------------------------------------------------------------------
@@ -356,8 +356,8 @@ static int gtk_window_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_ev
     GtkPizza *pizza = GTK_PIZZA(widget);
 
     gtk_paint_flat_box (win->m_widget->style, pizza->bin_window, GTK_STATE_NORMAL,
-               GTK_SHADOW_NONE, &gdk_event->area, win->m_widget, "base", 0, 0, -1, -1);
-        
+                GTK_SHADOW_NONE, &gdk_event->area, win->m_widget, "base", 0, 0, -1, -1);
+
     return TRUE;
 }
 
@@ -370,8 +370,8 @@ static void gtk_window_draw_callback( GtkWidget *widget, GdkRectangle *rect, wxW
 {
     GtkPizza *pizza = GTK_PIZZA(widget);
 
-    gtk_paint_flat_box (win->m_widget->style, pizza->bin_window, GTK_STATE_NORMAL, 
-               GTK_SHADOW_NONE, rect, win->m_widget, "base", 0, 0, -1, -1);
+    gtk_paint_flat_box (win->m_widget->style, pizza->bin_window, GTK_STATE_NORMAL,
+                GTK_SHADOW_NONE, rect, win->m_widget, "base", 0, 0, -1, -1);
 }
 
 // ----------------------------------------------------------------------------
@@ -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;
 }
@@ -489,7 +489,7 @@ bool wxFrame::Create( wxWindow *parent,
     m_insertCallback = (wxInsertChildFunction) wxInsertChildInFrame;
 
     GtkWindowType win_type = GTK_WINDOW_TOPLEVEL;
-    
+
     if (style & wxFRAME_TOOL_WINDOW)
         win_type = GTK_WINDOW_POPUP;
 
@@ -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 );
@@ -601,24 +601,24 @@ bool wxFrame::ShowFullScreen(bool show, long style )
     if (show == m_fsIsShowing) return FALSE; // return what?
 
     m_fsIsShowing = show;
-    
+
     if (show)
     {
         m_fsSaveStyle = m_windowStyle;
         m_fsSaveFlag = style;
         GetPosition( &m_fsSaveFrame.x, &m_fsSaveFrame.y );
         GetSize( &m_fsSaveFrame.width, &m_fsSaveFrame.height );
-        
+
         gtk_widget_hide( m_widget );
         gtk_widget_unrealize( m_widget );
-        
+
         m_windowStyle = wxSIMPLE_BORDER;
-        
+
         int x;
         int y;
         wxDisplaySize( &x, &y );
         SetSize( 0, 0, x, y );
-        
+
         gtk_widget_realize( m_widget );
         gtk_widget_show( m_widget );
     }
@@ -626,15 +626,15 @@ bool wxFrame::ShowFullScreen(bool show, long style )
     {
         gtk_widget_hide( m_widget );
         gtk_widget_unrealize( m_widget );
-    
+
         m_windowStyle = m_fsSaveStyle;
-        
+
         SetSize( m_fsSaveFrame.x, m_fsSaveFrame.y, m_fsSaveFrame.width, m_fsSaveFrame.height );
-        
+
         gtk_widget_realize( m_widget );
         gtk_widget_show( m_widget );
     }
-    
+
     return TRUE;
 }
 
@@ -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") );
+    }
+}
+
index b1846597747f96c63f9c27c3e7ce5c00d797cde2..2e69c20eeff0ff50fe3958910d572c84f19ba9d5 100644 (file)
@@ -190,7 +190,7 @@ gtk_pizza_init (GtkPizza *pizza)
     pizza->height = 20;
 
     pizza->bin_window = NULL;
-    
+
     pizza->xoffset = 0;
     pizza->yoffset = 0;
 
@@ -251,7 +251,7 @@ gtk_pizza_set_clear (GtkPizza  *pizza,
     pizza->clear_on_draw = clear;
 }
 
-void       
+void
 gtk_pizza_set_filter (GtkPizza  *pizza,
                       gboolean   use)
 {
@@ -259,9 +259,9 @@ gtk_pizza_set_filter (GtkPizza  *pizza,
     g_return_if_fail (GTK_IS_PIZZA (pizza));
 
     pizza->use_filter = use;
-}      
-                                       
-void       
+}
+
+void
 gtk_pizza_set_external (GtkPizza  *pizza,
                         gboolean   expose)
 {
@@ -436,7 +436,7 @@ gtk_pizza_set_size (GtkPizza   *pizza,
     }
 }
 
-gint       
+gint
 gtk_pizza_child_resized  (GtkPizza   *pizza,
                           GtkWidget  *widget)
 {
@@ -459,10 +459,10 @@ gtk_pizza_child_resized  (GtkPizza   *pizza,
                     (child->height == widget->allocation.height));
         }
     }
-    
+
     return FALSE;
 }
-                                       
+
 static void
 gtk_pizza_map (GtkWidget *widget)
 {
@@ -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,21 +560,20 @@ gtk_pizza_realize (GtkWidget *widget)
     attributes.y = 0;
 
     attributes.event_mask = gtk_widget_get_events (widget);
-    attributes.event_mask |=
-       GDK_EXPOSURE_MASK        |
-       GDK_POINTER_MOTION_MASK        |
-       GDK_POINTER_MOTION_HINT_MASK  |
-       GDK_BUTTON_MOTION_MASK        |
-       GDK_BUTTON1_MOTION_MASK        |
-       GDK_BUTTON2_MOTION_MASK        |
-       GDK_BUTTON3_MOTION_MASK        |
-       GDK_BUTTON_PRESS_MASK        |
-       GDK_BUTTON_RELEASE_MASK        |
-       GDK_KEY_PRESS_MASK        |
-       GDK_KEY_RELEASE_MASK        |
-       GDK_ENTER_NOTIFY_MASK        |
-       GDK_LEAVE_NOTIFY_MASK        |
-       GDK_FOCUS_CHANGE_MASK;
+    attributes.event_mask |= GDK_EXPOSURE_MASK              |
+                             GDK_POINTER_MOTION_MASK        |
+                             GDK_POINTER_MOTION_HINT_MASK   |
+                             GDK_BUTTON_MOTION_MASK         |
+                             GDK_BUTTON1_MOTION_MASK        |
+                             GDK_BUTTON2_MOTION_MASK        |
+                             GDK_BUTTON3_MOTION_MASK        |
+                             GDK_BUTTON_PRESS_MASK          |
+                             GDK_BUTTON_RELEASE_MASK        |
+                             GDK_KEY_PRESS_MASK             |
+                             GDK_KEY_RELEASE_MASK           |
+                             GDK_ENTER_NOTIFY_MASK          |
+                             GDK_LEAVE_NOTIFY_MASK          |
+                             GDK_FOCUS_CHANGE_MASK;
 
     pizza->bin_window = gdk_window_new(widget->window,
                                           &attributes, attributes_mask);
@@ -775,7 +773,7 @@ gtk_pizza_expose (GtkWidget      *widget,
             gtk_widget_event (child->widget, (GdkEvent*) &child_event);
         }
     }
-    
+
     return TRUE;
 }
 
@@ -1189,29 +1187,29 @@ gtk_pizza_filter (GdkXEvent *gdk_xevent,
     GtkPizza *pizza;
 
     xevent = (XEvent *)gdk_xevent;
-    
+
     pizza = GTK_PIZZA (data);
-    
+
     if (!pizza->use_filter)
         return GDK_FILTER_CONTINUE;
 
     switch (xevent->type)
     {
-    case Expose:
-      if (xevent->xexpose.serial == pizza->configure_serial)
-        {
-          xevent->xexpose.x += pizza->scroll_x;
-          xevent->xexpose.y += pizza->scroll_y;
-        }
-      break;
+        case Expose:
+            if (xevent->xexpose.serial == pizza->configure_serial)
+            {
+                xevent->xexpose.x += pizza->scroll_x;
+                xevent->xexpose.y += pizza->scroll_y;
+            }
+            break;
 
-    case ConfigureNotify:
-        {
-          pizza->configure_serial = xevent->xconfigure.serial;
-          pizza->scroll_x = xevent->xconfigure.x;
-          pizza->scroll_y = xevent->xconfigure.y;
-        }
-      break;
+        case ConfigureNotify:
+            {
+                pizza->configure_serial = xevent->xconfigure.serial;
+                pizza->scroll_x = xevent->xconfigure.x;
+                pizza->scroll_y = xevent->xconfigure.y;
+            }
+            break;
     }
 
     return GDK_FILTER_CONTINUE;
@@ -1231,7 +1229,7 @@ gtk_pizza_main_filter (GdkXEvent *gdk_xevent,
 
     xevent = (XEvent *)gdk_xevent;
     pizza = GTK_PIZZA (data);
-    
+
     if (!pizza->use_filter)
         return GDK_FILTER_CONTINUE;
 
@@ -1251,7 +1249,7 @@ gtk_pizza_main_filter (GdkXEvent *gdk_xevent,
                 pizza->visibility = GDK_VISIBILITY_UNOBSCURED;
                 break;
         }
-        
+
         return GDK_FILTER_REMOVE;
     }
 
index 9eb14a0f07c0a321df6029fafa67c8d6e70eb773..b37499c2fa5db2966af78b58c138e3458c240d1e 100644 (file)
@@ -260,22 +260,20 @@ void wxFrame::DoSetClientSize(int width, int height)
 
 void wxFrame::DoGetSize(int *width, int *height) const
 {
-  RECT rect;
-  GetWindowRect(GetHwnd(), &rect);
-  *width = rect.right - rect.left;
-  *height = rect.bottom - rect.top;
+    RECT rect;
+    ::GetWindowRect(GetHwnd(), &rect);
+
+    *width = rect.right - rect.left;
+    *height = rect.bottom - rect.top;
 }
 
 void wxFrame::DoGetPosition(int *x, int *y) const
 {
-  RECT rect;
-  GetWindowRect(GetHwnd(), &rect);
-  POINT point;
-  point.x = rect.left;
-  point.y = rect.top;
+    RECT rect;
+    ::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;
     }