Implemented DoGetBestSize for wxListBox, (native) wxComboBox and

wxTextCtrl, and used it when wxSize(-1, -1) is passed to Create, to set
the initial size.
  Added wxDoChangeFont and wxXmStringToString helper functions, removed
the use of m_stringList in native wxComboBox, removed some duplicated code
in wxWindow.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19296 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Mattia Barbon
2003-02-23 20:33:43 +00:00
parent 8dcc14725d
commit e1aae52885
11 changed files with 244 additions and 129 deletions

View File

@@ -2914,41 +2914,17 @@ void wxWindow::ChangeForegroundColour()
}
// Change a widget's foreground and background colours.
void wxWindow::DoChangeForegroundColour(WXWidget widget, wxColour& foregroundColour)
void wxWindow::DoChangeForegroundColour(WXWidget widget,
wxColour& foregroundColour)
{
// When should we specify the foreground, if it's calculated
// by wxComputeColours?
// Solution: say we start with the default (computed) foreground colour.
// If we call SetForegroundColour explicitly for a control or window,
// then the foreground is changed.
// Therefore SetBackgroundColour computes the foreground colour, and
// SetForegroundColour changes the foreground colour. The ordering is
// important.
Widget w = (Widget)widget;
XtVaSetValues(
w,
XmNforeground, foregroundColour.AllocColour(XtDisplay(w)),
NULL
);
wxDoChangeForegroundColour( widget, foregroundColour );
}
void wxWindow::DoChangeBackgroundColour(WXWidget widget, wxColour& backgroundColour, bool changeArmColour)
void wxWindow::DoChangeBackgroundColour(WXWidget widget,
wxColour& backgroundColour,
bool changeArmColour)
{
wxComputeColours (XtDisplay((Widget) widget), & backgroundColour,
(wxColour*) NULL);
XtVaSetValues ((Widget) widget,
XmNbackground, g_itemColors[wxBACK_INDEX].pixel,
XmNtopShadowColor, g_itemColors[wxTOPS_INDEX].pixel,
XmNbottomShadowColor, g_itemColors[wxBOTS_INDEX].pixel,
XmNforeground, g_itemColors[wxFORE_INDEX].pixel,
NULL);
if (changeArmColour)
XtVaSetValues ((Widget) widget,
XmNarmColor, g_itemColors[wxSELE_INDEX].pixel,
NULL);
wxDoChangeBackgroundColour( widget, backgroundColour, changeArmColour );
}
bool wxWindow::SetBackgroundColour(const wxColour& col)
@@ -2982,13 +2958,7 @@ void wxWindow::ChangeFont(bool keepOriginalSize)
int width, height, width1, height1;
GetSize(& width, & height);
// lesstif 0.87 hangs here, but 0.93 does not
#if !defined(LESSTIF_VERSION) \
|| (defined(LesstifVersion) && LesstifVersion >= 93)
XtVaSetValues (w,
XmNfontList, (XmFontList) m_font.GetFontList(1.0, XtDisplay(w)),
NULL);
#endif
wxDoChangeFont( GetLabelWidget(), m_font );
GetSize(& width1, & height1);
if (keepOriginalSize && (width != width1 || height != height1))