]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/window.cpp
added live resizing
[wxWidgets.git] / src / msw / window.cpp
index 8e8603fcb658dca3d97534fca278a0cdb57efed2..a40b07091228800dd7760245c3ebe982ee614836 100644 (file)
@@ -91,6 +91,7 @@
 
 #include "wx/textctrl.h"
 #include "wx/notebook.h"
+#include "wx/listctrl.h"
 
 #include <string.h>
 
@@ -231,63 +232,107 @@ static inline void wxBringWindowToTop(HWND hwnd)
 #else // __WXMSW__
 #if wxUSE_EXTENDED_RTTI
 
-IMPLEMENT_DYNAMIC_CLASS_XTI(wxWindow, wxWindowBase,"wx/window.h")
+// windows that are created from a parent window during its Create method, eg. spin controls in a calendar controls
+// must never been streamed out separately otherwise chaos occurs. Right now easiest is to test for negative ids, as
+// windows with negative ids never can be recreated anyway
 
-// make wxWindowList known before the property is used
-
-template<> const wxTypeInfo* wxGetTypeInfo( wxWindowList * )
+bool wxWindowStreamingCallback( const wxObject *object, wxWriter * , wxPersister * , wxxVariantArray & )
 {
-    static wxCollectionTypeInfo s_typeInfo( (wxTypeInfo*) wxGetTypeInfo( (wxWindow **) NULL) ) ;
-    return &s_typeInfo ;
+    const wxWindow * win = dynamic_cast<const wxWindow*>(object) ;
+    if ( win && win->GetId() < 0 )
+        return false ;
+    return true ;
 }
 
+IMPLEMENT_DYNAMIC_CLASS_XTI_CALLBACK(wxWindow, wxWindowBase,"wx/window.h", wxWindowStreamingCallback)
+
+// make wxWindowList known before the property is used
+
+wxCOLLECTION_TYPE_INFO( wxWindow* , wxWindowList ) ;
+
 template<> void wxCollectionToVariantArray( wxWindowList const &theList, wxxVariantArray &value)
 {
-    wxListCollectionToVariantArray( theList , value ) ;
-}
-
-WX_BEGIN_PROPERTIES_TABLE(wxWindow)
+    wxListCollectionToVariantArray<wxWindowList::compatibility_iterator>( theList , value ) ;
+}
+
+WX_DEFINE_FLAGS( wxWindowStyle )
+
+wxBEGIN_FLAGS( wxWindowStyle )
+    // new style border flags, we put them first to
+    // use them for streaming out
+
+    wxFLAGS_MEMBER(wxBORDER_SIMPLE)
+    wxFLAGS_MEMBER(wxBORDER_SUNKEN)
+    wxFLAGS_MEMBER(wxBORDER_DOUBLE)
+    wxFLAGS_MEMBER(wxBORDER_RAISED)
+    wxFLAGS_MEMBER(wxBORDER_STATIC)
+    wxFLAGS_MEMBER(wxBORDER_NONE)
+    
+    // old style border flags
+    wxFLAGS_MEMBER(wxSIMPLE_BORDER)
+    wxFLAGS_MEMBER(wxSUNKEN_BORDER)
+    wxFLAGS_MEMBER(wxDOUBLE_BORDER)
+    wxFLAGS_MEMBER(wxRAISED_BORDER)
+    wxFLAGS_MEMBER(wxSTATIC_BORDER)
+    wxFLAGS_MEMBER(wxNO_BORDER)
+
+    // standard window styles
+    wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
+    wxFLAGS_MEMBER(wxCLIP_CHILDREN)
+    wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
+    wxFLAGS_MEMBER(wxWANTS_CHARS)
+    wxFLAGS_MEMBER(wxNO_FULL_REPAINT_ON_RESIZE)
+    wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
+    wxFLAGS_MEMBER(wxVSCROLL)
+    wxFLAGS_MEMBER(wxHSCROLL)
+
+wxEND_FLAGS( wxWindowStyle )
+
+wxBEGIN_PROPERTIES_TABLE(wxWindow)
+       wxEVENT_PROPERTY( Close , wxEVT_CLOSE_WINDOW , wxCloseEvent)
+       wxEVENT_PROPERTY( Create , wxEVT_CREATE , wxWindowCreateEvent )
+       wxEVENT_PROPERTY( Destroy , wxEVT_DESTROY , wxWindowDestroyEvent )
     // Always constructor Properties first
 
-    WX_READONLY_PROPERTY( Parent,wxWindow*, GetParent,  )
-       WX_PROPERTY( Id,wxWindowID, SetId, GetId, -1 )
-       WX_PROPERTY( Position,wxPoint, SetWindowPosition , GetWindowPosition, wxPoint(-1,-1) ) // pos
-       WX_PROPERTY( Size,wxSize, SetWindowSize, GetWindowSize, wxSize(-1,-1) ) // size
-    WX_PROPERTY( WindowStyle , long , SetWindowStyle , GetWindowStyle , ) // style
+    wxREADONLY_PROPERTY( Parent,wxWindow*, GetParent,  , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
+       wxPROPERTY( Id,wxWindowID, SetId, GetId, -1, 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
+       wxPROPERTY( Position,wxPoint, SetPosition , GetPosition, wxPoint(-1,-1) , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // pos
+       wxPROPERTY( Size,wxSize, SetSize, GetSize, wxSize(-1,-1) , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // size
+    wxPROPERTY( WindowStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
 
     // Then all relations of the object graph
 
-    WX_READONLY_PROPERTY_COLLECTION( Children , wxWindowList , wxWindowBase* , GetWindowChildren )
+    wxREADONLY_PROPERTY_COLLECTION( Children , wxWindowList , wxWindowBase* , GetWindowChildren , wxPROP_OBJECT_GRAPH /*flags*/ , wxT("Helpstring") , wxT("group"))
 
    // and finally all other properties
 
-       WX_PROPERTY( ExtraStyle , long , SetExtraStyle , GetExtraStyle , ) // extstyle
-       WX_PROPERTY( BackgroundColour , wxColour , SetBackgroundColour , GetBackgroundColour , ) // bg
-       WX_PROPERTY( ForegroundColour , wxColour , SetForegroundColour , GetForegroundColour , ) // fg
-       WX_PROPERTY( Enabled , bool , Enable , IsEnabled , wxxVariant((bool)true) )
-       WX_PROPERTY( Shown , bool , Show , IsShown , wxxVariant((bool)true) )
+       wxPROPERTY( ExtraStyle , long , SetExtraStyle , GetExtraStyle , , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // extstyle
+       wxPROPERTY( BackgroundColour , wxColour , SetBackgroundColour , GetBackgroundColour , , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // bg
+       wxPROPERTY( ForegroundColour , wxColour , SetForegroundColour , GetForegroundColour , , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // fg
+       wxPROPERTY( Enabled , bool , Enable , IsEnabled , wxxVariant((bool)true) , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
+       wxPROPERTY( Shown , bool , Show , IsShown , wxxVariant((bool)true) , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
 #if 0
     // possible property candidates (not in xrc) or not valid in all subclasses
-       WX_PROPERTY( Title,wxString, SetTitle, GetTitle, wxT("") )
-       WX_PROPERTY( Font , wxFont , SetFont , GetWindowFont  , )
-       WX_PROPERTY( Label,wxString, SetLabel, GetLabel, wxT("") )
+       wxPROPERTY( Title,wxString, SetTitle, GetTitle, wxT("") )
+       wxPROPERTY( Font , wxFont , SetFont , GetWindowFont  , )
+       wxPROPERTY( Label,wxString, SetLabel, GetLabel, wxT("") )
        // MaxHeight, Width , MinHeight , Width
        // TODO switch label to control and title to toplevels
 
-       WX_PROPERTY( ThemeEnabled , bool , SetThemeEnabled , GetThemeEnabled , )
-       //WX_PROPERTY( Cursor , wxCursor , SetCursor , GetCursor , )
-       // WX_PROPERTY( ToolTip , wxString , SetToolTip , GetToolTipText , )
-       WX_PROPERTY( AutoLayout , bool , SetAutoLayout , GetAutoLayout , )
+       wxPROPERTY( ThemeEnabled , bool , SetThemeEnabled , GetThemeEnabled , )
+       //wxPROPERTY( Cursor , wxCursor , SetCursor , GetCursor , )
+       // wxPROPERTY( ToolTip , wxString , SetToolTip , GetToolTipText , )
+       wxPROPERTY( AutoLayout , bool , SetAutoLayout , GetAutoLayout , )
 
 
 
 #endif
-WX_END_PROPERTIES_TABLE()
+wxEND_PROPERTIES_TABLE()
 
-WX_BEGIN_HANDLERS_TABLE(wxWindow)
-WX_END_HANDLERS_TABLE()
+wxBEGIN_HANDLERS_TABLE(wxWindow)
+wxEND_HANDLERS_TABLE()
 
-WX_CONSTRUCTOR_DUMMY(wxWindow)
+wxCONSTRUCTOR_DUMMY(wxWindow)
 
 #else
     IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowBase)
@@ -2276,6 +2321,20 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam
                 break;
             }
 
+        case WM_PRINT:
+            {
+                // Don't call the wx handlers in this case
+                if ( wxIsKindOf(this, wxListCtrl) )
+                    break;
+
+                if ( lParam & PRF_ERASEBKGND )
+                    HandleEraseBkgnd((WXHDC)(HDC)wParam);
+
+                wxPaintDCEx dc((wxWindow *)this, (WXHDC)wParam);
+                processed = HandlePaint();
+            }
+            break;
+
         case WM_CLOSE:
 #ifdef __WXUNIVERSAL__
             // Universal uses its own wxFrame/wxDialog, so we don't receive