From 7a5e53abb3f9ea13eba2880972306446e4e21e83 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Thu, 24 Jun 2004 14:25:47 +0000 Subject: [PATCH] fixed warnings after GetFont prototype change git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28004 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/msw/private.h | 2 +- src/msw/button.cpp | 2 +- src/msw/listbox.cpp | 2 +- src/msw/radiobox.cpp | 4 ++-- src/msw/slider95.cpp | 4 ++-- src/msw/slidrmsw.cpp | 2 +- src/msw/spinctrl.cpp | 4 ++-- src/msw/statbox.cpp | 2 +- src/msw/textctrl.cpp | 2 +- src/msw/tglbtn.cpp | 2 +- src/msw/window.cpp | 22 ++++++++++------------ 11 files changed, 23 insertions(+), 25 deletions(-) diff --git a/include/wx/msw/private.h b/include/wx/msw/private.h index 31954e87c2..02c754a486 100644 --- a/include/wx/msw/private.h +++ b/include/wx/msw/private.h @@ -493,7 +493,7 @@ WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst); extern HCURSOR wxGetCurrentBusyCursor(); // from msw/utils.cpp extern const wxCursor *wxGetGlobalCursor(); // from msw/cursor.cpp -WXDLLEXPORT void wxGetCharSize(WXHWND wnd, int *x, int *y, const wxFont *the_font); +WXDLLEXPORT void wxGetCharSize(WXHWND wnd, int *x, int *y, const wxFont& the_font); WXDLLEXPORT void wxFillLogFont(LOGFONT *logFont, const wxFont *font); WXDLLEXPORT wxFont wxCreateFontFromLogFont(const LOGFONT *logFont); WXDLLEXPORT wxFontEncoding wxGetFontEncFromCharSet(int charset); diff --git a/src/msw/button.cpp b/src/msw/button.cpp index d0c52ac194..06e356af65 100644 --- a/src/msw/button.cpp +++ b/src/msw/button.cpp @@ -203,7 +203,7 @@ wxSize wxButton::DoGetBestSize() const GetTextExtent(wxGetWindowText(GetHWND()), &wBtn, NULL); int wChar, hChar; - wxGetCharSize(GetHWND(), &wChar, &hChar, &GetFont()); + wxGetCharSize(GetHWND(), &wChar, &hChar, GetFont()); // add a margin -- the button is wider than just its label wBtn += 3*wChar; diff --git a/src/msw/listbox.cpp b/src/msw/listbox.cpp index 35d90639e5..b3037577bc 100644 --- a/src/msw/listbox.cpp +++ b/src/msw/listbox.cpp @@ -682,7 +682,7 @@ wxSize wxListBox::DoGetBestSize() const // the listbox should be slightly larger than the widest string int cx, cy; - wxGetCharSize(GetHWND(), &cx, &cy, &GetFont()); + wxGetCharSize(GetHWND(), &cx, &cy, GetFont()); wListbox += 3*cx; diff --git a/src/msw/radiobox.cpp b/src/msw/radiobox.cpp index 1c2feaa680..4b8f7161b9 100644 --- a/src/msw/radiobox.cpp +++ b/src/msw/radiobox.cpp @@ -466,7 +466,7 @@ wxSize wxRadioBox::GetTotalButtonSize(const wxSize& sizeBtn) const { // the radiobox should be big enough for its buttons int cx1, cy1; - wxGetCharSize(m_hWnd, &cx1, &cy1, &GetFont()); + wxGetCharSize(m_hWnd, &cx1, &cy1, GetFont()); int extraHeight = cy1; @@ -525,7 +525,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) #endif int cx1, cy1; - wxGetCharSize(m_hWnd, &cx1, &cy1, & GetFont()); + wxGetCharSize(m_hWnd, &cx1, &cy1, GetFont()); // Attempt to have a look coherent with other platforms: We compute the // biggest toggle dim, then we align all items according this value. diff --git a/src/msw/slider95.cpp b/src/msw/slider95.cpp index 36e29a5da7..da8c466e96 100644 --- a/src/msw/slider95.cpp +++ b/src/msw/slider95.cpp @@ -469,7 +469,7 @@ void wxSlider95::DoSetSize(int x, int y, int width, int height, int sizeFlags) int cy; int cyf; - wxGetCharSize(GetHWND(), &cx, &cy, & this->GetFont()); + wxGetCharSize(GetHWND(), &cx, &cy, this->GetFont()); if ((m_windowStyle & wxSL_VERTICAL) != wxSL_VERTICAL) { @@ -633,7 +633,7 @@ wxSize wxSlider95::DoGetBestSize() const int min_len = 0; int max_len = 0; - wxGetCharSize(GetHWND(), &cx, &cy, & this->GetFont()); + wxGetCharSize(GetHWND(), &cx, &cy, this->GetFont()); if ( !HasFlag(wxSL_VERTICAL)) { diff --git a/src/msw/slidrmsw.cpp b/src/msw/slidrmsw.cpp index 48cfaf922a..d91a39733a 100644 --- a/src/msw/slidrmsw.cpp +++ b/src/msw/slidrmsw.cpp @@ -349,7 +349,7 @@ void wxSliderMSW::DoSetSize(int x, int y, int width, int height, int sizeFlags) int cy; int cyf; - wxGetCharSize(GetHWND(), &cx, &cy,& this->GetFont()); + wxGetCharSize(GetHWND(), &cx, &cy, this->GetFont()); if ((m_windowStyle & wxSL_VERTICAL) != wxSL_VERTICAL) { diff --git a/src/msw/spinctrl.cpp b/src/msw/spinctrl.cpp index a0be1e83d4..36396bf241 100644 --- a/src/msw/spinctrl.cpp +++ b/src/msw/spinctrl.cpp @@ -378,7 +378,7 @@ bool wxSpinCtrl::Create(wxWindow *parent, if ( sizeText.y <= 0 ) { int cx, cy; - wxGetCharSize(GetHWND(), &cx, &cy, &GetFont()); + wxGetCharSize(GetHWND(), &cx, &cy, GetFont()); sizeText.y = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy); } @@ -526,7 +526,7 @@ wxSize wxSpinCtrl::DoGetBestSize() const sizeBtn.x += DEFAULT_ITEM_WIDTH + MARGIN_BETWEEN; int y; - wxGetCharSize(GetHWND(), NULL, &y, &GetFont()); + wxGetCharSize(GetHWND(), NULL, &y, GetFont()); y = EDIT_HEIGHT_FROM_CHAR_HEIGHT(y); // JACS: we should always use the height calculated diff --git a/src/msw/statbox.cpp b/src/msw/statbox.cpp index 646fd62567..2edf27b718 100644 --- a/src/msw/statbox.cpp +++ b/src/msw/statbox.cpp @@ -143,7 +143,7 @@ bool wxStaticBox::Create(wxWindow *parent, wxSize wxStaticBox::DoGetBestSize() const { int cx, cy; - wxGetCharSize(GetHWND(), &cx, &cy, &GetFont()); + wxGetCharSize(GetHWND(), &cx, &cy, GetFont()); int wBox; GetTextExtent(wxGetWindowText(m_hWnd), &wBox, &cy); diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp index 25e2ec9055..6c52d71047 100644 --- a/src/msw/textctrl.cpp +++ b/src/msw/textctrl.cpp @@ -1932,7 +1932,7 @@ bool wxTextCtrl::AcceptsFocus() const wxSize wxTextCtrl::DoGetBestSize() const { int cx, cy; - wxGetCharSize(GetHWND(), &cx, &cy, &GetFont()); + wxGetCharSize(GetHWND(), &cx, &cy, GetFont()); int wText = DEFAULT_ITEM_WIDTH; diff --git a/src/msw/tglbtn.cpp b/src/msw/tglbtn.cpp index 02f1fc0f42..352e727c77 100644 --- a/src/msw/tglbtn.cpp +++ b/src/msw/tglbtn.cpp @@ -117,7 +117,7 @@ wxSize wxToggleButton::DoGetBestSize() const GetTextExtent(label, &wBtn, NULL); int wChar, hChar; - wxGetCharSize(GetHWND(), &wChar, &hChar, &GetFont()); + wxGetCharSize(GetHWND(), &wChar, &hChar, GetFont()); // add a margin - the button is wider than just its label wBtn += 3*wChar; diff --git a/src/msw/window.cpp b/src/msw/window.cpp index d7eb2be6f5..51552987e4 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -4887,22 +4887,21 @@ bool wxWindowMSW::MSWOnScroll(int orientation, WXWORD wParam, // global functions // =========================================================================== -void wxGetCharSize(WXHWND wnd, int *x, int *y, const wxFont *the_font) +void wxGetCharSize(WXHWND wnd, int *x, int *y, const wxFont& the_font) { TEXTMETRIC tm; HDC dc = ::GetDC((HWND) wnd); HFONT fnt =0; HFONT was = 0; - if ( the_font ) - { - // the_font->UseResource(); - // the_font->RealizeResource(); - fnt = (HFONT)((wxFont *)the_font)->GetResourceHandle(); // const_cast - if ( fnt ) - was = (HFONT) SelectObject(dc,fnt); - } + + // the_font.UseResource(); + // the_font.RealizeResource(); + fnt = (HFONT)the_font.GetResourceHandle(); // const_cast + if ( fnt ) + was = (HFONT) SelectObject(dc,fnt); + GetTextMetrics(dc, &tm); - if ( the_font && fnt && was ) + if ( fnt && was ) { SelectObject(dc,was); } @@ -4913,8 +4912,7 @@ void wxGetCharSize(WXHWND wnd, int *x, int *y, const wxFont *the_font) if ( y ) *y = tm.tmHeight + tm.tmExternalLeading; - // if ( the_font ) - // the_font->ReleaseResource(); + // the_font.ReleaseResource(); } // Returns 0 if was a normal ASCII value, not a special key. This indicates that -- 2.47.2