::GetWindowText() -> wxGetWindowText

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2061 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-04-07 12:35:36 +00:00
parent b66e7a06b5
commit 1baa5e4ab5

View File

@@ -111,12 +111,11 @@ void wxStaticText::DoSetSize(int x, int y, int width, int height, int sizeFlags)
int actualWidth = width; int actualWidth = width;
int actualHeight = height; int actualHeight = height;
char buf[300];
int current_width; int current_width;
int cyf; int cyf;
::GetWindowText((HWND) GetHWND(), buf, 300); wxString text(wxGetWindowText(GetHWND()));
GetTextExtent(buf, &current_width, &cyf, NULL, NULL, & this->GetFont()); GetTextExtent(text, &current_width, &cyf, NULL, NULL, & GetFont());
int ww, hh; int ww, hh;
GetSize(&ww, &hh); GetSize(&ww, &hh);
@@ -128,7 +127,7 @@ void wxStaticText::DoSetSize(int x, int y, int width, int height, int sizeFlags)
{ {
int cx; int cx;
int cy; int cy;
wxGetCharSize(GetHWND(), &cx, &cy, & this->GetFont()); wxGetCharSize(GetHWND(), &cx, &cy, & GetFont());
actualWidth = (int)(current_width + cx) ; actualWidth = (int)(current_width + cx) ;
} }
@@ -145,14 +144,13 @@ void wxStaticText::DoSetSize(int x, int y, int width, int height, int sizeFlags)
void wxStaticText::SetLabel(const wxString& label) void wxStaticText::SetLabel(const wxString& label)
{ {
int w, h;
RECT rect;
wxWindow *parent = GetParent(); wxWindow *parent = GetParent();
RECT rect;
GetWindowRect((HWND) GetHWND(), &rect); GetWindowRect((HWND) GetHWND(), &rect);
// Since we now have the absolute screen coords, // Since we now have the absolute screen coords, if there's a parent we must
// if there's a parent we must subtract its top left corner // subtract its top left corner
POINT point; POINT point;
point.x = rect.left; point.x = rect.left;
point.y = rect.top; point.y = rect.top;
@@ -161,9 +159,9 @@ void wxStaticText::SetLabel(const wxString& label)
::ScreenToClient((HWND) parent->GetHWND(), &point); ::ScreenToClient((HWND) parent->GetHWND(), &point);
} }
GetTextExtent(label, &w, &h, NULL, NULL, & this->GetFont()); int w, h;
MoveWindow((HWND) GetHWND(), point.x, point.y, (int)(w + 10), (int)h, GetTextExtent(label, &w, &h, NULL, NULL, & GetFont());
TRUE); MoveWindow((HWND) GetHWND(), point.x, point.y, (int)(w + 10), (int)h, TRUE);
SetWindowText((HWND) GetHWND(), (const char *)label); SetWindowText((HWND) GetHWND(), (const char *)label);
} }