X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/45fcbf3b7a7c9cfd96e67278e4eaa12e8e015651..10992a81d39da31b79063387b7b71c0ff68737ce:/src/os2/control.cpp diff --git a/src/os2/control.cpp b/src/os2/control.cpp index 9d80a1c83b..ada5a5e055 100644 --- a/src/os2/control.cpp +++ b/src/os2/control.cpp @@ -21,16 +21,14 @@ #include "wx/app.h" #include "wx/dcclient.h" #endif - +#include "wx/os2/private.h" #include "wx/control.h" -#if !USE_SHARED_LIBRARY IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow) BEGIN_EVENT_TABLE(wxControl, wxWindow) EVT_ERASE_BACKGROUND(wxControl::OnEraseBackground) END_EVENT_TABLE() -#endif // Item members wxControl::wxControl() @@ -43,20 +41,59 @@ wxControl::wxControl() #endif // WXWIN_COMPATIBILITY } +bool wxControl::Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, long style, +#if wxUSE_VALIDATORS + const wxValidator& validator, +#endif + const wxString& name) +{ + bool rval = wxWindow::Create(parent, id, pos, size, style, name); + if (rval) { +#if wxUSE_VALIDATORS + SetValidator(validator); +#endif + } + return rval; +} + wxControl::~wxControl() { m_isBeingDeleted = TRUE; } -bool wxControl::OS2CreateControl(const wxChar *classname, WXDWORD style) +bool wxControl::OS2CreateControl(const wxChar *classname, + WXDWORD style, + const wxPoint& pos, + const wxSize& size, + const wxString& label, + WXDWORD exstyle) { + // VZ: if someone could put a comment here explaining what exactly this is + // needed for, it would be nice... + bool want3D; + + // if no extended style given, determine it ourselves + if ( exstyle == (WXDWORD)-1 ) + { + exstyle = GetExStyle(style); + } + +// TODO: +/* + // all controls have these childs (wxWindows creates all controls visible + // by default) + style |= WS_CHILD | WS_VISIBLE; + m_hWnd = (WXHWND)::CreateWindowEx ( - GetExStyle(style), // extended style + exstyle, // extended style classname, // the kind of control to create - NULL, // the window name + label, // the window name style, // the window style - 0, 0, 0, 0, // the window position and size + pos.x, pos.y, // the window position + size.x, size.y, // and size GetHwndOf(GetParent()), // parent (HMENU)GetId(), // child id wxGetInstance(), // app instance @@ -66,22 +103,30 @@ bool wxControl::OS2CreateControl(const wxChar *classname, WXDWORD style) if ( !m_hWnd ) { #ifdef __WXDEBUG__ - wxLogError(_T("Failed to create a control of class '%s'"), classname); + wxLogError(wxT("Failed to create a control of class '%s'"), classname); #endif // DEBUG return FALSE; } +#if wxUSE_CTL3D + if ( want3D ) + { + Ctl3dSubclassCtl(GetHwnd()); + m_useCtl3D = TRUE; + } +#endif // wxUSE_CTL3D + // subclass again for purposes of dialog editing mode SubclassWin(m_hWnd); // controls use the same font and colours as their parent dialog by default InheritAttributes(); - +*/ return TRUE; } -wxSize wxControl::DoGetBestSize() +wxSize wxControl::DoGetBestSize() const { return wxSize(DEFAULT_ITEM_WIDTH, DEFAULT_ITEM_HEIGHT); } @@ -107,6 +152,7 @@ bool wxControl::OS2OnNotify(int idCtrl, { wxCommandEvent event(wxEVT_NULL, m_windowId); wxEventType eventType = wxEVT_NULL; +/* TODO: NMHDR *hdr1 = (NMHDR*) lParam; switch ( hdr1->code ) { @@ -141,7 +187,7 @@ bool wxControl::OS2OnNotify(int idCtrl, default: return wxWindow::OS2OnNotify(idCtrl, lParam, result); } - +*/ event.SetEventType(eventType); event.SetEventObject(this); @@ -177,10 +223,12 @@ WXDWORD wxControl::GetExStyle(WXDWORD& style) const bool want3D; WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D) ; - // Even with extended styles, need to combine with WS_BORDER - // for them to look right. + // Even with extended styles, need to combine with FS_BORDER + // for them to look right. Check it out later, base window style does + // not designate BORDERS. Down in Frame and And controls. + if ( want3D || wxStyleHasBorder(m_windowStyle) ) - style |= WS_BORDER; + style |= FS_BORDER; return exStyle; } @@ -196,26 +244,26 @@ WXDWORD wxControl::GetExStyle(WXDWORD& style) const // to calculate largest bounding rectangle. void wxFindMaxSize(WXHWND wnd, RECT *rect) { - int left = rect->left; - int right = rect->right; - int top = rect->top; - int bottom = rect->bottom; + int left = rect->xLeft; + int right = rect->xRight; + int top = rect->yTop; + int bottom = rect->yBottom; - GetWindowRect((HWND) wnd, rect); + ::WinQueryWindowRect((HWND) wnd, rect); if (left < 0) return; - if (left < rect->left) - rect->left = left; + if (left < rect->xLeft) + rect->xLeft = left; - if (right > rect->right) - rect->right = right; + if (right > rect->xRight) + rect->xRight = right; - if (top < rect->top) - rect->top = top; + if (top < rect->yTop) + rect->yTop = top; - if (bottom > rect->bottom) - rect->bottom = bottom; + if (bottom > rect->yBottom) + rect->yBottom = bottom; }