// send a notification event, return TRUE if processed
bool SendClickEvent();
- virtual wxSize DoGetBestSize();
+ virtual wxSize DoGetBestSize() const;
};
#endif
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
protected:
- virtual wxSize DoGetBestSize();
+ virtual wxSize DoGetBestSize() const;
};
class WXDLLEXPORT wxBitmapCheckBox: public wxCheckBox
virtual wxClientData* DoGetItemClientObject( int n ) const;
// OS2 implementation
- virtual wxSize DoGetBestSize();
+ virtual wxSize DoGetBestSize() const;
virtual void DoSetSize(int x, int y,
int width, int height,
int sizeFlags = wxSIZE_AUTO);
// For controls like radiobuttons which are really composite
wxList m_subControls;
- virtual wxSize DoGetBestSize();
+ virtual wxSize DoGetBestSize() const;
// create the control of the given class with the given style, returns FALSE
// if creation failed
int m_noItems;
int m_selected;
- virtual wxSize DoGetBestSize();
+ virtual wxSize DoGetBestSize() const;
#if wxUSE_OWNER_DRAWN
// control items
,int maxVal
);
- // Implementation
+ // Implementation
virtual bool OS2Command( WXUINT param
,WXWORD id
);
);
protected:
- virtual wxSize DoGetBestSize();
+ virtual wxSize DoGetBestSize() const;
private:
DECLARE_DYNAMIC_CLASS(wxSpinButton)
};
wxBitmap *bitmap;
} m_image;
- virtual wxSize DoGetBestSize();
+ virtual wxSize DoGetBestSize() const;
};
#endif
virtual bool AcceptsFocus() const { return FALSE; }
protected:
- virtual wxSize DoGetBestSize();
+ virtual wxSize DoGetBestSize() const;
private:
DECLARE_EVENT_TABLE()
virtual MRESULT OS2WindowProc(HWND hwnd, WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
protected:
- virtual wxSize DoGetBestSize();
+ virtual wxSize DoGetBestSize() const;
};
#endif
// limit is big enough)
void AdjustSpaceLimit();
- virtual wxSize DoGetBestSize();
+ virtual wxSize DoGetBestSize() const;
private:
DECLARE_EVENT_TABLE()
,int nHeight
);
- // get the size which best suits the window: e.g., for a static text it
- // will be the width and height of the text
- virtual wxSize DoGetBestSize(void);
-
// move the window to the specified location and resize it: this is called
// from both DoSetSize() and DoSetClientSize() and would usually just call
// ::MoveWindow() except for composite controls which will want to arrange
// size management including autosizing
// ----------------------------------------------------------------------------
-wxSize wxButton::DoGetBestSize()
+wxSize wxButton::DoGetBestSize() const
{
wxString label = wxGetWindowText(GetHWND());
int wBtn;
GetTextExtent(label, &wBtn, NULL);
int wChar, hChar;
- wxGetCharSize(GetHWND(), &wChar, &hChar, &GetFont());
+ wxGetCharSize(GetHWND(), &wChar, &hChar, (wxFont*)&GetFont());
// add a margin - the button is wider than just its label
wBtn += 3*wChar;
// TODO
}
-wxSize wxCheckBox::DoGetBestSize()
+wxSize wxCheckBox::DoGetBestSize() const
{
int wCheckbox, hCheckbox;
wxControl::DoSetSize(x, y, width, -1, sizeFlags);
}
-wxSize wxChoice::DoGetBestSize()
+wxSize wxChoice::DoGetBestSize() const
{
// find the widest string
int wLine;
// the combobox should be larger than the widest string
int cx, cy;
- wxGetCharSize(GetHWND(), &cx, &cy, &GetFont());
+ wxGetCharSize(GetHWND(), &cx, &cy, (wxFont*)&GetFont());
wChoice += 5*cx;
return TRUE;
}
-wxSize wxControl::DoGetBestSize()
+wxSize wxControl::DoGetBestSize() const
{
return wxSize(DEFAULT_ITEM_WIDTH, DEFAULT_ITEM_HEIGHT);
}
*/
}
-wxSize wxListBox::DoGetBestSize()
+wxSize wxListBox::DoGetBestSize() const
{
// find the widest string
int wLine;
// the listbox should be slightly larger than the widest string
int cx, cy;
- wxGetCharSize(GetHWND(), &cx, &cy, &GetFont());
+ wxGetCharSize(GetHWND(), &cx, &cy, (wxFont*)&GetFont());
wListbox += 3*cx;
// size calculation
// ----------------------------------------------------------------------------
-wxSize wxSpinButton::DoGetBestSize()
+wxSize wxSpinButton::DoGetBestSize() const
{
// TODO:
/*
m_image.icon = NULL;
}
-wxSize wxStaticBitmap::DoGetBestSize()
+wxSize wxStaticBitmap::DoGetBestSize() const
{
// reuse the current size (as wxWindow does) instead of using some
// arbitrary default size (as wxControl, our immediate base class, does)
return FALSE;
}
-wxSize wxStaticBox::DoGetBestSize()
+wxSize wxStaticBox::DoGetBestSize() const
{
int cx, cy;
- wxGetCharSize(GetHWND(), &cx, &cy, &GetFont());
+ wxGetCharSize(GetHWND(), &cx, &cy, (wxFont*)&GetFont());
int wBox;
GetTextExtent(wxGetWindowText(m_hWnd), &wBox, &cy);
return FALSE;
}
-wxSize wxStaticText::DoGetBestSize()
+wxSize wxStaticText::DoGetBestSize() const
{
wxString text(wxGetWindowText(GetHWND()));
int widthTextMax = 0, widthLine,
- heightTextTotal = 0, heightLine;
+ heightTextTotal = 0, heightLineDefault = 0, heightLine = 0;
wxString curLine;
for ( const wxChar *pc = text; ; pc++ ) {
if ( *pc == wxT('\n') || *pc == wxT('\0') ) {
- GetTextExtent(curLine, &widthLine, &heightLine);
- if ( widthLine > widthTextMax )
- widthTextMax = widthLine;
- heightTextTotal += heightLine;
+ if ( !curLine ) {
+ // we can't use GetTextExtent - it will return 0 for both width
+ // and height and an empty line should count in height
+ // calculation
+ if ( !heightLineDefault )
+ heightLineDefault = heightLine;
+ if ( !heightLineDefault )
+ GetTextExtent(_T("W"), NULL, &heightLineDefault);
+
+ heightTextTotal += heightLineDefault;
+ }
+ else {
+ GetTextExtent(curLine, &widthLine, &heightLine);
+ if ( widthLine > widthTextMax )
+ widthTextMax = widthLine;
+ heightTextTotal += heightLine;
+ }
if ( *pc == wxT('\n') ) {
curLine.Empty();
return IsEditable() && wxControl::AcceptsFocus();
}
-wxSize wxTextCtrl::DoGetBestSize()
+wxSize wxTextCtrl::DoGetBestSize() const
{
int cx, cy;
- wxGetCharSize(GetHWND(), &cx, &cy, &GetFont());
+ wxGetCharSize(GetHWND(), &cx, &cy, (wxFont*)&GetFont());
int wText = DEFAULT_ITEM_WIDTH;
}
}
-// ----------------------------------------------------------------------------
-// wxCriticalSection implementation
-// ----------------------------------------------------------------------------
-
-class wxCriticalSectionInternal
-{
-public:
- // init the critical section object
- wxCriticalSectionInternal()
- { }
-
- // free the associated ressources
- ~wxCriticalSectionInternal()
- { }
-
-private:
-};
-
-// ----------------------------------------------------------------------------
-// wxCriticalSection implementation
-// ----------------------------------------------------------------------------
-
-wxCriticalSection::wxCriticalSection()
-{
- m_critsect = new wxCriticalSectionInternal;
-}
-
-wxCriticalSection::~wxCriticalSection()
-{
- delete m_critsect;
-}
-
-void wxCriticalSection::Enter()
-{
- ::DosEnterCritSec();
-}
-
-void wxCriticalSection::Leave()
-{
- ::DosExitCritSec();
-}
-
// ----------------------------------------------------------------------------
// wxThread implementation
// ----------------------------------------------------------------------------
// TODO:
}
-// for a generic window there is no natural best size - just use the current one
-wxSize wxWindow::DoGetBestSize()
-{
- return GetSize();
-}
-
void wxWindow::DoSetClientSize(int width, int height)
{
// TODO: