wxWindow::GetBestSize() added
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4633 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1051,7 +1051,7 @@ See also \helpref{wxDDEServer}{wxddeserver}, \helpref{wxDDEClient}{wxddeclient},
|
|||||||
|
|
||||||
\func{void}{wxDebugMsg}{\param{const wxString\& }{fmt}, \param{...}{}}
|
\func{void}{wxDebugMsg}{\param{const wxString\& }{fmt}, \param{...}{}}
|
||||||
|
|
||||||
{\bf This function is deprecated, use \helpref{wxLogDebug}{wxlogoverview} instead!}
|
{\bf This function is deprecated, use \helpref{wxLogDebug}{wxlogdebug} instead!}
|
||||||
|
|
||||||
Display a debugging message; under Windows, this will appear on the
|
Display a debugging message; under Windows, this will appear on the
|
||||||
debugger command window, and under Unix, it will be written to standard
|
debugger command window, and under Unix, it will be written to standard
|
||||||
@@ -2285,7 +2285,9 @@ Another name for \helpref{wxResourceRegisterBitmapData}{registerbitmapdata}.
|
|||||||
\section{Log functions}\label{logfunctions}
|
\section{Log functions}\label{logfunctions}
|
||||||
|
|
||||||
These functions provide a variety of logging functions: see \helpref{Log classes overview}{wxlogoverview} for
|
These functions provide a variety of logging functions: see \helpref{Log classes overview}{wxlogoverview} for
|
||||||
further information.
|
further information. The functions use (implicitly) the currently active log
|
||||||
|
target, so their descriptions here may not apply if the log target is not the
|
||||||
|
standard one (installed by wxWindows in the beginning of the program).
|
||||||
|
|
||||||
\wxheading{Include files}
|
\wxheading{Include files}
|
||||||
|
|
||||||
@@ -2295,9 +2297,9 @@ further information.
|
|||||||
|
|
||||||
\func{void}{wxLogError}{\param{const char*}{ formatString}, \param{...}{}}
|
\func{void}{wxLogError}{\param{const char*}{ formatString}, \param{...}{}}
|
||||||
|
|
||||||
The function to use for error messages, i.e. the
|
The function to use for error messages, i.e. the messages that must be shown
|
||||||
messages that must be shown to the user. The default processing is to pop up a
|
to the user. The default processing is to pop up a message box to inform the
|
||||||
message box to inform the user about it.
|
user about it.
|
||||||
|
|
||||||
\membersection{::wxLogFatalError}\label{wxlogfatalerror}
|
\membersection{::wxLogFatalError}\label{wxlogfatalerror}
|
||||||
|
|
||||||
@@ -2311,18 +2313,18 @@ function also terminates the program with this exit code.
|
|||||||
|
|
||||||
\func{void}{wxLogWarning}{\param{const char*}{ formatString}, \param{...}{}}
|
\func{void}{wxLogWarning}{\param{const char*}{ formatString}, \param{...}{}}
|
||||||
|
|
||||||
For warnings - they are also normally shown to the
|
For warnings - they are also normally shown to the user, but don't interrupt
|
||||||
user, but don't interrupt the program work.
|
the program work.
|
||||||
|
|
||||||
\membersection{::wxLogMessage}\label{wxlogmessage}
|
\membersection{::wxLogMessage}\label{wxlogmessage}
|
||||||
|
|
||||||
\func{void}{wxLogMessage}{\param{const char*}{ formatString}, \param{...}{}}
|
\func{void}{wxLogMessage}{\param{const char*}{ formatString}, \param{...}{}}
|
||||||
|
|
||||||
for all normal, informational messages. They also
|
for all normal, informational messages. They also appear in a message box by
|
||||||
appear in a message box by default (but it can be changed). Notice
|
default (but it can be changed). Notice that the standard behaviour is to not
|
||||||
that the standard behaviour is to not show informational messages if there are
|
show informational messages if there are any errors later - the logic being
|
||||||
any errors later - the logic being that the later error messages make the
|
that the later error messages make the informational messages preceding them
|
||||||
informational messages preceding them meaningless.
|
meaningless.
|
||||||
|
|
||||||
\membersection{::wxLogVerbose}\label{wxlogverbose}
|
\membersection{::wxLogVerbose}\label{wxlogverbose}
|
||||||
|
|
||||||
@@ -2334,48 +2336,79 @@ progress (another, but possibly confusing name for the same function is {\bf wxL
|
|||||||
|
|
||||||
\membersection{::wxLogStatus}\label{wxlogstatus}
|
\membersection{::wxLogStatus}\label{wxlogstatus}
|
||||||
|
|
||||||
|
\func{void}{wxLogStatus}{\param{wxFrame *}{frame}, \param{const char*}{ formatString}, \param{...}{}}
|
||||||
|
|
||||||
\func{void}{wxLogStatus}{\param{const char*}{ formatString}, \param{...}{}}
|
\func{void}{wxLogStatus}{\param{const char*}{ formatString}, \param{...}{}}
|
||||||
|
|
||||||
For status messages - they will go into the status
|
Messages logged by this function will appear in the statusbar of the {\it
|
||||||
bar of the active or specified (as the first argument) \helpref{wxFrame}{wxframe} if it has one.
|
frame} or of the top level application window by default (i.e. when using
|
||||||
|
the second version of the function).
|
||||||
|
|
||||||
|
If the target frame doesn't have a statusbar, the message will be lost.
|
||||||
|
|
||||||
\membersection{::wxLogSysError}\label{wxlogsyserror}
|
\membersection{::wxLogSysError}\label{wxlogsyserror}
|
||||||
|
|
||||||
\func{void}{wxLogSysError}{\param{const char*}{ formatString}, \param{...}{}}
|
\func{void}{wxLogSysError}{\param{const char*}{ formatString}, \param{...}{}}
|
||||||
|
|
||||||
Mostly used by wxWindows itself, but might be
|
Mostly used by wxWindows itself, but might be handy for logging errors after
|
||||||
handy for logging errors after system call (API function) failure. It logs the
|
system call (API function) failure. It logs the specified message text as well
|
||||||
specified message text as well as the last system error code ({\it errno} or {\it ::GetLastError()} depending
|
as the last system error code ({\it errno} or {\it ::GetLastError()} depending
|
||||||
on the platform) and the corresponding error
|
on the platform) and the corresponding error message. The second form
|
||||||
message. The second form of this function takes the error code explitly as the
|
of this function takes the error code explitly as the first argument.
|
||||||
first argument.
|
|
||||||
|
|
||||||
\membersection{::wxLogDebug}\label{wxlogdebug}
|
\membersection{::wxLogDebug}\label{wxlogdebug}
|
||||||
|
|
||||||
\func{void}{wxLogDebug}{\param{const char*}{ formatString}, \param{...}{}}
|
\func{void}{wxLogDebug}{\param{const char*}{ formatString}, \param{...}{}}
|
||||||
|
|
||||||
The right function for debug output. It only
|
The right function for debug output. It only does anything at all in the debug
|
||||||
does anything at all in the debug mode (when the preprocessor symbol \_\_WXDEBUG\_\_ is defined)
|
mode (when the preprocessor symbol \_\_WXDEBUG\_\_ is defined) and expands to
|
||||||
and expands to nothing in release mode (otherwise).
|
nothing in release mode (otherwise).
|
||||||
|
|
||||||
\membersection{::wxLogTrace}\label{wxlogtrace}
|
\membersection{::wxLogTrace}\label{wxlogtrace}
|
||||||
|
|
||||||
\func{void}{wxLogTrace}{\param{const char*}{ formatString}, \param{...}{}}
|
\func{void}{wxLogTrace}{\param{const char*}{ formatString}, \param{...}{}}
|
||||||
|
|
||||||
\func{void}{wxLogTrace}{\param{wxTraceMask}{ mask}, \param{const char*}{ formatString}, \param{...}{}}
|
\func{void}{wxLogTrace}{\param{const char *}{mask}, \param{const char *}{formatString}, \param{...}{}}
|
||||||
|
|
||||||
As {\bf wxLogDebug}, only does something in debug
|
\func{void}{wxLogTrace}{\param{wxTraceMask}{ mask}, \param{const char *}{formatString}, \param{...}{}}
|
||||||
build. The reason for making it a separate function from it is that usually
|
|
||||||
there are a lot of trace messages, so it might make sense to separate them
|
As {\bf wxLogDebug}, trace functions only do something in debug build and
|
||||||
from other debug messages which would be flooded in them. Moreover, the second
|
expand to nothing in the release one. The reason for making
|
||||||
version of this function takes a trace mask as the first argument which allows
|
it a separate function from it is that usually there are a lot of trace
|
||||||
to further restrict the amount of messages generated. The value of {\it mask} can be:
|
messages, so it might make sense to separate them from other debug messages.
|
||||||
|
|
||||||
|
The trace messages also usually can be separated into different categories and
|
||||||
|
the second and third versions of this function only log the message if the
|
||||||
|
{\it mask} which it has is currently enabled in \helpref{wxLog}{wxlog}. This
|
||||||
|
allows to selectively trace only some operations and not others by changing
|
||||||
|
the value of the trace mask (possible during the run-time).
|
||||||
|
|
||||||
|
For the second function (taking a string mask), the message is logged only if
|
||||||
|
the mask has been previously enabled by the call to
|
||||||
|
\helpref{AddTraceMask}{wxlogaddtracemask}. The predefined string trace masks
|
||||||
|
used by wxWindows are:
|
||||||
|
|
||||||
|
\begin{itemize}\itemsep=0pt
|
||||||
|
\item wxTRACE\_MemAlloc: trace memory allocation (new/delete)
|
||||||
|
\item wxTRACE\_Messages: trace window messages/X callbacks
|
||||||
|
\item wxTRACE\_ResAlloc: trace GDI resource allocation
|
||||||
|
\item wxTRACE\_RefCount: trace various ref counting operations
|
||||||
|
\item wxTRACE\_OleCalls: trace OLE method calls (Win32 only)
|
||||||
|
\end{itemize}
|
||||||
|
|
||||||
|
The third version of the function only logs the message if all the bit
|
||||||
|
corresponding to the {\it mask} are set in the wxLog trace mask which can be
|
||||||
|
set by \helpref{SetTraceMask}{wxlogsettracemask}. This version is less
|
||||||
|
flexible than the previous one because it doesn't allow defining the user
|
||||||
|
trace masks easily - this is why it is deprecated in favour of using string
|
||||||
|
trace masks.
|
||||||
|
|
||||||
\begin{itemize}\itemsep=0pt
|
\begin{itemize}\itemsep=0pt
|
||||||
\item wxTraceMemAlloc: trace memory allocation (new/delete)
|
\item wxTraceMemAlloc: trace memory allocation (new/delete)
|
||||||
\item wxTraceMessages: trace window messages/X callbacks
|
\item wxTraceMessages: trace window messages/X callbacks
|
||||||
\item wxTraceResAlloc: trace GDI resource allocation
|
\item wxTraceResAlloc: trace GDI resource allocation
|
||||||
\item wxTraceRefCount: trace various ref counting operations
|
\item wxTraceRefCount: trace various ref counting operations
|
||||||
|
\item wxTraceOleCalls: trace OLE method calls (Win32 only)
|
||||||
\end{itemize}
|
\end{itemize}
|
||||||
|
|
||||||
\section{Debugging macros and functions}\label{debugmacros}
|
\section{Debugging macros and functions}\label{debugmacros}
|
||||||
|
@@ -430,7 +430,8 @@ implements the following methods:\par
|
|||||||
|
|
||||||
\func{virtual void}{Fit}{\void}
|
\func{virtual void}{Fit}{\void}
|
||||||
|
|
||||||
Sizes the window so that it fits around its subwindows.
|
Sizes the window so that it fits around its subwindows. This function won't do
|
||||||
|
anything if there are no subwindows.
|
||||||
|
|
||||||
\membersection{wxWindow::GetBackgroundColour}\label{wxwindowgetbackgroundcolour}
|
\membersection{wxWindow::GetBackgroundColour}\label{wxwindowgetbackgroundcolour}
|
||||||
|
|
||||||
@@ -445,6 +446,17 @@ Returns the background colour of the window.
|
|||||||
\helpref{wxWindow::GetForegroundColour}{wxwindowgetforegroundcolour},\rtfsp
|
\helpref{wxWindow::GetForegroundColour}{wxwindowgetforegroundcolour},\rtfsp
|
||||||
\helpref{wxWindow::OnEraseBackground}{wxwindowonerasebackground}
|
\helpref{wxWindow::OnEraseBackground}{wxwindowonerasebackground}
|
||||||
|
|
||||||
|
\membersection{wxWindow::GetBestSize}{wxwindowgetbestsize}
|
||||||
|
|
||||||
|
\constfunc{virtual wxSize}{GetBestSize}{\void}
|
||||||
|
|
||||||
|
This functions returns the best acceptable minimal size for the window. For
|
||||||
|
example, for a static control, it will be the minimal size such that the
|
||||||
|
control label is not truncated. For windows containing subwindows (typically
|
||||||
|
\helpref{wxPanel}wxpanel}), the size returned by this function will be the
|
||||||
|
same as the size the window would have had after calling
|
||||||
|
\helpref{Fit}{wxwindowfit}.
|
||||||
|
|
||||||
\membersection{wxWindow::GetCharHeight}
|
\membersection{wxWindow::GetCharHeight}
|
||||||
|
|
||||||
\constfunc{virtual int}{GetCharHeight}{\void}
|
\constfunc{virtual int}{GetCharHeight}{\void}
|
||||||
|
@@ -73,6 +73,9 @@ public:
|
|||||||
GtkWidget *m_widgetCheckbox;
|
GtkWidget *m_widgetCheckbox;
|
||||||
GtkWidget *m_widgetLabel;
|
GtkWidget *m_widgetLabel;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxCheckBox)
|
DECLARE_DYNAMIC_CLASS(wxCheckBox)
|
||||||
};
|
};
|
||||||
|
@@ -71,6 +71,8 @@ protected:
|
|||||||
virtual void DoSetItemClientObject( int n, wxClientData* clientData );
|
virtual void DoSetItemClientObject( int n, wxClientData* clientData );
|
||||||
virtual wxClientData* DoGetItemClientObject( int n ) const;
|
virtual wxClientData* DoGetItemClientObject( int n ) const;
|
||||||
|
|
||||||
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// common part of Create() and DoAppend()
|
// common part of Create() and DoAppend()
|
||||||
size_t AppendHelper(GtkWidget *menu, const wxString& item);
|
size_t AppendHelper(GtkWidget *menu, const wxString& item);
|
||||||
|
@@ -121,6 +121,9 @@ public:
|
|||||||
bool IsOwnGtkWindow( GdkWindow *window );
|
bool IsOwnGtkWindow( GdkWindow *window );
|
||||||
void ApplyWidgetStyle();
|
void ApplyWidgetStyle();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxComboBox)
|
DECLARE_DYNAMIC_CLASS(wxComboBox)
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
@@ -46,6 +46,8 @@ public:
|
|||||||
virtual wxString GetLabel() const;
|
virtual wxString GetLabel() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
wxString m_label;
|
wxString m_label;
|
||||||
char m_chAccel; // enabled to avoid breaking binary compatibility later on
|
char m_chAccel; // enabled to avoid breaking binary compatibility later on
|
||||||
|
|
||||||
|
@@ -96,6 +96,9 @@ public:
|
|||||||
bool m_hasCheckBoxes;
|
bool m_hasCheckBoxes;
|
||||||
#endif // wxUSE_CHECKLISTBOX
|
#endif // wxUSE_CHECKLISTBOX
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// this array is only used for controls with wxCB_SORT style, so only
|
// this array is only used for controls with wxCB_SORT style, so only
|
||||||
// allocate it if it's needed (hence using pointer)
|
// allocate it if it's needed (hence using pointer)
|
||||||
|
@@ -80,6 +80,9 @@ public:
|
|||||||
SetBitmap( icon );
|
SetBitmap( icon );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// creates the new pixmap widget
|
// creates the new pixmap widget
|
||||||
void CreatePixmapWidget();
|
void CreatePixmapWidget();
|
||||||
|
@@ -36,25 +36,35 @@ extern const wxChar *wxStaticTextNameStr;
|
|||||||
// wxStaticText
|
// wxStaticText
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class wxStaticText: public wxControl
|
class wxStaticText : public wxControl
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxStaticText)
|
public:
|
||||||
|
|
||||||
public:
|
wxStaticText();
|
||||||
|
wxStaticText(wxWindow *parent,
|
||||||
|
wxWindowID id,
|
||||||
|
const wxString &label,
|
||||||
|
const wxPoint &pos = wxDefaultPosition,
|
||||||
|
const wxSize &size = wxDefaultSize,
|
||||||
|
long style = 0,
|
||||||
|
const wxString &name = wxStaticTextNameStr );
|
||||||
|
|
||||||
wxStaticText(void);
|
bool Create(wxWindow *parent,
|
||||||
wxStaticText( wxWindow *parent, wxWindowID id, const wxString &label,
|
wxWindowID id,
|
||||||
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
|
const wxString &label,
|
||||||
long style = 0, const wxString &name = wxStaticTextNameStr );
|
const wxPoint &pos = wxDefaultPosition,
|
||||||
bool Create( wxWindow *parent, wxWindowID id, const wxString &label,
|
const wxSize &size = wxDefaultSize,
|
||||||
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
|
long style = 0,
|
||||||
long style = 0, const wxString &name = wxStaticTextNameStr );
|
const wxString &name = wxStaticTextNameStr );
|
||||||
wxString GetLabel(void) const;
|
|
||||||
|
wxString GetLabel() const;
|
||||||
void SetLabel( const wxString &label );
|
void SetLabel( const wxString &label );
|
||||||
|
|
||||||
// implementation
|
// implementation
|
||||||
|
|
||||||
void ApplyWidgetStyle();
|
void ApplyWidgetStyle();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxStaticText)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __GTKSTATICTEXTH__
|
#endif // __GTKSTATICTEXTH__
|
||||||
|
@@ -131,6 +131,9 @@ public:
|
|||||||
|
|
||||||
void SetModified() { m_modified = TRUE; }
|
void SetModified() { m_modified = TRUE; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_modified;
|
bool m_modified;
|
||||||
GtkWidget *m_text;
|
GtkWidget *m_text;
|
||||||
|
@@ -73,6 +73,9 @@ public:
|
|||||||
GtkWidget *m_widgetCheckbox;
|
GtkWidget *m_widgetCheckbox;
|
||||||
GtkWidget *m_widgetLabel;
|
GtkWidget *m_widgetLabel;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxCheckBox)
|
DECLARE_DYNAMIC_CLASS(wxCheckBox)
|
||||||
};
|
};
|
||||||
|
@@ -71,6 +71,8 @@ protected:
|
|||||||
virtual void DoSetItemClientObject( int n, wxClientData* clientData );
|
virtual void DoSetItemClientObject( int n, wxClientData* clientData );
|
||||||
virtual wxClientData* DoGetItemClientObject( int n ) const;
|
virtual wxClientData* DoGetItemClientObject( int n ) const;
|
||||||
|
|
||||||
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// common part of Create() and DoAppend()
|
// common part of Create() and DoAppend()
|
||||||
size_t AppendHelper(GtkWidget *menu, const wxString& item);
|
size_t AppendHelper(GtkWidget *menu, const wxString& item);
|
||||||
|
@@ -121,6 +121,9 @@ public:
|
|||||||
bool IsOwnGtkWindow( GdkWindow *window );
|
bool IsOwnGtkWindow( GdkWindow *window );
|
||||||
void ApplyWidgetStyle();
|
void ApplyWidgetStyle();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxComboBox)
|
DECLARE_DYNAMIC_CLASS(wxComboBox)
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
@@ -46,6 +46,8 @@ public:
|
|||||||
virtual wxString GetLabel() const;
|
virtual wxString GetLabel() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
wxString m_label;
|
wxString m_label;
|
||||||
char m_chAccel; // enabled to avoid breaking binary compatibility later on
|
char m_chAccel; // enabled to avoid breaking binary compatibility later on
|
||||||
|
|
||||||
|
@@ -96,6 +96,9 @@ public:
|
|||||||
bool m_hasCheckBoxes;
|
bool m_hasCheckBoxes;
|
||||||
#endif // wxUSE_CHECKLISTBOX
|
#endif // wxUSE_CHECKLISTBOX
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// this array is only used for controls with wxCB_SORT style, so only
|
// this array is only used for controls with wxCB_SORT style, so only
|
||||||
// allocate it if it's needed (hence using pointer)
|
// allocate it if it's needed (hence using pointer)
|
||||||
|
@@ -80,6 +80,9 @@ public:
|
|||||||
SetBitmap( icon );
|
SetBitmap( icon );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// creates the new pixmap widget
|
// creates the new pixmap widget
|
||||||
void CreatePixmapWidget();
|
void CreatePixmapWidget();
|
||||||
|
@@ -36,25 +36,35 @@ extern const wxChar *wxStaticTextNameStr;
|
|||||||
// wxStaticText
|
// wxStaticText
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class wxStaticText: public wxControl
|
class wxStaticText : public wxControl
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxStaticText)
|
public:
|
||||||
|
|
||||||
public:
|
wxStaticText();
|
||||||
|
wxStaticText(wxWindow *parent,
|
||||||
|
wxWindowID id,
|
||||||
|
const wxString &label,
|
||||||
|
const wxPoint &pos = wxDefaultPosition,
|
||||||
|
const wxSize &size = wxDefaultSize,
|
||||||
|
long style = 0,
|
||||||
|
const wxString &name = wxStaticTextNameStr );
|
||||||
|
|
||||||
wxStaticText(void);
|
bool Create(wxWindow *parent,
|
||||||
wxStaticText( wxWindow *parent, wxWindowID id, const wxString &label,
|
wxWindowID id,
|
||||||
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
|
const wxString &label,
|
||||||
long style = 0, const wxString &name = wxStaticTextNameStr );
|
const wxPoint &pos = wxDefaultPosition,
|
||||||
bool Create( wxWindow *parent, wxWindowID id, const wxString &label,
|
const wxSize &size = wxDefaultSize,
|
||||||
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
|
long style = 0,
|
||||||
long style = 0, const wxString &name = wxStaticTextNameStr );
|
const wxString &name = wxStaticTextNameStr );
|
||||||
wxString GetLabel(void) const;
|
|
||||||
|
wxString GetLabel() const;
|
||||||
void SetLabel( const wxString &label );
|
void SetLabel( const wxString &label );
|
||||||
|
|
||||||
// implementation
|
// implementation
|
||||||
|
|
||||||
void ApplyWidgetStyle();
|
void ApplyWidgetStyle();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxStaticText)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __GTKSTATICTEXTH__
|
#endif // __GTKSTATICTEXTH__
|
||||||
|
@@ -131,6 +131,9 @@ public:
|
|||||||
|
|
||||||
void SetModified() { m_modified = TRUE; }
|
void SetModified() { m_modified = TRUE; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_modified;
|
bool m_modified;
|
||||||
GtkWidget *m_text;
|
GtkWidget *m_text;
|
||||||
|
@@ -66,7 +66,7 @@ protected:
|
|||||||
// send a notification event, return TRUE if processed
|
// send a notification event, return TRUE if processed
|
||||||
bool SendClickEvent();
|
bool SendClickEvent();
|
||||||
|
|
||||||
virtual wxSize DoGetBestSize();
|
virtual wxSize DoGetBestSize() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -53,7 +53,7 @@ public:
|
|||||||
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual wxSize DoGetBestSize();
|
virtual wxSize DoGetBestSize() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class WXDLLEXPORT wxBitmapCheckBox: public wxCheckBox
|
class WXDLLEXPORT wxBitmapCheckBox: public wxCheckBox
|
||||||
|
@@ -69,7 +69,7 @@ protected:
|
|||||||
// For controls like radiobuttons which are really composite
|
// For controls like radiobuttons which are really composite
|
||||||
wxList m_subControls;
|
wxList m_subControls;
|
||||||
|
|
||||||
virtual wxSize DoGetBestSize();
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
// create the control of the given class with the given style, returns FALSE
|
// create the control of the given class with the given style, returns FALSE
|
||||||
// if creation failed
|
// if creation failed
|
||||||
|
@@ -126,7 +126,7 @@ protected:
|
|||||||
int m_noItems;
|
int m_noItems;
|
||||||
int m_selected;
|
int m_selected;
|
||||||
|
|
||||||
virtual wxSize DoGetBestSize();
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
#if wxUSE_OWNER_DRAWN
|
#if wxUSE_OWNER_DRAWN
|
||||||
// control items
|
// control items
|
||||||
|
@@ -269,7 +269,7 @@ WXDLLEXPORT void wxSetInstance(HINSTANCE hInst);
|
|||||||
|
|
||||||
WXDLLEXPORT wxWindow* wxFindWinFromHandle(WXHWND hWnd);
|
WXDLLEXPORT wxWindow* wxFindWinFromHandle(WXHWND hWnd);
|
||||||
|
|
||||||
WXDLLEXPORT void wxGetCharSize(WXHWND wnd, int *x, int *y,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);
|
||||||
|
|
||||||
|
@@ -59,7 +59,7 @@ public:
|
|||||||
WXWORD pos, WXHWND control);
|
WXWORD pos, WXHWND control);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual wxSize DoGetBestSize();
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxSpinButton)
|
DECLARE_DYNAMIC_CLASS(wxSpinButton)
|
||||||
|
@@ -61,7 +61,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void DoMoveWindow(int x, int y, int width, int height);
|
virtual void DoMoveWindow(int x, int y, int width, int height);
|
||||||
virtual wxSize DoGetBestSize();
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
WXHWND m_hwndBuddy;
|
WXHWND m_hwndBuddy;
|
||||||
|
|
||||||
|
@@ -84,7 +84,7 @@ protected:
|
|||||||
wxBitmap *bitmap;
|
wxBitmap *bitmap;
|
||||||
} m_image;
|
} m_image;
|
||||||
|
|
||||||
virtual wxSize DoGetBestSize();
|
virtual wxSize DoGetBestSize() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -57,7 +57,7 @@ public:
|
|||||||
virtual bool AcceptsFocus() const { return FALSE; }
|
virtual bool AcceptsFocus() const { return FALSE; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual wxSize DoGetBestSize();
|
virtual wxSize DoGetBestSize() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -56,7 +56,7 @@ public:
|
|||||||
virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual wxSize DoGetBestSize();
|
virtual wxSize DoGetBestSize() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -162,7 +162,7 @@ protected:
|
|||||||
// limit is big enough)
|
// limit is big enough)
|
||||||
void AdjustSpaceLimit();
|
void AdjustSpaceLimit();
|
||||||
|
|
||||||
virtual wxSize DoGetBestSize();
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
@@ -401,10 +401,6 @@ protected:
|
|||||||
int sizeFlags = wxSIZE_AUTO);
|
int sizeFlags = wxSIZE_AUTO);
|
||||||
virtual void DoSetClientSize(int width, int height);
|
virtual void DoSetClientSize(int width, int height);
|
||||||
|
|
||||||
// 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();
|
|
||||||
|
|
||||||
// move the window to the specified location and resize it: this is called
|
// move the window to the specified location and resize it: this is called
|
||||||
// from both DoSetSize() and DoSetClientSize() and would usually just call
|
// from both DoSetSize() and DoSetClientSize() and would usually just call
|
||||||
// ::MoveWindow() except for composite controls which will want to arrange
|
// ::MoveWindow() except for composite controls which will want to arrange
|
||||||
|
@@ -267,6 +267,18 @@ public:
|
|||||||
return wxSize(w, h);
|
return wxSize(w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// get the size best suited for the window (in fact, minimal
|
||||||
|
// acceptable size using which it will still look "nice")
|
||||||
|
wxSize GetBestSize() const { return DoGetBestSize(); }
|
||||||
|
void GetBestSize(int *w, int *h) const
|
||||||
|
{
|
||||||
|
wxSize s = DoGetBestSize();
|
||||||
|
if ( w )
|
||||||
|
*w = s.x;
|
||||||
|
if ( h )
|
||||||
|
*h = s.y;
|
||||||
|
}
|
||||||
|
|
||||||
// centre with respect to the the parent window
|
// centre with respect to the the parent window
|
||||||
void Centre( int direction = wxBOTH );
|
void Centre( int direction = wxBOTH );
|
||||||
void Center( int direction = wxBOTH ) { Centre(direction); }
|
void Center( int direction = wxBOTH ) { Centre(direction); }
|
||||||
@@ -752,6 +764,26 @@ protected:
|
|||||||
static int WidthDefault(int w) { return w == -1 ? 20 : w; }
|
static int WidthDefault(int w) { return w == -1 ? 20 : w; }
|
||||||
static int HeightDefault(int h) { return h == -1 ? 20 : h; }
|
static int HeightDefault(int h) { return h == -1 ? 20 : h; }
|
||||||
|
|
||||||
|
// sets the size to be size but take width and/or height from
|
||||||
|
// DoGetBestSize() if width/height of size is -1
|
||||||
|
//
|
||||||
|
// NB: when calling this function from the ctor, the DoGetBestSize() of
|
||||||
|
// the class with the same name as the ctor, not the real (most
|
||||||
|
// derived) one - but this is what we usually want
|
||||||
|
void SetSizeOrDefault(const wxSize& size = wxDefaultSize)
|
||||||
|
{
|
||||||
|
if ( size.x == -1 || size.y == -1 )
|
||||||
|
{
|
||||||
|
wxSize sizeDef = GetBestSize();
|
||||||
|
SetSize( size.x == -1 ? sizeDef.x : size.x,
|
||||||
|
size.y == -1 ? sizeDef.y : size.y);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetSize(size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// more pure virtual functions
|
// more pure virtual functions
|
||||||
// ---------------------------
|
// ---------------------------
|
||||||
|
|
||||||
@@ -773,6 +805,11 @@ protected:
|
|||||||
virtual void DoGetSize( int *width, int *height ) const = 0;
|
virtual void DoGetSize( int *width, int *height ) const = 0;
|
||||||
virtual void DoGetClientSize( int *width, int *height ) const = 0;
|
virtual void DoGetClientSize( int *width, int *height ) const = 0;
|
||||||
|
|
||||||
|
// get the size which best suits the window: for a control, it would be
|
||||||
|
// the minimal size which doesn't truncate the control, for a panel - the
|
||||||
|
// same size as it would have after a call to Fit()
|
||||||
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
// this is the virtual function to be overriden in any derived class which
|
// this is the virtual function to be overriden in any derived class which
|
||||||
// wants to change how SetSize() or Move() works - it is called by all
|
// wants to change how SetSize() or Move() works - it is called by all
|
||||||
// versions of these functions in the base class
|
// versions of these functions in the base class
|
||||||
@@ -845,6 +882,8 @@ inline wxWindow *wxWindowBase::GetGrandParent() const
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
WXDLLEXPORT extern wxWindow* wxGetActiveWindow();
|
WXDLLEXPORT extern wxWindow* wxGetActiveWindow();
|
||||||
|
|
||||||
|
// deprecated (doesn't start with 'wx' prefix), use wxWindow::NewControlId()
|
||||||
inline WXDLLEXPORT int NewControlId() { return wxWindowBase::NewControlId(); }
|
inline WXDLLEXPORT int NewControlId() { return wxWindowBase::NewControlId(); }
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -302,7 +302,7 @@ bool wxWindowBase::DestroyChildren()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// centre/fit the window
|
// size/position related methods
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
// centre the window with respect to its parent in either (or both) directions
|
// centre the window with respect to its parent in either (or both) directions
|
||||||
@@ -361,36 +361,55 @@ void wxWindowBase::Centre(int direction)
|
|||||||
// fits the window around the children
|
// fits the window around the children
|
||||||
void wxWindowBase::Fit()
|
void wxWindowBase::Fit()
|
||||||
{
|
{
|
||||||
int maxX = 0,
|
if ( GetChildren().GetCount() > 0 )
|
||||||
maxY = 0;
|
|
||||||
|
|
||||||
for ( wxWindowList::Node *node = GetChildren().GetFirst();
|
|
||||||
node;
|
|
||||||
node = node->GetNext() )
|
|
||||||
{
|
{
|
||||||
wxWindow *win = node->GetData();
|
SetClientSize(DoGetBestSize());
|
||||||
if ( win->IsTopLevel() )
|
}
|
||||||
|
//else: do nothing if we have no children
|
||||||
|
}
|
||||||
|
|
||||||
|
// return the size best suited for the current window
|
||||||
|
wxSize wxWindowBase::DoGetBestSize() const
|
||||||
|
{
|
||||||
|
if ( GetChildren().GetCount() > 0 )
|
||||||
|
{
|
||||||
|
// our minimal acceptable size is such that all our windows fit inside
|
||||||
|
int maxX = 0,
|
||||||
|
maxY = 0;
|
||||||
|
|
||||||
|
for ( wxWindowList::Node *node = GetChildren().GetFirst();
|
||||||
|
node;
|
||||||
|
node = node->GetNext() )
|
||||||
{
|
{
|
||||||
// dialogs and frames lie in different top level windows - don't
|
wxWindow *win = node->GetData();
|
||||||
// deal with them here
|
if ( win->IsTopLevel() )
|
||||||
continue;
|
{
|
||||||
|
// dialogs and frames lie in different top level windows -
|
||||||
|
// don't deal with them here
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
int wx, wy, ww, wh;
|
||||||
|
win->GetPosition(&wx, &wy);
|
||||||
|
win->GetSize(&ww, &wh);
|
||||||
|
if ( wx + ww > maxX )
|
||||||
|
maxX = wx + ww;
|
||||||
|
if ( wy + wh > maxY )
|
||||||
|
maxY = wy + wh;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wx, wy, ww, wh;
|
// leave a margin
|
||||||
win->GetPosition(&wx, &wy);
|
return wxSize(maxX + 7, maxY + 14);
|
||||||
win->GetSize(&ww, &wh);
|
}
|
||||||
if ( wx + ww > maxX )
|
else
|
||||||
maxX = wx + ww;
|
{
|
||||||
if ( wy + wh > maxY )
|
// for a generic window there is no natural best size - just use the
|
||||||
maxY = wy + wh;
|
// current one
|
||||||
|
return GetSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
// leave a margin
|
|
||||||
SetClientSize(maxX + 7, maxY + 14);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the min/max size of the window
|
// set the min/max size of the window
|
||||||
|
|
||||||
void wxWindowBase::SetSizeHints(int minW, int minH,
|
void wxWindowBase::SetSizeHints(int minW, int minH,
|
||||||
int maxW, int maxH,
|
int maxW, int maxH,
|
||||||
int WXUNUSED(incW), int WXUNUSED(incH))
|
int WXUNUSED(incW), int WXUNUSED(incH))
|
||||||
|
@@ -106,16 +106,7 @@ bool wxCheckBox::Create(wxWindow *parent,
|
|||||||
m_widget = m_widgetCheckbox;
|
m_widget = m_widgetCheckbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize newSize(size);
|
SetSizeOrDefault( size );
|
||||||
if (newSize.x == -1)
|
|
||||||
{
|
|
||||||
newSize.x = 25 + gdk_string_measure( m_widgetCheckbox->style->font,
|
|
||||||
m_label.mbc_str() );
|
|
||||||
}
|
|
||||||
if (newSize.y == -1)
|
|
||||||
newSize.y = 26;
|
|
||||||
|
|
||||||
SetSize( newSize.x, newSize.y );
|
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(m_widgetCheckbox),
|
gtk_signal_connect( GTK_OBJECT(m_widgetCheckbox),
|
||||||
"clicked",
|
"clicked",
|
||||||
@@ -210,4 +201,10 @@ void wxCheckBox::OnInternalIdle()
|
|||||||
UpdateWindowUI();
|
UpdateWindowUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxSize wxCheckBox::DoGetBestSize() const
|
||||||
|
{
|
||||||
|
return wxSize( 25 + gdk_string_measure( m_widgetCheckbox->style->font,
|
||||||
|
m_label.mbc_str() ), 26 );
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -90,12 +90,7 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
m_widget = gtk_option_menu_new();
|
m_widget = gtk_option_menu_new();
|
||||||
|
|
||||||
wxSize newSize(size);
|
SetSizeOrDefault( size );
|
||||||
if (newSize.x == -1)
|
|
||||||
newSize.x = 80;
|
|
||||||
if (newSize.y == -1)
|
|
||||||
newSize.y = 26;
|
|
||||||
SetSize( newSize.x, newSize.y );
|
|
||||||
|
|
||||||
if ( style & wxCB_SORT )
|
if ( style & wxCB_SORT )
|
||||||
{
|
{
|
||||||
@@ -429,4 +424,9 @@ size_t wxChoice::AppendHelper(GtkWidget *menu, const wxString& item)
|
|||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxSize wxChoice::DoGetBestSize() const
|
||||||
|
{
|
||||||
|
return wxSize(80, 26);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -113,12 +113,7 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
|
|||||||
// make it more useable
|
// make it more useable
|
||||||
gtk_combo_set_use_arrows_always(GTK_COMBO(m_widget), TRUE);
|
gtk_combo_set_use_arrows_always(GTK_COMBO(m_widget), TRUE);
|
||||||
|
|
||||||
wxSize newSize = size;
|
SetSizeOrDefault( size );
|
||||||
if (newSize.x == -1)
|
|
||||||
newSize.x = 100;
|
|
||||||
if (newSize.y == -1)
|
|
||||||
newSize.y = 26;
|
|
||||||
SetSize( newSize.x, newSize.y );
|
|
||||||
|
|
||||||
GtkWidget *list = GTK_COMBO(m_widget)->list;
|
GtkWidget *list = GTK_COMBO(m_widget)->list;
|
||||||
|
|
||||||
@@ -660,4 +655,9 @@ bool wxComboBox::IsOwnGtkWindow( GdkWindow *window )
|
|||||||
(window == GTK_COMBO(m_widget)->button->window ) );
|
(window == GTK_COMBO(m_widget)->button->window ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxSize wxComboBox::DoGetBestSize() const
|
||||||
|
{
|
||||||
|
return wxSize(100, 26);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#include "wx/control.h"
|
#include "wx/control.h"
|
||||||
|
|
||||||
#include "gtk/gtkfeatures.h"
|
#include "gtk/gtk.h"
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxControl
|
// wxControl
|
||||||
@@ -58,3 +58,12 @@ wxString wxControl::GetLabel() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxSize wxControl::DoGetBestSize() const
|
||||||
|
{
|
||||||
|
GtkRequisition req;
|
||||||
|
(* GTK_WIDGET_CLASS( GTK_OBJECT(m_widget)->klass )->size_request )
|
||||||
|
(m_widget, &req );
|
||||||
|
|
||||||
|
return wxSize(req.width, req.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -327,12 +327,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
gtk_widget_show( GTK_WIDGET(m_list) );
|
gtk_widget_show( GTK_WIDGET(m_list) );
|
||||||
|
|
||||||
wxSize newSize = size;
|
SetSizeOrDefault( size );
|
||||||
if (newSize.x == -1)
|
|
||||||
newSize.x = 100;
|
|
||||||
if (newSize.y == -1)
|
|
||||||
newSize.y = 110;
|
|
||||||
SetSize( newSize.x, newSize.y );
|
|
||||||
|
|
||||||
if ( style & wxLB_SORT )
|
if ( style & wxLB_SORT )
|
||||||
{
|
{
|
||||||
@@ -939,4 +934,9 @@ void wxListBox::OnInternalIdle()
|
|||||||
UpdateWindowUI();
|
UpdateWindowUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxSize wxListBox::DoGetBestSize() const
|
||||||
|
{
|
||||||
|
return wxSize(100, 110);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -69,16 +69,12 @@ bool wxStaticBitmap::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi
|
|||||||
|
|
||||||
if (m_bitmap.Ok())
|
if (m_bitmap.Ok())
|
||||||
{
|
{
|
||||||
wxSize newSize = size;
|
|
||||||
|
|
||||||
GdkBitmap *mask = (GdkBitmap *) NULL;
|
GdkBitmap *mask = (GdkBitmap *) NULL;
|
||||||
if ( m_bitmap.GetMask() )
|
if ( m_bitmap.GetMask() )
|
||||||
mask = m_bitmap.GetMask()->GetBitmap();
|
mask = m_bitmap.GetMask()->GetBitmap();
|
||||||
m_widget = gtk_pixmap_new( m_bitmap.GetPixmap(), mask );
|
m_widget = gtk_pixmap_new( m_bitmap.GetPixmap(), mask );
|
||||||
|
|
||||||
if (newSize.x == -1) newSize.x = m_bitmap.GetWidth();
|
SetSizeOrDefault( size );
|
||||||
if (newSize.y == -1) newSize.y = m_bitmap.GetHeight();
|
|
||||||
SetSize( newSize.x, newSize.y );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -116,8 +112,16 @@ void wxStaticBitmap::SetBitmap( const wxBitmap &bitmap )
|
|||||||
gtk_pixmap_set( GTK_PIXMAP(m_widget), m_bitmap.GetPixmap(), mask );
|
gtk_pixmap_set( GTK_PIXMAP(m_widget), m_bitmap.GetPixmap(), mask );
|
||||||
}
|
}
|
||||||
|
|
||||||
SetSize( m_bitmap.GetWidth(), m_bitmap.GetHeight() );
|
SetSizeOrDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxSize wxStaticBitmap::DoGetBestSize() const
|
||||||
|
{
|
||||||
|
if ( m_bitmap.Ok() )
|
||||||
|
return wxSize(m_bitmap.GetWidth(), m_bitmap.GetHeight());
|
||||||
|
else
|
||||||
|
return wxSize(16, 16); // completely arbitrary
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -79,13 +79,7 @@ bool wxStaticText::Create(wxWindow *parent,
|
|||||||
static const float labelAlignments[] = { 0.0, 1.0, 0.5 };
|
static const float labelAlignments[] = { 0.0, 1.0, 0.5 };
|
||||||
gtk_misc_set_alignment(GTK_MISC(m_widget), labelAlignments[justify], 0.0);
|
gtk_misc_set_alignment(GTK_MISC(m_widget), labelAlignments[justify], 0.0);
|
||||||
|
|
||||||
GtkRequisition req;
|
SetSizeOrDefault( size );
|
||||||
(* GTK_WIDGET_CLASS( GTK_OBJECT(m_widget)->klass )->size_request ) (m_widget, &req );
|
|
||||||
|
|
||||||
wxSize newSize = size;
|
|
||||||
if (newSize.x == -1) newSize.x = req.width;
|
|
||||||
if (newSize.y == -1) newSize.y = req.height;
|
|
||||||
SetSize( newSize.x, newSize.y );
|
|
||||||
|
|
||||||
m_parent->DoAddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
@@ -115,11 +109,7 @@ void wxStaticText::SetLabel( const wxString &label )
|
|||||||
// adjust the label size to the new label unless disabled
|
// adjust the label size to the new label unless disabled
|
||||||
if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) )
|
if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) )
|
||||||
{
|
{
|
||||||
GtkRequisition req;
|
SetSize( GetBestSize() );
|
||||||
(* GTK_WIDGET_CLASS( GTK_OBJECT(m_widget)->klass )->size_request )
|
|
||||||
(m_widget, &req );
|
|
||||||
|
|
||||||
SetSize( req.width, req.height );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,4 +118,3 @@ void wxStaticText::ApplyWidgetStyle()
|
|||||||
SetWidgetStyle();
|
SetWidgetStyle();
|
||||||
gtk_widget_set_style( m_widget, m_widgetStyle );
|
gtk_widget_set_style( m_widget, m_widgetStyle );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -182,10 +182,7 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
|
|||||||
m_text = gtk_entry_new();
|
m_text = gtk_entry_new();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize newSize = size;
|
SetSizeOrDefault( size );
|
||||||
if (newSize.x == -1) newSize.x = 80;
|
|
||||||
if (newSize.y == -1) newSize.y = 26;
|
|
||||||
SetSize( newSize.x, newSize.y );
|
|
||||||
|
|
||||||
m_parent->DoAddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
@@ -966,3 +963,9 @@ void wxTextCtrl::OnInternalIdle()
|
|||||||
|
|
||||||
UpdateWindowUI();
|
UpdateWindowUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxSize wxTextCtrl::DoGetBestSize() const
|
||||||
|
{
|
||||||
|
// FIXME should be different for multi-line controls...
|
||||||
|
return wxSize(80, 26);
|
||||||
|
}
|
||||||
|
@@ -185,7 +185,8 @@ extern bool g_blockEventsOnDrag;
|
|||||||
extern bool g_blockEventsOnScroll;
|
extern bool g_blockEventsOnScroll;
|
||||||
extern wxCursor g_globalCursor;
|
extern wxCursor g_globalCursor;
|
||||||
static wxWindow *g_captureWindow = (wxWindow*) NULL;
|
static wxWindow *g_captureWindow = (wxWindow*) NULL;
|
||||||
extern wxWindow *g_focusWindow = (wxWindow*) NULL;
|
|
||||||
|
/* extern */ wxWindow *g_focusWindow = (wxWindow*) NULL;
|
||||||
|
|
||||||
// if we detect that the app has got/lost the focus, we set this variable to
|
// if we detect that the app has got/lost the focus, we set this variable to
|
||||||
// either TRUE or FALSE and an activate event will be sent during the next
|
// either TRUE or FALSE and an activate event will be sent during the next
|
||||||
|
@@ -106,16 +106,7 @@ bool wxCheckBox::Create(wxWindow *parent,
|
|||||||
m_widget = m_widgetCheckbox;
|
m_widget = m_widgetCheckbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize newSize(size);
|
SetSizeOrDefault( size );
|
||||||
if (newSize.x == -1)
|
|
||||||
{
|
|
||||||
newSize.x = 25 + gdk_string_measure( m_widgetCheckbox->style->font,
|
|
||||||
m_label.mbc_str() );
|
|
||||||
}
|
|
||||||
if (newSize.y == -1)
|
|
||||||
newSize.y = 26;
|
|
||||||
|
|
||||||
SetSize( newSize.x, newSize.y );
|
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(m_widgetCheckbox),
|
gtk_signal_connect( GTK_OBJECT(m_widgetCheckbox),
|
||||||
"clicked",
|
"clicked",
|
||||||
@@ -210,4 +201,10 @@ void wxCheckBox::OnInternalIdle()
|
|||||||
UpdateWindowUI();
|
UpdateWindowUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxSize wxCheckBox::DoGetBestSize() const
|
||||||
|
{
|
||||||
|
return wxSize( 25 + gdk_string_measure( m_widgetCheckbox->style->font,
|
||||||
|
m_label.mbc_str() ), 26 );
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -90,12 +90,7 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
m_widget = gtk_option_menu_new();
|
m_widget = gtk_option_menu_new();
|
||||||
|
|
||||||
wxSize newSize(size);
|
SetSizeOrDefault( size );
|
||||||
if (newSize.x == -1)
|
|
||||||
newSize.x = 80;
|
|
||||||
if (newSize.y == -1)
|
|
||||||
newSize.y = 26;
|
|
||||||
SetSize( newSize.x, newSize.y );
|
|
||||||
|
|
||||||
if ( style & wxCB_SORT )
|
if ( style & wxCB_SORT )
|
||||||
{
|
{
|
||||||
@@ -429,4 +424,9 @@ size_t wxChoice::AppendHelper(GtkWidget *menu, const wxString& item)
|
|||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxSize wxChoice::DoGetBestSize() const
|
||||||
|
{
|
||||||
|
return wxSize(80, 26);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -113,12 +113,7 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
|
|||||||
// make it more useable
|
// make it more useable
|
||||||
gtk_combo_set_use_arrows_always(GTK_COMBO(m_widget), TRUE);
|
gtk_combo_set_use_arrows_always(GTK_COMBO(m_widget), TRUE);
|
||||||
|
|
||||||
wxSize newSize = size;
|
SetSizeOrDefault( size );
|
||||||
if (newSize.x == -1)
|
|
||||||
newSize.x = 100;
|
|
||||||
if (newSize.y == -1)
|
|
||||||
newSize.y = 26;
|
|
||||||
SetSize( newSize.x, newSize.y );
|
|
||||||
|
|
||||||
GtkWidget *list = GTK_COMBO(m_widget)->list;
|
GtkWidget *list = GTK_COMBO(m_widget)->list;
|
||||||
|
|
||||||
@@ -660,4 +655,9 @@ bool wxComboBox::IsOwnGtkWindow( GdkWindow *window )
|
|||||||
(window == GTK_COMBO(m_widget)->button->window ) );
|
(window == GTK_COMBO(m_widget)->button->window ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxSize wxComboBox::DoGetBestSize() const
|
||||||
|
{
|
||||||
|
return wxSize(100, 26);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#include "wx/control.h"
|
#include "wx/control.h"
|
||||||
|
|
||||||
#include "gtk/gtkfeatures.h"
|
#include "gtk/gtk.h"
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxControl
|
// wxControl
|
||||||
@@ -58,3 +58,12 @@ wxString wxControl::GetLabel() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxSize wxControl::DoGetBestSize() const
|
||||||
|
{
|
||||||
|
GtkRequisition req;
|
||||||
|
(* GTK_WIDGET_CLASS( GTK_OBJECT(m_widget)->klass )->size_request )
|
||||||
|
(m_widget, &req );
|
||||||
|
|
||||||
|
return wxSize(req.width, req.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -327,12 +327,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
gtk_widget_show( GTK_WIDGET(m_list) );
|
gtk_widget_show( GTK_WIDGET(m_list) );
|
||||||
|
|
||||||
wxSize newSize = size;
|
SetSizeOrDefault( size );
|
||||||
if (newSize.x == -1)
|
|
||||||
newSize.x = 100;
|
|
||||||
if (newSize.y == -1)
|
|
||||||
newSize.y = 110;
|
|
||||||
SetSize( newSize.x, newSize.y );
|
|
||||||
|
|
||||||
if ( style & wxLB_SORT )
|
if ( style & wxLB_SORT )
|
||||||
{
|
{
|
||||||
@@ -939,4 +934,9 @@ void wxListBox::OnInternalIdle()
|
|||||||
UpdateWindowUI();
|
UpdateWindowUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxSize wxListBox::DoGetBestSize() const
|
||||||
|
{
|
||||||
|
return wxSize(100, 110);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -69,16 +69,12 @@ bool wxStaticBitmap::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi
|
|||||||
|
|
||||||
if (m_bitmap.Ok())
|
if (m_bitmap.Ok())
|
||||||
{
|
{
|
||||||
wxSize newSize = size;
|
|
||||||
|
|
||||||
GdkBitmap *mask = (GdkBitmap *) NULL;
|
GdkBitmap *mask = (GdkBitmap *) NULL;
|
||||||
if ( m_bitmap.GetMask() )
|
if ( m_bitmap.GetMask() )
|
||||||
mask = m_bitmap.GetMask()->GetBitmap();
|
mask = m_bitmap.GetMask()->GetBitmap();
|
||||||
m_widget = gtk_pixmap_new( m_bitmap.GetPixmap(), mask );
|
m_widget = gtk_pixmap_new( m_bitmap.GetPixmap(), mask );
|
||||||
|
|
||||||
if (newSize.x == -1) newSize.x = m_bitmap.GetWidth();
|
SetSizeOrDefault( size );
|
||||||
if (newSize.y == -1) newSize.y = m_bitmap.GetHeight();
|
|
||||||
SetSize( newSize.x, newSize.y );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -116,8 +112,16 @@ void wxStaticBitmap::SetBitmap( const wxBitmap &bitmap )
|
|||||||
gtk_pixmap_set( GTK_PIXMAP(m_widget), m_bitmap.GetPixmap(), mask );
|
gtk_pixmap_set( GTK_PIXMAP(m_widget), m_bitmap.GetPixmap(), mask );
|
||||||
}
|
}
|
||||||
|
|
||||||
SetSize( m_bitmap.GetWidth(), m_bitmap.GetHeight() );
|
SetSizeOrDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxSize wxStaticBitmap::DoGetBestSize() const
|
||||||
|
{
|
||||||
|
if ( m_bitmap.Ok() )
|
||||||
|
return wxSize(m_bitmap.GetWidth(), m_bitmap.GetHeight());
|
||||||
|
else
|
||||||
|
return wxSize(16, 16); // completely arbitrary
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -79,13 +79,7 @@ bool wxStaticText::Create(wxWindow *parent,
|
|||||||
static const float labelAlignments[] = { 0.0, 1.0, 0.5 };
|
static const float labelAlignments[] = { 0.0, 1.0, 0.5 };
|
||||||
gtk_misc_set_alignment(GTK_MISC(m_widget), labelAlignments[justify], 0.0);
|
gtk_misc_set_alignment(GTK_MISC(m_widget), labelAlignments[justify], 0.0);
|
||||||
|
|
||||||
GtkRequisition req;
|
SetSizeOrDefault( size );
|
||||||
(* GTK_WIDGET_CLASS( GTK_OBJECT(m_widget)->klass )->size_request ) (m_widget, &req );
|
|
||||||
|
|
||||||
wxSize newSize = size;
|
|
||||||
if (newSize.x == -1) newSize.x = req.width;
|
|
||||||
if (newSize.y == -1) newSize.y = req.height;
|
|
||||||
SetSize( newSize.x, newSize.y );
|
|
||||||
|
|
||||||
m_parent->DoAddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
@@ -115,11 +109,7 @@ void wxStaticText::SetLabel( const wxString &label )
|
|||||||
// adjust the label size to the new label unless disabled
|
// adjust the label size to the new label unless disabled
|
||||||
if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) )
|
if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) )
|
||||||
{
|
{
|
||||||
GtkRequisition req;
|
SetSize( GetBestSize() );
|
||||||
(* GTK_WIDGET_CLASS( GTK_OBJECT(m_widget)->klass )->size_request )
|
|
||||||
(m_widget, &req );
|
|
||||||
|
|
||||||
SetSize( req.width, req.height );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,4 +118,3 @@ void wxStaticText::ApplyWidgetStyle()
|
|||||||
SetWidgetStyle();
|
SetWidgetStyle();
|
||||||
gtk_widget_set_style( m_widget, m_widgetStyle );
|
gtk_widget_set_style( m_widget, m_widgetStyle );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -182,10 +182,7 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
|
|||||||
m_text = gtk_entry_new();
|
m_text = gtk_entry_new();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize newSize = size;
|
SetSizeOrDefault( size );
|
||||||
if (newSize.x == -1) newSize.x = 80;
|
|
||||||
if (newSize.y == -1) newSize.y = 26;
|
|
||||||
SetSize( newSize.x, newSize.y );
|
|
||||||
|
|
||||||
m_parent->DoAddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
@@ -966,3 +963,9 @@ void wxTextCtrl::OnInternalIdle()
|
|||||||
|
|
||||||
UpdateWindowUI();
|
UpdateWindowUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxSize wxTextCtrl::DoGetBestSize() const
|
||||||
|
{
|
||||||
|
// FIXME should be different for multi-line controls...
|
||||||
|
return wxSize(80, 26);
|
||||||
|
}
|
||||||
|
@@ -185,7 +185,8 @@ extern bool g_blockEventsOnDrag;
|
|||||||
extern bool g_blockEventsOnScroll;
|
extern bool g_blockEventsOnScroll;
|
||||||
extern wxCursor g_globalCursor;
|
extern wxCursor g_globalCursor;
|
||||||
static wxWindow *g_captureWindow = (wxWindow*) NULL;
|
static wxWindow *g_captureWindow = (wxWindow*) NULL;
|
||||||
extern wxWindow *g_focusWindow = (wxWindow*) NULL;
|
|
||||||
|
/* extern */ wxWindow *g_focusWindow = (wxWindow*) NULL;
|
||||||
|
|
||||||
// if we detect that the app has got/lost the focus, we set this variable to
|
// if we detect that the app has got/lost the focus, we set this variable to
|
||||||
// either TRUE or FALSE and an activate event will be sent during the next
|
// either TRUE or FALSE and an activate event will be sent during the next
|
||||||
|
@@ -128,7 +128,7 @@ wxButton::~wxButton()
|
|||||||
// size management including autosizing
|
// size management including autosizing
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
wxSize wxButton::DoGetBestSize()
|
wxSize wxButton::DoGetBestSize() const
|
||||||
{
|
{
|
||||||
wxString label = wxGetWindowText(GetHWND());
|
wxString label = wxGetWindowText(GetHWND());
|
||||||
int wBtn;
|
int wBtn;
|
||||||
|
@@ -138,7 +138,7 @@ void wxCheckBox::SetLabel(const wxString& label)
|
|||||||
SetWindowText(GetHwnd(), label);
|
SetWindowText(GetHwnd(), label);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize wxCheckBox::DoGetBestSize()
|
wxSize wxCheckBox::DoGetBestSize() const
|
||||||
{
|
{
|
||||||
int wCheckbox, hCheckbox;
|
int wCheckbox, hCheckbox;
|
||||||
|
|
||||||
|
@@ -119,7 +119,7 @@ bool wxControl::MSWCreateControl(const wxChar *classname,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize wxControl::DoGetBestSize()
|
wxSize wxControl::DoGetBestSize() const
|
||||||
{
|
{
|
||||||
return wxSize(DEFAULT_ITEM_WIDTH, DEFAULT_ITEM_HEIGHT);
|
return wxSize(DEFAULT_ITEM_WIDTH, DEFAULT_ITEM_HEIGHT);
|
||||||
}
|
}
|
||||||
|
@@ -623,7 +623,7 @@ void wxListBox::SetHorizontalExtent(const wxString& s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize wxListBox::DoGetBestSize()
|
wxSize wxListBox::DoGetBestSize() const
|
||||||
{
|
{
|
||||||
// find the widest string
|
// find the widest string
|
||||||
int wLine;
|
int wLine;
|
||||||
|
@@ -153,7 +153,7 @@ wxSpinButton::~wxSpinButton()
|
|||||||
// size calculation
|
// size calculation
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
wxSize wxSpinButton::DoGetBestSize()
|
wxSize wxSpinButton::DoGetBestSize() const
|
||||||
{
|
{
|
||||||
if ( (GetWindowStyle() & wxSP_VERTICAL) != 0 )
|
if ( (GetWindowStyle() & wxSP_VERTICAL) != 0 )
|
||||||
{
|
{
|
||||||
|
@@ -207,7 +207,7 @@ bool wxSpinCtrl::SetFont(const wxFont& font)
|
|||||||
// size calculations
|
// size calculations
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
wxSize wxSpinCtrl::DoGetBestSize()
|
wxSize wxSpinCtrl::DoGetBestSize() const
|
||||||
{
|
{
|
||||||
wxSize sizeBtn = wxSpinButton::DoGetBestSize();
|
wxSize sizeBtn = wxSpinButton::DoGetBestSize();
|
||||||
sizeBtn.x += DEFAULT_ITEM_WIDTH + MARGIN_BETWEEN;
|
sizeBtn.x += DEFAULT_ITEM_WIDTH + MARGIN_BETWEEN;
|
||||||
|
@@ -140,7 +140,7 @@ void wxStaticBitmap::Free()
|
|||||||
m_image.icon = NULL;
|
m_image.icon = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize wxStaticBitmap::DoGetBestSize()
|
wxSize wxStaticBitmap::DoGetBestSize() const
|
||||||
{
|
{
|
||||||
// reuse the current size (as wxWindow does) instead of using some
|
// reuse the current size (as wxWindow does) instead of using some
|
||||||
// arbitrary default size (as wxControl, our immediate base class, does)
|
// arbitrary default size (as wxControl, our immediate base class, does)
|
||||||
|
@@ -70,7 +70,7 @@ bool wxStaticBox::Create(wxWindow *parent,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize wxStaticBox::DoGetBestSize()
|
wxSize wxStaticBox::DoGetBestSize() const
|
||||||
{
|
{
|
||||||
int cx, cy;
|
int cx, cy;
|
||||||
wxGetCharSize(GetHWND(), &cx, &cy, &GetFont());
|
wxGetCharSize(GetHWND(), &cx, &cy, &GetFont());
|
||||||
|
@@ -94,7 +94,7 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize wxStaticText::DoGetBestSize()
|
wxSize wxStaticText::DoGetBestSize() const
|
||||||
{
|
{
|
||||||
wxString text(wxGetWindowText(GetHWND()));
|
wxString text(wxGetWindowText(GetHWND()));
|
||||||
|
|
||||||
|
@@ -886,7 +886,7 @@ bool wxTextCtrl::AcceptsFocus() const
|
|||||||
return IsEditable() && wxControl::AcceptsFocus();
|
return IsEditable() && wxControl::AcceptsFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize wxTextCtrl::DoGetBestSize()
|
wxSize wxTextCtrl::DoGetBestSize() const
|
||||||
{
|
{
|
||||||
int cx, cy;
|
int cx, cy;
|
||||||
wxGetCharSize(GetHWND(), &cx, &cy, &GetFont());
|
wxGetCharSize(GetHWND(), &cx, &cy, &GetFont());
|
||||||
|
@@ -1257,12 +1257,6 @@ void wxWindow::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
|||||||
DoMoveWindow(x, y, width, height);
|
DoMoveWindow(x, y, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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)
|
void wxWindow::DoSetClientSize(int width, int height)
|
||||||
{
|
{
|
||||||
wxWindow *parent = GetParent();
|
wxWindow *parent = GetParent();
|
||||||
@@ -3353,7 +3347,7 @@ bool wxWindow::MSWOnScroll(int orientation, WXWORD wParam,
|
|||||||
// global functions
|
// global functions
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
void wxGetCharSize(WXHWND wnd, int *x, int *y,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);
|
||||||
@@ -3363,7 +3357,7 @@ void wxGetCharSize(WXHWND wnd, int *x, int *y,wxFont *the_font)
|
|||||||
{
|
{
|
||||||
// the_font->UseResource();
|
// the_font->UseResource();
|
||||||
// the_font->RealizeResource();
|
// the_font->RealizeResource();
|
||||||
fnt = (HFONT)the_font->GetResourceHandle();
|
fnt = (HFONT)((wxFont *)the_font)->GetResourceHandle(); // const_cast
|
||||||
if ( fnt )
|
if ( fnt )
|
||||||
was = (HFONT) SelectObject(dc,fnt);
|
was = (HFONT) SelectObject(dc,fnt);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user