Added new __WXMOTIF20__ macro, which is true if the Motif version
is 2.0 or higher. Now Motif 2.0 or better (but not Lesstif) uses XmRenderTable instead of the deprecated XmFontList. This allows underlined text in controls. Miscellaneous cleanup; used wxXmString in some more places. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19495 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
21
configure.in
21
configure.in
@@ -2543,6 +2543,27 @@ equivalent variable and GTK+ is version 1.2.3 or above.
|
|||||||
AC_MSG_ERROR([can't link a simple motif program])
|
AC_MSG_ERROR([can't link a simple motif program])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
save_CFLAGS=$CFLAGS
|
||||||
|
CFLAGS="$CFLAGS $TOOLKIT_INCLUDE"
|
||||||
|
AC_MSG_CHECKING([for Motif 2])
|
||||||
|
AC_TRY_COMPILE([
|
||||||
|
#include <Xm/Xm.h>
|
||||||
|
],
|
||||||
|
[
|
||||||
|
#if XmVersion < 2000
|
||||||
|
#error "Not Motif 2"
|
||||||
|
#endif
|
||||||
|
],
|
||||||
|
[
|
||||||
|
AC_DEFINE(__WXMOTIF20__,1)
|
||||||
|
AC_MSG_RESULT([found])
|
||||||
|
],
|
||||||
|
[
|
||||||
|
AC_DEFINE(__WXMOTIF20__,0)
|
||||||
|
AC_MSG_RESULT([not found])
|
||||||
|
])
|
||||||
|
CFLAGS=$save_CFLAGS
|
||||||
|
|
||||||
GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lXm$xpm_link${libp_link} -lXmu -lXext -lXt${libsm_ice_link} -lX11"
|
GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lXm$xpm_link${libp_link} -lXmu -lXext -lXt${libsm_ice_link} -lX11"
|
||||||
TOOLKIT_VPATH="\${top_srcdir}/src/motif${PATH_IFS}\${top_srcdir}/src/motif/xmcombo${PATH_IFS}\${top_srcdir}/src/x11"
|
TOOLKIT_VPATH="\${top_srcdir}/src/motif${PATH_IFS}\${top_srcdir}/src/motif/xmcombo${PATH_IFS}\${top_srcdir}/src/x11"
|
||||||
TOOLKIT=MOTIF
|
TOOLKIT=MOTIF
|
||||||
|
@@ -155,7 +155,7 @@ overview}{wxfontencodingoverview} for the meaning of the last parameter).
|
|||||||
|
|
||||||
\docparam{weight}{One of {\bf wxNORMAL}, {\bf wxLIGHT} and {\bf wxBOLD}.}
|
\docparam{weight}{One of {\bf wxNORMAL}, {\bf wxLIGHT} and {\bf wxBOLD}.}
|
||||||
|
|
||||||
\docparam{underline}{The value can be true or false. At present this has an effect on Windows only.}
|
\docparam{underline}{The value can be true or false. At present this has an effect on Windows and Motif 2.x only.}
|
||||||
|
|
||||||
\docparam{faceName}{An optional string specifying the actual typeface to be used. If the empty string,
|
\docparam{faceName}{An optional string specifying the actual typeface to be used. If the empty string,
|
||||||
a default typeface will chosen based on the family.}
|
a default typeface will chosen based on the family.}
|
||||||
|
@@ -2024,6 +2024,10 @@ typedef void* WXRegion;
|
|||||||
typedef void* WXFont;
|
typedef void* WXFont;
|
||||||
typedef void* WXImage;
|
typedef void* WXImage;
|
||||||
typedef void* WXFontList;
|
typedef void* WXFontList;
|
||||||
|
typedef void* WXRendition;
|
||||||
|
typedef void* WXRenderTable;
|
||||||
|
typedef void* WXFontType; /* either a XmFontList or XmRenderTable */
|
||||||
|
typedef void* WXString;
|
||||||
|
|
||||||
typedef unsigned long Atom; /* this might fail on a few architectures */
|
typedef unsigned long Atom; /* this might fail on a few architectures */
|
||||||
|
|
||||||
|
@@ -99,7 +99,13 @@ public:
|
|||||||
WXDisplay* display = NULL) const;
|
WXDisplay* display = NULL) const;
|
||||||
WXFontList GetFontList(double scale = 1.0,
|
WXFontList GetFontList(double scale = 1.0,
|
||||||
WXDisplay* display = NULL) const;
|
WXDisplay* display = NULL) const;
|
||||||
|
#if __WXMOTIF20__
|
||||||
|
WXRenderTable GetRenderTable(WXDisplay* display) const;
|
||||||
|
#endif
|
||||||
|
// returns either a XmFontList or XmRendition, depending
|
||||||
|
// on Motif version
|
||||||
|
WXFontType GetFontType(WXDisplay* display) const;
|
||||||
|
static WXString GetFontTag();
|
||||||
protected:
|
protected:
|
||||||
virtual void DoSetNativeFontInfo( const wxNativeFontInfo& info );
|
virtual void DoSetNativeFontInfo( const wxNativeFontInfo& info );
|
||||||
|
|
||||||
|
@@ -109,7 +109,10 @@ public:
|
|||||||
m_string = XmStringCreateLtoR((char *)str.c_str(),
|
m_string = XmStringCreateLtoR((char *)str.c_str(),
|
||||||
XmSTRING_DEFAULT_CHARSET);
|
XmSTRING_DEFAULT_CHARSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// just to avoid calling XmStringFree()
|
||||||
|
wxXmString(const XmString& string) { m_string = string; }
|
||||||
|
|
||||||
~wxXmString() { XmStringFree(m_string); }
|
~wxXmString() { XmStringFree(m_string); }
|
||||||
|
|
||||||
// semi-implicit conversion to XmString (shouldn't rely on implicit
|
// semi-implicit conversion to XmString (shouldn't rely on implicit
|
||||||
|
@@ -61,6 +61,9 @@
|
|||||||
/* Define this if your version of GTK+ is greater than 1.3 */
|
/* Define this if your version of GTK+ is greater than 1.3 */
|
||||||
#undef __WXGTK20__
|
#undef __WXGTK20__
|
||||||
|
|
||||||
|
/* Define this if your version of Motif is greater than 2.0 */
|
||||||
|
#undef __WXMOTIF20__
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Define to 1 for Unix[-like] system
|
* Define to 1 for Unix[-like] system
|
||||||
*/
|
*/
|
||||||
|
@@ -54,9 +54,6 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
|
|||||||
|
|
||||||
Widget parentWidget = (Widget) parent->GetClientWidget();
|
Widget parentWidget = (Widget) parent->GetClientWidget();
|
||||||
|
|
||||||
XmFontList fontList =
|
|
||||||
(XmFontList)m_font.GetFontList(1.0, XtDisplay(parentWidget));
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Patch Note (important)
|
* Patch Note (important)
|
||||||
* There is no major reason to put a defaultButtonThickness here.
|
* There is no major reason to put a defaultButtonThickness here.
|
||||||
@@ -69,7 +66,7 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
|
|||||||
m_mainWidget = (WXWidget) XtVaCreateManagedWidget ("button",
|
m_mainWidget = (WXWidget) XtVaCreateManagedWidget ("button",
|
||||||
xmPushButtonWidgetClass,
|
xmPushButtonWidgetClass,
|
||||||
parentWidget,
|
parentWidget,
|
||||||
XmNfontList, fontList,
|
wxFont::GetFontTag(), m_font.GetFontType(XtDisplay(parentWidget)),
|
||||||
XmNlabelString, text(),
|
XmNlabelString, text(),
|
||||||
// See comment for wxButton::SetDefault
|
// See comment for wxButton::SetDefault
|
||||||
// XmNdefaultButtonShadowThickness, 1,
|
// XmNdefaultButtonShadowThickness, 1,
|
||||||
|
@@ -56,12 +56,10 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
|
|||||||
wxXmString text( label1 );
|
wxXmString text( label1 );
|
||||||
|
|
||||||
Widget parentWidget = (Widget) parent->GetClientWidget();
|
Widget parentWidget = (Widget) parent->GetClientWidget();
|
||||||
XmFontList fontList =
|
|
||||||
(XmFontList) m_font.GetFontList(1.0, XtDisplay(parentWidget));
|
|
||||||
|
|
||||||
m_mainWidget = (WXWidget) XtVaCreateManagedWidget ("toggle",
|
m_mainWidget = (WXWidget) XtVaCreateManagedWidget ("toggle",
|
||||||
xmToggleButtonWidgetClass, parentWidget,
|
xmToggleButtonWidgetClass, parentWidget,
|
||||||
XmNfontList, fontList,
|
wxFont::GetFontTag(), m_font.GetFontType(XtDisplay(parentWidget)),
|
||||||
XmNlabelString, text(),
|
XmNlabelString, text(),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
@@ -244,33 +244,29 @@ void wxChoice::Clear()
|
|||||||
int wxChoice::GetSelection() const
|
int wxChoice::GetSelection() const
|
||||||
{
|
{
|
||||||
XmString text;
|
XmString text;
|
||||||
char *s;
|
|
||||||
Widget label = XmOptionButtonGadget ((Widget) m_buttonWidget);
|
Widget label = XmOptionButtonGadget ((Widget) m_buttonWidget);
|
||||||
XtVaGetValues (label,
|
XtVaGetValues (label,
|
||||||
XmNlabelString, &text,
|
XmNlabelString, &text,
|
||||||
NULL);
|
NULL);
|
||||||
|
wxXmString freeMe(text);
|
||||||
|
wxString s = wxXmStringToString( text );
|
||||||
|
|
||||||
if (XmStringGetLtoR (text, XmSTRING_DEFAULT_CHARSET, &s))
|
if (!s.IsEmpty())
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (wxStringListNode* node = m_stringList.GetFirst ();
|
for (wxStringListNode* node = m_stringList.GetFirst ();
|
||||||
node; node = node->GetNext ())
|
node; node = node->GetNext ())
|
||||||
{
|
{
|
||||||
if (strcmp(node->GetData(), s) == 0)
|
if (wxStrcmp(node->GetData(), s.c_str()) == 0)
|
||||||
{
|
{
|
||||||
XmStringFree(text) ;
|
|
||||||
XtFree (s);
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
i++;
|
i++;
|
||||||
} // for()
|
} // for()
|
||||||
|
|
||||||
XmStringFree(text) ;
|
|
||||||
XtFree (s);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
XmStringFree(text) ;
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -433,13 +429,16 @@ void wxChoice::ChangeFont(bool keepOriginalSize)
|
|||||||
int width, height, width1, height1;
|
int width, height, width1, height1;
|
||||||
GetSize(& width, & height);
|
GetSize(& width, & height);
|
||||||
|
|
||||||
XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay((Widget) m_mainWidget));
|
WXFontType fontType =
|
||||||
XtVaSetValues ((Widget) m_formWidget, XmNfontList, fontList, NULL);
|
m_font.GetFontType(XtDisplay((Widget) m_mainWidget));
|
||||||
XtVaSetValues ((Widget) m_buttonWidget, XmNfontList, fontList, NULL);
|
WXString fontTag = wxFont::GetFontTag();
|
||||||
|
|
||||||
|
XtVaSetValues ((Widget) m_formWidget, fontTag, fontType, NULL);
|
||||||
|
XtVaSetValues ((Widget) m_buttonWidget, fontTag, fontType, NULL);
|
||||||
|
|
||||||
for( size_t i = 0; i < m_noStrings; ++i )
|
for( size_t i = 0; i < m_noStrings; ++i )
|
||||||
XtVaSetValues( (Widget)m_widgetArray[i],
|
XtVaSetValues( (Widget)m_widgetArray[i],
|
||||||
XmNfontList, fontList,
|
fontTag, fontType,
|
||||||
NULL );
|
NULL );
|
||||||
|
|
||||||
GetSize(& width1, & height1);
|
GetSize(& width1, & height1);
|
||||||
|
@@ -105,23 +105,11 @@ wxString wxControl::GetLabel() const
|
|||||||
return wxEmptyString;
|
return wxEmptyString;
|
||||||
|
|
||||||
XmString text;
|
XmString text;
|
||||||
char *s;
|
|
||||||
XtVaGetValues (widget,
|
XtVaGetValues (widget,
|
||||||
XmNlabelString, &text,
|
XmNlabelString, &text,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (XmStringGetLtoR (text, XmSTRING_DEFAULT_CHARSET, &s))
|
return wxXmStringToString( text );
|
||||||
{
|
|
||||||
wxString str(s);
|
|
||||||
XtFree (s);
|
|
||||||
XmStringFree(text);
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// XmStringFree(text);
|
|
||||||
return wxEmptyString;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxControl::ProcessCommand(wxCommandEvent & event)
|
bool wxControl::ProcessCommand(wxCommandEvent & event)
|
||||||
|
@@ -39,6 +39,7 @@
|
|||||||
#include "wx/fontutil.h" // for wxNativeFontInfo
|
#include "wx/fontutil.h" // for wxNativeFontInfo
|
||||||
#include "wx/tokenzr.h"
|
#include "wx/tokenzr.h"
|
||||||
#include "wx/settings.h"
|
#include "wx/settings.h"
|
||||||
|
#include "wx/motif/private.h"
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject)
|
IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject)
|
||||||
|
|
||||||
@@ -56,6 +57,9 @@ public:
|
|||||||
|
|
||||||
WXFontStructPtr m_fontStruct; // XFontStruct
|
WXFontStructPtr m_fontStruct; // XFontStruct
|
||||||
WXFontList m_fontList; // Motif XmFontList
|
WXFontList m_fontList; // Motif XmFontList
|
||||||
|
#if wxCHECK_MOTIF_VERSION( 2, 0 )
|
||||||
|
WXRenderTable m_renderTable; // Motif XmRenderTable
|
||||||
|
#endif
|
||||||
WXDisplay* m_display; // XDisplay
|
WXDisplay* m_display; // XDisplay
|
||||||
int m_scale; // Scale * 100
|
int m_scale; // Scale * 100
|
||||||
};
|
};
|
||||||
@@ -121,6 +125,9 @@ wxXFont::wxXFont()
|
|||||||
{
|
{
|
||||||
m_fontStruct = (WXFontStructPtr) 0;
|
m_fontStruct = (WXFontStructPtr) 0;
|
||||||
m_fontList = (WXFontList) 0;
|
m_fontList = (WXFontList) 0;
|
||||||
|
#if wxCHECK_MOTIF_VERSION( 2, 0 )
|
||||||
|
m_renderTable = (WXRenderTable) 0;
|
||||||
|
#endif
|
||||||
m_display = (WXDisplay*) 0;
|
m_display = (WXDisplay*) 0;
|
||||||
m_scale = 100;
|
m_scale = 100;
|
||||||
}
|
}
|
||||||
@@ -128,9 +135,13 @@ wxXFont::wxXFont()
|
|||||||
wxXFont::~wxXFont()
|
wxXFont::~wxXFont()
|
||||||
{
|
{
|
||||||
XmFontList fontList = (XmFontList) m_fontList;
|
XmFontList fontList = (XmFontList) m_fontList;
|
||||||
|
|
||||||
XmFontListFree (fontList);
|
XmFontListFree (fontList);
|
||||||
|
|
||||||
|
#if wxCHECK_MOTIF_VERSION( 2, 0 )
|
||||||
|
XmRenderTable renderTable = (XmRenderTable) m_renderTable;
|
||||||
|
XmRenderTableFree (renderTable);
|
||||||
|
#endif
|
||||||
|
|
||||||
// TODO: why does freeing the font produce a segv???
|
// TODO: why does freeing the font produce a segv???
|
||||||
// Note that XFreeFont wasn't called in wxWin 1.68 either.
|
// Note that XFreeFont wasn't called in wxWin 1.68 either.
|
||||||
// XFontStruct* fontStruct = (XFontStruct*) m_fontStruct;
|
// XFontStruct* fontStruct = (XFontStruct*) m_fontStruct;
|
||||||
@@ -533,6 +544,24 @@ wxXFont* wxFont::GetInternalFont(double scale, WXDisplay* display) const
|
|||||||
f->m_fontList = XmFontListCreate ((XFontStruct*) font, XmSTRING_DEFAULT_CHARSET);
|
f->m_fontList = XmFontListCreate ((XFontStruct*) font, XmSTRING_DEFAULT_CHARSET);
|
||||||
M_FONTDATA->m_fonts.Append(f);
|
M_FONTDATA->m_fonts.Append(f);
|
||||||
|
|
||||||
|
#if wxCHECK_MOTIF_VERSION( 2, 0 ) && !wxCHECK_LESSTIF()
|
||||||
|
XmRendition rendition;
|
||||||
|
XmRenderTable renderTable;
|
||||||
|
Arg args[5];
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
XtSetArg( args[count], XmNfont, font ); ++count;
|
||||||
|
XtSetArg( args[count], XmNunderlineType,
|
||||||
|
GetUnderlined() ? XmSINGLE_LINE : XmNO_LINE ); ++count;
|
||||||
|
rendition = XmRenditionCreate( XmGetXmDisplay( (Display*)f->m_display ),
|
||||||
|
(XmStringTag)"",
|
||||||
|
args, count );
|
||||||
|
renderTable = XmRenderTableAddRenditions( NULL, &rendition, 1,
|
||||||
|
XmMERGE_REPLACE );
|
||||||
|
|
||||||
|
f->m_renderTable = (WXRenderTable)renderTable;
|
||||||
|
#endif
|
||||||
|
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -550,3 +579,31 @@ WXFontList wxFont::GetFontList(double scale, WXDisplay* display) const
|
|||||||
return (f ? f->m_fontList : (WXFontList) 0);
|
return (f ? f->m_fontList : (WXFontList) 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if wxCHECK_MOTIF_VERSION( 2, 0 )
|
||||||
|
|
||||||
|
WXRenderTable wxFont::GetRenderTable(WXDisplay* display) const
|
||||||
|
{
|
||||||
|
wxXFont* f = GetInternalFont(1.0, display);
|
||||||
|
|
||||||
|
return (f ? f->m_renderTable : (WXFontList) 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
WXFontType wxFont::GetFontType(WXDisplay* display) const
|
||||||
|
{
|
||||||
|
#if wxCHECK_MOTIF_VERSION( 2, 0 ) && !wxCHECK_LESSTIF()
|
||||||
|
return Ok() ? GetRenderTable(display) : NULL;
|
||||||
|
#else
|
||||||
|
return Ok() ? GetFontList(1.0, display) : NULL;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/*static*/ WXString wxFont::GetFontTag()
|
||||||
|
{
|
||||||
|
#if wxCHECK_MOTIF_VERSION( 2, 0 ) && !wxCHECK_LESSTIF()
|
||||||
|
return (WXString)XmNrenderTable;
|
||||||
|
#else
|
||||||
|
return (WXString)XmNfontList;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
@@ -92,12 +92,11 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
Widget parentWidget = (Widget) parent->GetClientWidget();
|
Widget parentWidget = (Widget) parent->GetClientWidget();
|
||||||
|
|
||||||
XmFontList fontList = (XmFontList)NULL;
|
WXFontType fontType = (WXFontType)NULL;
|
||||||
|
|
||||||
if( m_font.Ok() )
|
if( m_font.Ok() )
|
||||||
{
|
{
|
||||||
fontList = (XmFontList)m_font.GetFontList(1.0,
|
fontType = m_font.GetFontType(XtDisplay(parentWidget));
|
||||||
XtDisplay(parentWidget));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Arg args[4];
|
Arg args[4];
|
||||||
@@ -108,9 +107,9 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
( m_windowStyle & wxLB_EXTENDED ) ? XmEXTENDED_SELECT :
|
( m_windowStyle & wxLB_EXTENDED ) ? XmEXTENDED_SELECT :
|
||||||
XmBROWSE_SELECT );
|
XmBROWSE_SELECT );
|
||||||
++count;
|
++count;
|
||||||
if( fontList )
|
if( fontType )
|
||||||
{
|
{
|
||||||
XtSetArg( args[count], XmNfontList, fontList );
|
XtSetArg( args[count], (String)wxFont::GetFontTag(), fontType );
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
if( m_windowStyle & wxLB_ALWAYS_SB )
|
if( m_windowStyle & wxLB_ALWAYS_SB )
|
||||||
|
@@ -247,8 +247,6 @@ void wxMenuBar::SetLabelTop(size_t pos, const wxString& label)
|
|||||||
|
|
||||||
wxString wxMenuBar::GetLabelTop(size_t pos) const
|
wxString wxMenuBar::GetLabelTop(size_t pos) const
|
||||||
{
|
{
|
||||||
wxString str;
|
|
||||||
|
|
||||||
wxMenu *menu = GetMenu(pos);
|
wxMenu *menu = GetMenu(pos);
|
||||||
if ( menu )
|
if ( menu )
|
||||||
{
|
{
|
||||||
@@ -260,17 +258,11 @@ wxString wxMenuBar::GetLabelTop(size_t pos) const
|
|||||||
XmNlabelString, &text,
|
XmNlabelString, &text,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
char *s;
|
return wxXmStringToString( text );
|
||||||
if ( XmStringGetLtoR(text, XmSTRING_DEFAULT_CHARSET, &s) )
|
|
||||||
{
|
|
||||||
str = s;
|
|
||||||
|
|
||||||
XtFree(s);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return str;
|
return wxEmptyString;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxMenuBar::Append(wxMenu * menu, const wxString& title)
|
bool wxMenuBar::Append(wxMenu * menu, const wxString& title)
|
||||||
@@ -652,21 +644,21 @@ void wxMenu::SetForegroundColour(const wxColour& col)
|
|||||||
|
|
||||||
void wxMenu::ChangeFont(bool keepOriginalSize)
|
void wxMenu::ChangeFont(bool keepOriginalSize)
|
||||||
{
|
{
|
||||||
// lesstif 0.87 hangs when setting XmNfontList
|
// Lesstif 0.87 hangs here, but 0.93 does not
|
||||||
#ifndef LESSTIF_VERSION
|
#if !wxCHECK_LESSTIF() || wxCHECK_LESSTIF_VERSION( 0, 93 )
|
||||||
if (!m_font.Ok() || !m_menuWidget)
|
if (!m_font.Ok() || !m_menuWidget)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay((Widget) m_menuWidget));
|
WXFontType fontType = m_font.GetFontType(XtDisplay((Widget) m_menuWidget));
|
||||||
|
|
||||||
XtVaSetValues ((Widget) m_menuWidget,
|
XtVaSetValues ((Widget) m_menuWidget,
|
||||||
XmNfontList, fontList,
|
wxFont::GetFontTag(), fontType,
|
||||||
NULL);
|
NULL);
|
||||||
if (m_buttonWidget)
|
if (m_buttonWidget)
|
||||||
{
|
{
|
||||||
XtVaSetValues ((Widget) m_buttonWidget,
|
XtVaSetValues ((Widget) m_buttonWidget,
|
||||||
XmNfontList, fontList,
|
wxFont::GetFontTag(), fontType,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( wxMenuItemList::Node *node = GetMenuItems().GetFirst();
|
for ( wxMenuItemList::Node *node = GetMenuItems().GetFirst();
|
||||||
@@ -677,8 +669,8 @@ void wxMenu::ChangeFont(bool keepOriginalSize)
|
|||||||
if (m_menuWidget && item->GetButtonWidget() && m_font.Ok())
|
if (m_menuWidget && item->GetButtonWidget() && m_font.Ok())
|
||||||
{
|
{
|
||||||
XtVaSetValues ((Widget) item->GetButtonWidget(),
|
XtVaSetValues ((Widget) item->GetButtonWidget(),
|
||||||
XmNfontList, fontList,
|
wxFont::GetFontTag(), fontType,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
if (item->GetSubMenu())
|
if (item->GetSubMenu())
|
||||||
item->GetSubMenu()->ChangeFont(keepOriginalSize);
|
item->GetSubMenu()->ChangeFont(keepOriginalSize);
|
||||||
|
@@ -97,31 +97,33 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
|
|||||||
|
|
||||||
wxString label1(wxStripMenuCodes(title));
|
wxString label1(wxStripMenuCodes(title));
|
||||||
|
|
||||||
XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay(parentWidget));
|
WXFontType fontType = m_font.GetFontType(XtDisplay(parentWidget));
|
||||||
|
|
||||||
if (label1 != "")
|
if (label1 != "")
|
||||||
{
|
{
|
||||||
wxXmString text(label1);
|
wxXmString text(label1);
|
||||||
(void)XtVaCreateManagedWidget(label1.c_str(),
|
(void)XtVaCreateManagedWidget( label1.c_str(),
|
||||||
#if wxUSE_GADGETS
|
#if wxUSE_GADGETS
|
||||||
style & wxCOLOURED ? xmLabelWidgetClass
|
style & wxCOLOURED ? xmLabelWidgetClass
|
||||||
: xmLabelGadgetClass,
|
: xmLabelGadgetClass,
|
||||||
(Widget)m_mainWidget,
|
(Widget)m_mainWidget,
|
||||||
#else
|
#else
|
||||||
xmLabelWidgetClass, (Widget)m_mainWidget,
|
xmLabelWidgetClass,
|
||||||
|
(Widget)m_mainWidget,
|
||||||
#endif
|
#endif
|
||||||
XmNfontList, fontList,
|
wxFont::GetFontTag(), fontType,
|
||||||
XmNlabelString, text(),
|
XmNlabelString, text(),
|
||||||
// XmNframeChildType is not in Motif 1.2, nor in Lesstif,
|
// XmNframeChildType is not in Motif 1.2, nor in Lesstif,
|
||||||
// if it was compiled with 1.2 compatibility
|
// if it was compiled with 1.2 compatibility
|
||||||
// TODO: check this still looks OK for Motif 1.2.
|
// TODO: check this still looks OK for Motif 1.2.
|
||||||
#if (XmVersion > 1200)
|
#if (XmVersion > 1200)
|
||||||
XmNframeChildType, XmFRAME_TITLE_CHILD,
|
XmNframeChildType, XmFRAME_TITLE_CHILD,
|
||||||
#else
|
#else
|
||||||
XmNchildType, XmFRAME_TITLE_CHILD,
|
XmNchildType, XmFRAME_TITLE_CHILD,
|
||||||
#endif
|
#endif
|
||||||
XmNchildVerticalAlignment, XmALIGNMENT_CENTER,
|
XmNchildVerticalAlignment,
|
||||||
NULL);
|
XmALIGNMENT_CENTER,
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
Arg args[3];
|
Arg args[3];
|
||||||
@@ -148,9 +150,9 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
|
|||||||
#if wxUSE_GADGETS
|
#if wxUSE_GADGETS
|
||||||
xmToggleButtonGadgetClass, radioBoxWidget,
|
xmToggleButtonGadgetClass, radioBoxWidget,
|
||||||
#else
|
#else
|
||||||
xmToggleButtonWidgetClass, radioBoxWidget,
|
xmToggleButtonWidgetClass, radioBoxWidget,
|
||||||
#endif
|
#endif
|
||||||
XmNfontList, fontList,
|
wxFont::GetFontTag(), fontType,
|
||||||
NULL);
|
NULL);
|
||||||
XtAddCallback ((Widget) m_radioButtons[i], XmNvalueChangedCallback, (XtCallbackProc) wxRadioBoxCallback,
|
XtAddCallback ((Widget) m_radioButtons[i], XmNvalueChangedCallback, (XtCallbackProc) wxRadioBoxCallback,
|
||||||
(XtPointer) this);
|
(XtPointer) this);
|
||||||
@@ -194,12 +196,11 @@ void wxRadioBox::SetString(int item, const wxString& label)
|
|||||||
if (label != "")
|
if (label != "")
|
||||||
{
|
{
|
||||||
wxString label1(wxStripMenuCodes(label));
|
wxString label1(wxStripMenuCodes(label));
|
||||||
XmString text = XmStringCreateSimple ((char*) (const char*) label1);
|
wxXmString text( label1 );
|
||||||
XtVaSetValues (widget,
|
XtVaSetValues (widget,
|
||||||
XmNlabelString, text,
|
XmNlabelString, text(),
|
||||||
XmNlabelType, XmSTRING,
|
XmNlabelType, XmSTRING,
|
||||||
NULL);
|
NULL);
|
||||||
XmStringFree (text);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -358,7 +359,8 @@ void wxRadioBox::ChangeFont(bool keepOriginalSize)
|
|||||||
{
|
{
|
||||||
wxWindow::ChangeFont(keepOriginalSize);
|
wxWindow::ChangeFont(keepOriginalSize);
|
||||||
|
|
||||||
XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay((Widget) GetTopWidget()));
|
WXFontType fontType =
|
||||||
|
m_font.GetFontType(XtDisplay((Widget) GetTopWidget()));
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < m_noItems; i++)
|
for (i = 0; i < m_noItems; i++)
|
||||||
@@ -366,7 +368,7 @@ void wxRadioBox::ChangeFont(bool keepOriginalSize)
|
|||||||
WXWidget radioButton = m_radioButtons[i];
|
WXWidget radioButton = m_radioButtons[i];
|
||||||
|
|
||||||
XtVaSetValues ((Widget) radioButton,
|
XtVaSetValues ((Widget) radioButton,
|
||||||
XmNfontList, fontList,
|
wxFont::GetFontTag(), fontType,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -72,9 +72,9 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
wxString label1(wxStripMenuCodes(label));
|
wxString label1(wxStripMenuCodes(label));
|
||||||
|
|
||||||
XmString text = XmStringCreateSimple ((char*) (const char*) label1);
|
wxXmString text( label1 );
|
||||||
|
|
||||||
XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay(parentWidget));
|
WXFontType fontType = m_font.GetFontType(XtDisplay(parentWidget));
|
||||||
|
|
||||||
Widget radioButtonWidget = XtVaCreateManagedWidget ("toggle",
|
Widget radioButtonWidget = XtVaCreateManagedWidget ("toggle",
|
||||||
#if wxUSE_GADGETS
|
#if wxUSE_GADGETS
|
||||||
@@ -82,12 +82,11 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id,
|
|||||||
#else
|
#else
|
||||||
xmToggleButtonWidgetClass, parentWidget,
|
xmToggleButtonWidgetClass, parentWidget,
|
||||||
#endif
|
#endif
|
||||||
XmNfontList, fontList,
|
wxFont::GetFontTag(), fontType,
|
||||||
XmNlabelString, text,
|
XmNlabelString, text(),
|
||||||
XmNfillOnSelect, True,
|
XmNfillOnSelect, True,
|
||||||
XmNindicatorType, XmONE_OF_MANY, // diamond-shape
|
XmNindicatorType, XmONE_OF_MANY, // diamond-shape
|
||||||
NULL);
|
NULL);
|
||||||
XmStringFree (text);
|
|
||||||
|
|
||||||
XtAddCallback (radioButtonWidget, XmNvalueChangedCallback, (XtCallbackProc) wxRadioButtonCallback,
|
XtAddCallback (radioButtonWidget, XmNvalueChangedCallback, (XtCallbackProc) wxRadioButtonCallback,
|
||||||
(XtPointer) this);
|
(XtPointer) this);
|
||||||
|
@@ -105,13 +105,13 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
bool hasLabel = (!label.IsNull() && !label.IsEmpty()) ;
|
bool hasLabel = (!label.IsNull() && !label.IsEmpty()) ;
|
||||||
if (hasLabel)
|
if (hasLabel)
|
||||||
{
|
{
|
||||||
XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay( parentWidget ) );
|
WXFontType fontType = m_font.GetFontType( XtDisplay( parentWidget ) );
|
||||||
wxString label1(wxStripMenuCodes(label));
|
wxString label1(wxStripMenuCodes(label));
|
||||||
wxXmString text(label1);
|
wxXmString text(label1);
|
||||||
|
|
||||||
m_labelWidget = (WXWidget) XtVaCreateManagedWidget ("staticboxlabel",
|
m_labelWidget = (WXWidget) XtVaCreateManagedWidget ("staticboxlabel",
|
||||||
xmLabelWidgetClass, (Widget)m_mainWidget,
|
xmLabelWidgetClass, (Widget)m_mainWidget,
|
||||||
XmNfontList, fontList,
|
wxFont::GetFontTag(), fontType,
|
||||||
XmNlabelString, text(),
|
XmNlabelString, text(),
|
||||||
#if wxCHECK_MOTIF_VERSION( 2, 0 )
|
#if wxCHECK_MOTIF_VERSION( 2, 0 )
|
||||||
XmNframeChildType, XmFRAME_TITLE_CHILD,
|
XmNframeChildType, XmFRAME_TITLE_CHILD,
|
||||||
|
@@ -101,26 +101,24 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
|
|||||||
// Use XmStringCreateLtoR(), since XmStringCreateSimple
|
// Use XmStringCreateLtoR(), since XmStringCreateSimple
|
||||||
// doesn't obey separators.
|
// doesn't obey separators.
|
||||||
// XmString text = XmStringCreateSimple (label1);
|
// XmString text = XmStringCreateSimple (label1);
|
||||||
XmString text = XmStringCreateLtoR (label1, XmSTRING_DEFAULT_CHARSET);
|
wxXmString text( label1 );
|
||||||
#endif // 0
|
#endif // 0
|
||||||
|
|
||||||
XmString text = XmStringCreateLtoR ((char *)(const char*)label, XmSTRING_DEFAULT_CHARSET);
|
wxXmString text( label );
|
||||||
|
|
||||||
XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay(parentWidget));
|
WXFontType fontType = m_font.GetFontType(XtDisplay(parentWidget));
|
||||||
|
|
||||||
m_labelWidget = XtVaCreateManagedWidget ((char*) (const char*) name,
|
m_labelWidget = XtVaCreateManagedWidget ((char*) (const char*) name,
|
||||||
xmLabelWidgetClass,
|
xmLabelWidgetClass,
|
||||||
borderWidget ? borderWidget : parentWidget,
|
borderWidget ? borderWidget : parentWidget,
|
||||||
XmNfontList, fontList,
|
wxFont::GetFontTag(), fontType,
|
||||||
XmNlabelString, text,
|
XmNlabelString, text(),
|
||||||
XmNalignment,
|
XmNalignment,
|
||||||
((style & wxALIGN_RIGHT) ? XmALIGNMENT_END :
|
((style & wxALIGN_RIGHT) ? XmALIGNMENT_END :
|
||||||
((style & wxALIGN_CENTRE) ? XmALIGNMENT_CENTER :
|
((style & wxALIGN_CENTRE) ? XmALIGNMENT_CENTER :
|
||||||
XmALIGNMENT_BEGINNING)),
|
XmALIGNMENT_BEGINNING)),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
XmStringFree (text);
|
|
||||||
|
|
||||||
m_mainWidget = borderWidget ? borderWidget : m_labelWidget;
|
m_mainWidget = borderWidget ? borderWidget : m_labelWidget;
|
||||||
|
|
||||||
SetCanAddEventHandler(TRUE);
|
SetCanAddEventHandler(TRUE);
|
||||||
|
@@ -1249,14 +1249,11 @@ void wxDoChangeBackgroundColour(WXWidget widget, wxColour& backgroundColour, boo
|
|||||||
|
|
||||||
extern void wxDoChangeFont(WXWidget widget, wxFont& font)
|
extern void wxDoChangeFont(WXWidget widget, wxFont& font)
|
||||||
{
|
{
|
||||||
// lesstif 0.87 hangs here, but 0.93 does not
|
// Lesstif 0.87 hangs here, but 0.93 does not
|
||||||
#if !defined(LESSTIF_VERSION) \
|
#if !wxCHECK_LESSTIF() || wxCHECK_LESSTIF_VERSION( 0, 93 )
|
||||||
|| (defined(LesstifVersion) && LesstifVersion >= 93)
|
|
||||||
|
|
||||||
Widget w = (Widget)widget;
|
Widget w = (Widget)widget;
|
||||||
XmFontList fontList = (XmFontList)font.GetFontList(1.0, XtDisplay(w));
|
|
||||||
XtVaSetValues( w,
|
XtVaSetValues( w,
|
||||||
XmNfontList, fontList,
|
wxFont::GetFontTag(), font.GetFontType( XtDisplay(w) ),
|
||||||
NULL );
|
NULL );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1997,7 +1997,8 @@ static void wxCanvasEnterLeave(Widget drawingArea,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fix to make it work under Motif 1.0 (!)
|
// Fix to make it work under Motif 1.0 (!)
|
||||||
static void wxCanvasMotionEvent (Widget WXUNUSED(drawingArea), XButtonEvent * WXUNUSED(event))
|
static void wxCanvasMotionEvent (Widget WXUNUSED(drawingArea),
|
||||||
|
XButtonEvent *WXUNUSED(event))
|
||||||
{
|
{
|
||||||
#if XmVersion <= 1000
|
#if XmVersion <= 1000
|
||||||
XmDrawingAreaCallbackStruct cbs;
|
XmDrawingAreaCallbackStruct cbs;
|
||||||
|
Reference in New Issue
Block a user