X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c085e333984dc079a001cd3f581aeb1f51a1f227..e66474166b164b9e11f9881e79d531bc5182ea31:/src/msw/stattext.cpp diff --git a/src/msw/stattext.cpp b/src/msw/stattext.cpp index e27866942b..2d56002296 100644 --- a/src/msw/stattext.cpp +++ b/src/msw/stattext.cpp @@ -21,7 +21,9 @@ #endif #ifndef WX_PRECOMP +#include "wx/event.h" #include "wx/app.h" +#include "wx/brush.h" #endif #include "wx/stattext.h" @@ -70,14 +72,14 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id, if ( wxStyleHasBorder(m_windowStyle) ) msStyle |= WS_BORDER; - m_hWnd = (WXHWND)::CreateWindowEx(MakeExtendedStyle(m_windowStyle), "STATIC", (const char *)label, + m_hWnd = (WXHWND)::CreateWindowEx(MakeExtendedStyle(m_windowStyle), _T("STATIC"), (const wxChar *)label, msStyle, 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId, wxGetInstance(), NULL); - wxCHECK_MSG( m_hWnd, FALSE, "Failed to create static ctrl" ); + wxCHECK_MSG( m_hWnd, FALSE, _T("Failed to create static ctrl") ); -#if CTL3D +#if wxUSE_CTL3D /* if (!(GetParent()->GetWindowStyleFlag() & wxUSER_COLOURS)) Ctl3dSubclassCtl(static_item); @@ -86,13 +88,13 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id, SubclassWin(m_hWnd); - SetFont(* parent->GetFont()); + SetFont(parent->GetFont()); SetSize(x, y, width, height); return TRUE; } -void wxStaticText::SetSize(int x, int y, int width, int height, int sizeFlags) +void wxStaticText::DoSetSize(int x, int y, int width, int height, int sizeFlags) { int currentX, currentY; GetPosition(¤tX, ¤tY); @@ -109,12 +111,11 @@ void wxStaticText::SetSize(int x, int y, int width, int height, int sizeFlags) int actualWidth = width; int actualHeight = height; - char buf[300]; int current_width; int cyf; - ::GetWindowText((HWND) GetHWND(), buf, 300); - GetTextExtent(buf, ¤t_width, &cyf, NULL, NULL,GetFont()); + wxString text(wxGetWindowText(GetHWND())); + GetTextExtent(text, ¤t_width, &cyf, NULL, NULL, & GetFont()); int ww, hh; GetSize(&ww, &hh); @@ -126,7 +127,7 @@ void wxStaticText::SetSize(int x, int y, int width, int height, int sizeFlags) { int cx; int cy; - wxGetCharSize(GetHWND(), &cx, &cy,GetFont()); + wxGetCharSize(GetHWND(), &cx, &cy, & GetFont()); actualWidth = (int)(current_width + cx) ; } @@ -143,14 +144,13 @@ void wxStaticText::SetSize(int x, int y, int width, int height, int sizeFlags) void wxStaticText::SetLabel(const wxString& label) { - int w, h; - RECT rect; - wxWindow *parent = GetParent(); + + RECT rect; GetWindowRect((HWND) GetHWND(), &rect); - // Since we now have the absolute screen coords, - // if there's a parent we must subtract its top left corner + // Since we now have the absolute screen coords, if there's a parent we must + // subtract its top left corner POINT point; point.x = rect.left; point.y = rect.top; @@ -159,17 +159,17 @@ void wxStaticText::SetLabel(const wxString& label) ::ScreenToClient((HWND) parent->GetHWND(), &point); } - GetTextExtent(label, &w, &h, NULL, NULL, GetFont()); - MoveWindow((HWND) GetHWND(), point.x, point.y, (int)(w + 10), (int)h, - TRUE); - SetWindowText((HWND) GetHWND(), (const char *)label); + int w, h; + GetTextExtent(label, &w, &h, NULL, NULL, & GetFont()); + MoveWindow((HWND) GetHWND(), point.x, point.y, (int)(w + 10), (int)h, TRUE); + SetWindowText((HWND) GetHWND(), (const wxChar *)label); } WXHBRUSH wxStaticText::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, WXUINT message, WXWPARAM wParam, WXLPARAM lParam) { /* -#if CTL3D +#if wxUSE_CTL3D if ( m_useCtl3D ) { HBRUSH hbrush = Ctl3dCtlColorEx(message, wParam, lParam);