fixed warnings after GetFont prototype change

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28004 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2004-06-24 14:25:47 +00:00
parent c6eb778541
commit 7a5e53abb3
11 changed files with 23 additions and 25 deletions

View File

@@ -493,7 +493,7 @@ WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
extern HCURSOR wxGetCurrentBusyCursor(); // from msw/utils.cpp extern HCURSOR wxGetCurrentBusyCursor(); // from msw/utils.cpp
extern const wxCursor *wxGetGlobalCursor(); // from msw/cursor.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 void wxFillLogFont(LOGFONT *logFont, const wxFont *font);
WXDLLEXPORT wxFont wxCreateFontFromLogFont(const LOGFONT *logFont); WXDLLEXPORT wxFont wxCreateFontFromLogFont(const LOGFONT *logFont);
WXDLLEXPORT wxFontEncoding wxGetFontEncFromCharSet(int charset); WXDLLEXPORT wxFontEncoding wxGetFontEncFromCharSet(int charset);

View File

@@ -203,7 +203,7 @@ wxSize wxButton::DoGetBestSize() const
GetTextExtent(wxGetWindowText(GetHWND()), &wBtn, NULL); GetTextExtent(wxGetWindowText(GetHWND()), &wBtn, NULL);
int wChar, hChar; int wChar, hChar;
wxGetCharSize(GetHWND(), &wChar, &hChar, &GetFont()); wxGetCharSize(GetHWND(), &wChar, &hChar, GetFont());
// add a margin -- the button is wider than just its label // add a margin -- the button is wider than just its label
wBtn += 3*wChar; wBtn += 3*wChar;

View File

@@ -682,7 +682,7 @@ wxSize wxListBox::DoGetBestSize() const
// the listbox should be slightly larger than the widest string // the listbox should be slightly larger than the widest string
int cx, cy; int cx, cy;
wxGetCharSize(GetHWND(), &cx, &cy, &GetFont()); wxGetCharSize(GetHWND(), &cx, &cy, GetFont());
wListbox += 3*cx; wListbox += 3*cx;

View File

@@ -466,7 +466,7 @@ wxSize wxRadioBox::GetTotalButtonSize(const wxSize& sizeBtn) const
{ {
// the radiobox should be big enough for its buttons // the radiobox should be big enough for its buttons
int cx1, cy1; int cx1, cy1;
wxGetCharSize(m_hWnd, &cx1, &cy1, &GetFont()); wxGetCharSize(m_hWnd, &cx1, &cy1, GetFont());
int extraHeight = cy1; int extraHeight = cy1;
@@ -525,7 +525,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
#endif #endif
int cx1, cy1; 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 // Attempt to have a look coherent with other platforms: We compute the
// biggest toggle dim, then we align all items according this value. // biggest toggle dim, then we align all items according this value.

View File

@@ -469,7 +469,7 @@ void wxSlider95::DoSetSize(int x, int y, int width, int height, int sizeFlags)
int cy; int cy;
int cyf; int cyf;
wxGetCharSize(GetHWND(), &cx, &cy, & this->GetFont()); wxGetCharSize(GetHWND(), &cx, &cy, this->GetFont());
if ((m_windowStyle & wxSL_VERTICAL) != wxSL_VERTICAL) if ((m_windowStyle & wxSL_VERTICAL) != wxSL_VERTICAL)
{ {
@@ -633,7 +633,7 @@ wxSize wxSlider95::DoGetBestSize() const
int min_len = 0; int min_len = 0;
int max_len = 0; int max_len = 0;
wxGetCharSize(GetHWND(), &cx, &cy, & this->GetFont()); wxGetCharSize(GetHWND(), &cx, &cy, this->GetFont());
if ( !HasFlag(wxSL_VERTICAL)) if ( !HasFlag(wxSL_VERTICAL))
{ {

View File

@@ -349,7 +349,7 @@ void wxSliderMSW::DoSetSize(int x, int y, int width, int height, int sizeFlags)
int cy; int cy;
int cyf; int cyf;
wxGetCharSize(GetHWND(), &cx, &cy,& this->GetFont()); wxGetCharSize(GetHWND(), &cx, &cy, this->GetFont());
if ((m_windowStyle & wxSL_VERTICAL) != wxSL_VERTICAL) if ((m_windowStyle & wxSL_VERTICAL) != wxSL_VERTICAL)
{ {

View File

@@ -378,7 +378,7 @@ bool wxSpinCtrl::Create(wxWindow *parent,
if ( sizeText.y <= 0 ) if ( sizeText.y <= 0 )
{ {
int cx, cy; int cx, cy;
wxGetCharSize(GetHWND(), &cx, &cy, &GetFont()); wxGetCharSize(GetHWND(), &cx, &cy, GetFont());
sizeText.y = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy); sizeText.y = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy);
} }
@@ -526,7 +526,7 @@ wxSize wxSpinCtrl::DoGetBestSize() const
sizeBtn.x += DEFAULT_ITEM_WIDTH + MARGIN_BETWEEN; sizeBtn.x += DEFAULT_ITEM_WIDTH + MARGIN_BETWEEN;
int y; int y;
wxGetCharSize(GetHWND(), NULL, &y, &GetFont()); wxGetCharSize(GetHWND(), NULL, &y, GetFont());
y = EDIT_HEIGHT_FROM_CHAR_HEIGHT(y); y = EDIT_HEIGHT_FROM_CHAR_HEIGHT(y);
// JACS: we should always use the height calculated // JACS: we should always use the height calculated

View File

@@ -143,7 +143,7 @@ bool wxStaticBox::Create(wxWindow *parent,
wxSize wxStaticBox::DoGetBestSize() const wxSize wxStaticBox::DoGetBestSize() const
{ {
int cx, cy; int cx, cy;
wxGetCharSize(GetHWND(), &cx, &cy, &GetFont()); wxGetCharSize(GetHWND(), &cx, &cy, GetFont());
int wBox; int wBox;
GetTextExtent(wxGetWindowText(m_hWnd), &wBox, &cy); GetTextExtent(wxGetWindowText(m_hWnd), &wBox, &cy);

View File

@@ -1932,7 +1932,7 @@ bool wxTextCtrl::AcceptsFocus() const
wxSize wxTextCtrl::DoGetBestSize() const wxSize wxTextCtrl::DoGetBestSize() const
{ {
int cx, cy; int cx, cy;
wxGetCharSize(GetHWND(), &cx, &cy, &GetFont()); wxGetCharSize(GetHWND(), &cx, &cy, GetFont());
int wText = DEFAULT_ITEM_WIDTH; int wText = DEFAULT_ITEM_WIDTH;

View File

@@ -117,7 +117,7 @@ wxSize wxToggleButton::DoGetBestSize() const
GetTextExtent(label, &wBtn, NULL); GetTextExtent(label, &wBtn, NULL);
int wChar, hChar; int wChar, hChar;
wxGetCharSize(GetHWND(), &wChar, &hChar, &GetFont()); wxGetCharSize(GetHWND(), &wChar, &hChar, GetFont());
// add a margin - the button is wider than just its label // add a margin - the button is wider than just its label
wBtn += 3*wChar; wBtn += 3*wChar;

View File

@@ -4887,22 +4887,21 @@ bool wxWindowMSW::MSWOnScroll(int orientation, WXWORD wParam,
// global functions // 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; TEXTMETRIC tm;
HDC dc = ::GetDC((HWND) wnd); HDC dc = ::GetDC((HWND) wnd);
HFONT fnt =0; HFONT fnt =0;
HFONT was = 0; HFONT was = 0;
if ( the_font )
{ // the_font.UseResource();
// the_font->UseResource(); // the_font.RealizeResource();
// the_font->RealizeResource(); fnt = (HFONT)the_font.GetResourceHandle(); // const_cast
fnt = (HFONT)((wxFont *)the_font)->GetResourceHandle(); // const_cast if ( fnt )
if ( fnt ) was = (HFONT) SelectObject(dc,fnt);
was = (HFONT) SelectObject(dc,fnt);
}
GetTextMetrics(dc, &tm); GetTextMetrics(dc, &tm);
if ( the_font && fnt && was ) if ( fnt && was )
{ {
SelectObject(dc,was); SelectObject(dc,was);
} }
@@ -4913,8 +4912,7 @@ void wxGetCharSize(WXHWND wnd, int *x, int *y, const wxFont *the_font)
if ( y ) if ( y )
*y = tm.tmHeight + tm.tmExternalLeading; *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 // Returns 0 if was a normal ASCII value, not a special key. This indicates that