X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5174130757185b012241369e7377454b2423e51e..cb73e6001f891ae46b12a1e4ca39b93649cb6099:/src/msw/window.cpp diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 1e9be60f14..88ff43ef91 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -230,40 +230,57 @@ static inline void wxBringWindowToTop(HWND hwnd) IMPLEMENT_ABSTRACT_CLASS(wxWindowMSW, wxWindowBase) #else // __WXMSW__ #if wxUSE_EXTENDED_RTTI + IMPLEMENT_DYNAMIC_CLASS_XTI(wxWindow, wxWindowBase,"wx/window.h") +// make wxWindowList known before the property is used + +template<> const wxTypeInfo* wxGetTypeInfo( wxWindowList * ) +{ + static wxCollectionTypeInfo s_typeInfo( (wxTypeInfo*) wxGetTypeInfo( (wxWindow **) NULL) ) ; + return &s_typeInfo ; +} + +template<> void wxCollectionToVariantArray( wxWindowList const &theList, wxxVariantArray &value) +{ + wxListCollectionToVariantArray( theList , value ) ; +} + WX_BEGIN_PROPERTIES_TABLE(wxWindow) // Always constructor Properties first WX_READONLY_PROPERTY( Parent,wxWindow*, GetParent, ) WX_PROPERTY( Id,wxWindowID, SetId, GetId, -1 ) - WX_PROPERTY_SET_BY_REF( Position,wxPoint, SetPosition , GetPosition, wxPoint(-1,-1) ) // pos - WX_PROPERTY_SET_BY_REF( Size,wxSize, SetSize, GetSize, wxSize(-1,-1) ) // size - WX_PROPERTY( WindowStyle , long , SetWindowStyle , GetWindowStyle , ) // style + WX_PROPERTY( Position,wxPoint, SetPosition , GetPosition, wxPoint(-1,-1) ) // pos + WX_PROPERTY( Size,wxSize, SetSize, GetSize, wxSize(-1,-1) ) // size + WX_PROPERTY( WindowStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , ) // style // Then all relations of the object graph - WX_READONLY_PROPERTY_COLLECTION( Children , wxWindowList , wxWindowBase* , GetChildren ) + WX_READONLY_PROPERTY_COLLECTION( Children , wxWindowList , wxWindowBase* , GetWindowChildren ) // and finally all other properties WX_PROPERTY( ExtraStyle , long , SetExtraStyle , GetExtraStyle , ) // extstyle - WX_PROPERTY_SET_BY_REF_RET_BOOL( BackgroundColour , wxColour , SetBackgroundColour , GetBackgroundColour , ) // bg - WX_PROPERTY_SET_BY_REF_RET_BOOL( ForegroundColour , wxColour , SetForegroundColour , GetForegroundColour , ) // fg - WX_PROPERTY_SET_RET_BOOL( Enabled , bool , Enable , IsEnabled , wxxVariant((bool)true) ) - WX_PROPERTY_SET_RET_BOOL( Shown , bool , Show , IsShown , wxxVariant((bool)true) ) + 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) ) #if 0 // possible property candidates (not in xrc) or not valid in all subclasses - WX_PROPERTY_SET_BY_REF( Title,wxString, SetTitle, GetTitle, wxT("") ) - WX_PROPERTY_SET_AND_GET_BY_REF_RET_BOOL( Font , wxFont , SetFont , GetFont , ) - WX_PROPERTY_SET_BY_REF( Label,wxString, SetLabel, GetLabel, wxT("") ) + WX_PROPERTY( Title,wxString, SetTitle, GetTitle, wxT("") ) + WX_PROPERTY( Font , wxFont , SetFont , GetWindowFont , ) + WX_PROPERTY( 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_SET_BY_REF( Cursor , wxCursor , SetCursor , GetCursor , ) + //WX_PROPERTY( Cursor , wxCursor , SetCursor , GetCursor , ) // WX_PROPERTY( ToolTip , wxString , SetToolTip , GetToolTipText , ) WX_PROPERTY( AutoLayout , bool , SetAutoLayout , GetAutoLayout , ) + + + #endif WX_END_PROPERTIES_TABLE() @@ -271,6 +288,7 @@ WX_BEGIN_HANDLERS_TABLE(wxWindow) WX_END_HANDLERS_TABLE() WX_CONSTRUCTOR_DUMMY(wxWindow) + #else IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowBase) #endif @@ -728,12 +746,6 @@ void wxWindowMSW::WarpPointer (int x, int y) } } -#if WXWIN_COMPATIBILITY -void wxWindowMSW::MSWDeviceToLogical (float *x, float *y) const -{ -} -#endif // WXWIN_COMPATIBILITY - // --------------------------------------------------------------------------- // scrolling stuff // --------------------------------------------------------------------------- @@ -744,48 +756,6 @@ static inline int wxDirToWinStyle(int orient) return orient == wxHORIZONTAL ? SB_HORZ : SB_VERT; } -#if WXWIN_COMPATIBILITY -void wxWindowMSW::SetScrollRange(int orient, int range, bool refresh) -{ - int range1 = range; - - // Try to adjust the range to cope with page size > 1 - // - a Windows API quirk - int pageSize = GetScrollPage(orient); - if ( pageSize > 1 && range > 0) - { - range1 += (pageSize - 1); - } - - WinStruct info; - info.nPage = pageSize; // Have to set this, or scrollbar goes awry - info.nMin = 0; - info.nMax = range1; - info.fMask = SIF_RANGE | SIF_PAGE; - - HWND hWnd = GetHwnd(); - if ( hWnd ) - ::SetScrollInfo(hWnd, wxDirToWinStyle(orient), &info, refresh); -} - -void wxWindowMSW::SetScrollPage(int orient, int page, bool refresh) -{ - WinStruct info; - info.nPage = page; - info.fMask = SIF_PAGE; - - HWND hWnd = GetHwnd(); - if ( hWnd ) - ::SetScrollInfo(hWnd, wxDirToWinStyle(orient), &info, refresh); -} - -int wxWindowMSW::GetScrollPage(int orient) const -{ - return orient == wxHORIZONTAL ? m_xThumbSize : m_yThumbSize; -} - -#endif // WXWIN_COMPATIBILITY - inline int GetScrollPosition(HWND hWnd, int wOrient) { #ifdef __WXMICROWIN__ @@ -1192,37 +1162,6 @@ WXDWORD wxWindowMSW::MSWGetStyle(long flags, WXDWORD *exstyle) const return style; } -#if WXWIN_COMPATIBILITY -// If nothing defined for this, try the parent. -// E.g. we may be a button loaded from a resource, with no callback function -// defined. -void wxWindowMSW::OnCommand(wxWindow& win, wxCommandEvent& event) -{ - if ( GetEventHandler()->ProcessEvent(event) ) - return; - if ( m_parent ) - m_parent->GetEventHandler()->OnCommand(win, event); -} -#endif // WXWIN_COMPATIBILITY_2 - -#if WXWIN_COMPATIBILITY -wxObject* wxWindowMSW::GetChild(int number) const -{ - // Return a pointer to the Nth object in the Panel - wxNode *node = GetChildren().First(); - int n = number; - while (node && n--) - node = node->Next(); - if ( node ) - { - wxObject *obj = (wxObject *)node->Data(); - return(obj); - } - else - return NULL; -} -#endif // WXWIN_COMPATIBILITY - // Setup background and foreground colours correctly void wxWindowMSW::SetupColours() { @@ -1714,48 +1653,6 @@ void wxWindowMSW::GetTextExtent(const wxString& string, *externalLeading = tm.tmExternalLeading; } -#if wxUSE_CARET && WXWIN_COMPATIBILITY -// --------------------------------------------------------------------------- -// Caret manipulation -// --------------------------------------------------------------------------- - -void wxWindowMSW::CreateCaret(int w, int h) -{ - SetCaret(new wxCaret(this, w, h)); -} - -void wxWindowMSW::CreateCaret(const wxBitmap *WXUNUSED(bitmap)) -{ - wxFAIL_MSG("not implemented"); -} - -void wxWindowMSW::ShowCaret(bool show) -{ - wxCHECK_RET( m_caret, "no caret to show" ); - - m_caret->Show(show); -} - -void wxWindowMSW::DestroyCaret() -{ - SetCaret(NULL); -} - -void wxWindowMSW::SetCaretPos(int x, int y) -{ - wxCHECK_RET( m_caret, "no caret to move" ); - - m_caret->Move(x, y); -} - -void wxWindowMSW::GetCaretPos(int *x, int *y) const -{ - wxCHECK_RET( m_caret, "no caret to get position of" ); - - m_caret->GetPosition(x, y); -} -#endif // wxUSE_CARET - // --------------------------------------------------------------------------- // popup menu // --------------------------------------------------------------------------- @@ -3579,7 +3476,7 @@ wxWindowMSW::MSWOnDrawItem(int WXUNUSED_UNLESS_ODRAWN(id), #endif // USE_OWNER_DRAWN -#if wxUSE_CONTROLS && !defined(__WXUNIVERSAL__) +#if wxUSE_CONTROLS && !defined(__WXUNIVERSAL__) #if wxUSE_OWNER_DRAWN wxControl *item = wxDynamicCast(FindItem(id), wxControl);