Rework wxMotif font/color inheritance so it works

like in the other ports.  Avoid setting foreground/background
color for windows and let the toolkit use the natural color.
As an intermediate step font is still explicitly set.

  Handle the cases where m_foregroundColour, m_backgroundColour ir m_font
are not initialized.

  Set default (overridable) X resources to emulate the old look.

  Unify wxMOTIF_NEW_FONT_HANDLING with wxMOTIF_USE_RENDER_TABLE.

  Minor unrelated (sizing) fixes to wxCheckListBox, wxStaticText, wxTextCtrl.

  Tagged with MOTIF_BEFORE_COLOUR_FONT_INHERITANCE before the changes.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45312 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Mattia Barbon
2007-04-07 21:18:33 +00:00
parent d5c87edd82
commit 105fbe1ffa
40 changed files with 368 additions and 206 deletions

View File

@@ -110,13 +110,12 @@ bool wxTextCtrl::Create(wxWindow *parent,
{
if( !CreateControl( parent, id, pos, size, style, validator, name ) )
return false;
PreCreation();
m_tempCallbackStruct = (void*) NULL;
m_modified = false;
m_processedDefault = false;
m_backgroundColour = *wxWHITE;
Widget parentWidget = (Widget) parent->GetClientWidget();
Bool wantHorizScroll = (m_windowStyle & wxHSCROLL) != 0 ? True : False;
@@ -135,8 +134,9 @@ bool wxTextCtrl::Create(wxWindow *parent,
Arg args[8];
int count = 0;
XtSetArg (args[count], XmNscrollHorizontal, wantHorizScroll); ++count;
XtSetArg (args[count], (String) wxFont::GetFontTag(),
m_font.GetFontType( XtDisplay(parentWidget) ) ); ++count;
if( m_font.IsOk() )
XtSetArg (args[count], (String) wxFont::GetFontTag(),
m_font.GetFontType( XtDisplay(parentWidget) ) ); ++count;
XtSetArg (args[count], XmNwordWrap, wantWordWrap); ++count;
XtSetArg (args[count], XmNvalue, value.mb_str()); ++count;
XtSetArg (args[count], XmNeditable,
@@ -194,11 +194,10 @@ bool wxTextCtrl::Create(wxWindow *parent,
XtAddCallback((Widget) m_mainWidget, XmNlosingFocusCallback, (XtCallbackProc)wxTextWindowLoseFocusProc, (XtPointer)this);
PostCreation();
AttachWidget (parent, m_mainWidget, (WXWidget) NULL,
pos.x, pos.y, size.x, size.y);
ChangeBackgroundColour();
return true;
}
@@ -667,8 +666,8 @@ wxSize wxDoGetSingleTextCtrlBestSize( Widget textWidget,
int x, y;
window->GetTextExtent( value, &x, &y );
if( x < 100 )
x = 100;
if( x < 90 )
x = 90;
return wxSize( x + 2 * xmargin + 2 * highlight + 2 * shadow,
// MBN: +2 necessary: Lesstif bug or mine?
@@ -680,10 +679,16 @@ wxSize wxTextCtrl::DoGetBestSize() const
if( IsSingleLine() )
{
wxSize best = wxControl::DoGetBestSize();
if( best.x < 110 ) best.x = 110;
#if wxCHECK_MOTIF_VERSION( 2, 3 )
// OpenMotif 2.3 gives way too big X sizes
wxSize other_best = wxDoGetSingleTextCtrlBestSize
( (Widget) GetTopWidget(), this );
return wxSize( other_best.x, best.y );
#else
if( best.x < 90 ) best.x = 90;
return best;
#endif
}
else
return wxWindow::DoGetBestSize();