Added new wxFontDialog,

Added PICFLAGS to parser compilation,
  Implemented COL_CLICK and wxLC_NO_HEADER


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3471 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling 1999-08-24 20:26:06 +00:00
parent 799a341cc3
commit 8636aed896
20 changed files with 519 additions and 392 deletions

View File

@ -1,5 +1,5 @@
# #
# This file was automatically generated by tmake at 12:57, 1999/08/23 # This file was automatically generated by tmake at 19:37, 1999/08/24
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE UNX.T! # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE UNX.T!
# #
@ -330,6 +330,7 @@ GTK_HEADERS = \
gtk/dnd.h \ gtk/dnd.h \
gtk/filedlg.h \ gtk/filedlg.h \
gtk/font.h \ gtk/font.h \
gtk/fontdlg.h \
gtk/frame.h \ gtk/frame.h \
gtk/gauge.h \ gtk/gauge.h \
gtk/gdiobj.h \ gtk/gdiobj.h \
@ -572,7 +573,6 @@ GTK_GENERICOBJS = \
dcpsg.o \ dcpsg.o \
dirdlgg.o \ dirdlgg.o \
filedlgg.o \ filedlgg.o \
fontdlgg.o \
gridg.o \ gridg.o \
helphtml.o \ helphtml.o \
helpwxht.o \ helpwxht.o \
@ -605,7 +605,6 @@ GTK_GENERICDEPS = \
dcpsg.d \ dcpsg.d \
dirdlgg.d \ dirdlgg.d \
filedlgg.d \ filedlgg.d \
fontdlgg.d \
gridg.d \ gridg.d \
helphtml.d \ helphtml.d \
helpwxht.d \ helpwxht.d \
@ -820,6 +819,7 @@ GTK_GUIOBJS = \
dialog.o \ dialog.o \
dnd.o \ dnd.o \
font.o \ font.o \
fontdlg.o \
frame.o \ frame.o \
gauge.o \ gauge.o \
gdiobj.o \ gdiobj.o \
@ -878,6 +878,7 @@ GTK_GUIDEPS = \
dialog.d \ dialog.d \
dnd.d \ dnd.d \
font.d \ font.d \
fontdlg.d \
frame.d \ frame.d \
gauge.d \ gauge.d \
gdiobj.d \ gdiobj.d \
@ -1809,7 +1810,7 @@ CREATE_INSTALLED_LINKS: $(libdir)/@WX_TARGET_LIBRARY@
$(OBJECTS): $(WXDIR)/include/wx/defs.h $(WXDIR)/include/wx/object.h $(WXDIR)/include/wx/setup.h $(OBJECTS): $(WXDIR)/include/wx/defs.h $(WXDIR)/include/wx/object.h $(WXDIR)/include/wx/setup.h
parser.o: parser.c lexer.c parser.o: parser.c lexer.c
$(CCLEX) -c $(CFLAGS) -o $@ parser.c $(CCLEX) -c $(CFLAGS) $(PICFLAGS) -o $@ parser.c
parser.c: $(COMMDIR)/parser.y lexer.c parser.c: $(COMMDIR)/parser.y lexer.c
$(YACC) $(COMMDIR)/parser.y $(YACC) $(COMMDIR)/parser.y

529
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -1301,6 +1301,8 @@ SEARCH_INCLUDE="\
\ \
/usr/include/Motif1.2 \ /usr/include/Motif1.2 \
/opt/xpm/include/X11 \ /opt/xpm/include/X11 \
/opt/GBxpm/include/ \
/opt/GBxpm/X11/include/ \
\ \
/usr/Motif1.2/include \ /usr/Motif1.2/include \
/usr/dt/include \ /usr/dt/include \

View File

@ -57,7 +57,7 @@ choicdgg.cpp G
colrdlgg.cpp G G colrdlgg.cpp G G
dcpsg.cpp G U dcpsg.cpp G U
dirdlgg.cpp G 16 dirdlgg.cpp G 16
fontdlgg.cpp G G fontdlgg.cpp G G,R
filedlgg.cpp G U,X filedlgg.cpp G U,X
gridg.cpp G gridg.cpp G
helphtml.cpp G G helphtml.cpp G G
@ -294,6 +294,7 @@ dcscreen.cpp R
dialog.cpp R dialog.cpp R
dnd.cpp R dnd.cpp R
font.cpp R font.cpp R
fontdlg.cpp R
frame.cpp R frame.cpp R
gauge.cpp R gauge.cpp R
gdiobj.cpp R gdiobj.cpp R
@ -601,6 +602,7 @@ dialog.h K
dnd.h K dnd.h K
filedlg.h K filedlg.h K
font.h K font.h K
fontdlg.h K
frame.h K frame.h K
gauge.h K gauge.h K
gdiobj.h K gdiobj.h K

View File

@ -512,7 +512,7 @@ CREATE_INSTALLED_LINKS: $(libdir)/@WX_TARGET_LIBRARY@
$(OBJECTS): $(WXDIR)/include/wx/defs.h $(WXDIR)/include/wx/object.h $(WXDIR)/include/wx/setup.h $(OBJECTS): $(WXDIR)/include/wx/defs.h $(WXDIR)/include/wx/object.h $(WXDIR)/include/wx/setup.h
parser.o: parser.c lexer.c parser.o: parser.c lexer.c
$(CCLEX) -c $(CFLAGS) -o $@ parser.c $(CCLEX) -c $(CFLAGS) $(PICFLAGS) -o $@ parser.c
parser.c: $(COMMDIR)/parser.y lexer.c parser.c: $(COMMDIR)/parser.y lexer.c
$(YACC) $(COMMDIR)/parser.y $(YACC) $(COMMDIR)/parser.y

View File

@ -8,9 +8,7 @@
# define wxFontDialog wxGenericFontDialog # define wxFontDialog wxGenericFontDialog
# define sm_classwxFontDialog sm_classwxGenericFontDialog # define sm_classwxFontDialog sm_classwxGenericFontDialog
#elif defined(__WXGTK__) #elif defined(__WXGTK__)
#include "wx/generic/fontdlgg.h" #include "wx/gtk/fontdlg.h"
# define wxFontDialog wxGenericFontDialog
# define sm_classwxFontDialog sm_classwxGenericFontDialog
#elif defined(__WXQT__) #elif defined(__WXQT__)
#include "wx/generic/fontdlgg.h" #include "wx/generic/fontdlgg.h"
# define wxFontDialog wxGenericFontDialog # define wxFontDialog wxGenericFontDialog

View File

@ -71,7 +71,7 @@ typedef int (*wxListCtrlCompare)(long item1, long item2, long sortData);
#define wxLC_AUTOARRANGE 0x0100 // not supported in wxGLC #define wxLC_AUTOARRANGE 0x0100 // not supported in wxGLC
#define wxLC_USER_TEXT 0x0200 // not supported in wxGLC (how does it work?) #define wxLC_USER_TEXT 0x0200 // not supported in wxGLC (how does it work?)
#define wxLC_EDIT_LABELS 0x0400 #define wxLC_EDIT_LABELS 0x0400
#define wxLC_NO_HEADER 0x0800 // not supported in wxGLC #define wxLC_NO_HEADER 0x0800
#define wxLC_NO_SORT_HEADER 0x1000 // not supported in wxGLC #define wxLC_NO_SORT_HEADER 0x1000 // not supported in wxGLC
#define wxLC_SINGLE_SEL 0x2000 #define wxLC_SINGLE_SEL 0x2000
#define wxLC_SORT_ASCENDING 0x4000 #define wxLC_SORT_ASCENDING 0x4000

View File

@ -79,9 +79,7 @@ class wxAcceleratorEntry: public wxObject
class wxAcceleratorTable: public wxObject class wxAcceleratorTable: public wxObject
{ {
DECLARE_DYNAMIC_CLASS(wxAcceleratorTable) public:
public:
wxAcceleratorTable(); wxAcceleratorTable();
wxAcceleratorTable(int n, wxAcceleratorEntry entries[] ); wxAcceleratorTable(int n, wxAcceleratorEntry entries[] );
~wxAcceleratorTable(); ~wxAcceleratorTable();
@ -99,10 +97,12 @@ class wxAcceleratorTable: public wxObject
bool Ok() const; bool Ok() const;
// private: // implementation
int GetCommand( wxKeyEvent &event ); int GetCommand( wxKeyEvent &event );
private:
DECLARE_DYNAMIC_CLASS(wxAcceleratorTable)
}; };
#endif #endif

View File

@ -30,8 +30,6 @@ class wxLog;
class wxApp: public wxAppBase class wxApp: public wxAppBase
{ {
DECLARE_DYNAMIC_CLASS(wxApp)
public: public:
wxApp(); wxApp();
~wxApp(); ~wxApp();
@ -82,6 +80,7 @@ private:
/// Set to TRUE while we are in wxYield(). /// Set to TRUE while we are in wxYield().
bool m_suppressIdleEvents; bool m_suppressIdleEvents;
DECLARE_DYNAMIC_CLASS(wxApp)
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };

View File

@ -33,8 +33,6 @@ class wxBitmap;
class wxMask: public wxObject class wxMask: public wxObject
{ {
DECLARE_DYNAMIC_CLASS(wxMask)
public: public:
wxMask(); wxMask();
wxMask( const wxBitmap& bitmap, const wxColour& colour ); wxMask( const wxBitmap& bitmap, const wxColour& colour );
@ -47,9 +45,12 @@ public:
bool Create( const wxBitmap& bitmap ); bool Create( const wxBitmap& bitmap );
// implementation // implementation
GdkBitmap *m_bitmap; GdkBitmap *m_bitmap;
GdkBitmap *GetBitmap() const; GdkBitmap *GetBitmap() const;
private:
DECLARE_DYNAMIC_CLASS(wxMask)
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -58,8 +59,6 @@ public:
class wxBitmap: public wxObject class wxBitmap: public wxObject
{ {
DECLARE_DYNAMIC_CLASS(wxBitmap)
public: public:
wxBitmap(); wxBitmap();
wxBitmap( int width, int height, int depth = -1 ); wxBitmap( int width, int height, int depth = -1 );
@ -88,7 +87,7 @@ public:
wxPalette *GetColourMap() const wxPalette *GetColourMap() const
{ return GetPalette(); }; { return GetPalette(); };
// implementation // implementation
void SetHeight( int height ); void SetHeight( int height );
void SetWidth( int width ); void SetWidth( int width );
@ -99,6 +98,9 @@ public:
GdkBitmap *GetBitmap() const; GdkBitmap *GetBitmap() const;
// no data :-) // no data :-)
private:
DECLARE_DYNAMIC_CLASS(wxBitmap)
}; };
#endif // __GTKBITMAPH__ #endif // __GTKBITMAPH__

View File

@ -82,7 +82,7 @@ public:
// implementation // implementation
wxFont( char *xFontName ); wxFont( GdkFont* font, char *xFontName );
void Unshare(); void Unshare();
GdkFont* GetInternalFont(float scale = 1.0) const; GdkFont* GetInternalFont(float scale = 1.0) const;

View File

@ -79,9 +79,7 @@ class wxAcceleratorEntry: public wxObject
class wxAcceleratorTable: public wxObject class wxAcceleratorTable: public wxObject
{ {
DECLARE_DYNAMIC_CLASS(wxAcceleratorTable) public:
public:
wxAcceleratorTable(); wxAcceleratorTable();
wxAcceleratorTable(int n, wxAcceleratorEntry entries[] ); wxAcceleratorTable(int n, wxAcceleratorEntry entries[] );
~wxAcceleratorTable(); ~wxAcceleratorTable();
@ -99,10 +97,12 @@ class wxAcceleratorTable: public wxObject
bool Ok() const; bool Ok() const;
// private: // implementation
int GetCommand( wxKeyEvent &event ); int GetCommand( wxKeyEvent &event );
private:
DECLARE_DYNAMIC_CLASS(wxAcceleratorTable)
}; };
#endif #endif

View File

@ -30,8 +30,6 @@ class wxLog;
class wxApp: public wxAppBase class wxApp: public wxAppBase
{ {
DECLARE_DYNAMIC_CLASS(wxApp)
public: public:
wxApp(); wxApp();
~wxApp(); ~wxApp();
@ -82,6 +80,7 @@ private:
/// Set to TRUE while we are in wxYield(). /// Set to TRUE while we are in wxYield().
bool m_suppressIdleEvents; bool m_suppressIdleEvents;
DECLARE_DYNAMIC_CLASS(wxApp)
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };

View File

@ -33,8 +33,6 @@ class wxBitmap;
class wxMask: public wxObject class wxMask: public wxObject
{ {
DECLARE_DYNAMIC_CLASS(wxMask)
public: public:
wxMask(); wxMask();
wxMask( const wxBitmap& bitmap, const wxColour& colour ); wxMask( const wxBitmap& bitmap, const wxColour& colour );
@ -47,9 +45,12 @@ public:
bool Create( const wxBitmap& bitmap ); bool Create( const wxBitmap& bitmap );
// implementation // implementation
GdkBitmap *m_bitmap; GdkBitmap *m_bitmap;
GdkBitmap *GetBitmap() const; GdkBitmap *GetBitmap() const;
private:
DECLARE_DYNAMIC_CLASS(wxMask)
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -58,8 +59,6 @@ public:
class wxBitmap: public wxObject class wxBitmap: public wxObject
{ {
DECLARE_DYNAMIC_CLASS(wxBitmap)
public: public:
wxBitmap(); wxBitmap();
wxBitmap( int width, int height, int depth = -1 ); wxBitmap( int width, int height, int depth = -1 );
@ -88,7 +87,7 @@ public:
wxPalette *GetColourMap() const wxPalette *GetColourMap() const
{ return GetPalette(); }; { return GetPalette(); };
// implementation // implementation
void SetHeight( int height ); void SetHeight( int height );
void SetWidth( int width ); void SetWidth( int width );
@ -99,6 +98,9 @@ public:
GdkBitmap *GetBitmap() const; GdkBitmap *GetBitmap() const;
// no data :-) // no data :-)
private:
DECLARE_DYNAMIC_CLASS(wxBitmap)
}; };
#endif // __GTKBITMAPH__ #endif // __GTKBITMAPH__

View File

@ -82,7 +82,7 @@ public:
// implementation // implementation
wxFont( char *xFontName ); wxFont( GdkFont* font, char *xFontName );
void Unshare(); void Unshare();
GdkFont* GetInternalFont(float scale = 1.0) const; GdkFont* GetInternalFont(float scale = 1.0) const;

View File

@ -60,6 +60,7 @@ BEGIN_EVENT_TABLE(MyListCtrl, wxListCtrl)
EVT_LIST_ITEM_DESELECTED(LIST_CTRL, MyListCtrl::OnDeselected) EVT_LIST_ITEM_DESELECTED(LIST_CTRL, MyListCtrl::OnDeselected)
EVT_LIST_KEY_DOWN(LIST_CTRL, MyListCtrl::OnListKeyDown) EVT_LIST_KEY_DOWN(LIST_CTRL, MyListCtrl::OnListKeyDown)
EVT_LIST_ITEM_ACTIVATED(LIST_CTRL, MyListCtrl::OnActivated) EVT_LIST_ITEM_ACTIVATED(LIST_CTRL, MyListCtrl::OnActivated)
EVT_LIST_COL_CLICK(LIST_CTRL, MyListCtrl::OnColClick)
END_EVENT_TABLE() END_EVENT_TABLE()
IMPLEMENT_APP(MyApp) IMPLEMENT_APP(MyApp)
@ -146,7 +147,7 @@ bool MyApp::OnInit(void)
// Make a panel with a message // Make a panel with a message
frame->m_listCtrl = new MyListCtrl(frame, LIST_CTRL, wxPoint(0, 0), wxSize(400, 200), frame->m_listCtrl = new MyListCtrl(frame, LIST_CTRL, wxPoint(0, 0), wxSize(400, 200),
wxLC_LIST|wxSUNKEN_BORDER|wxLC_EDIT_LABELS); wxLC_LIST|wxSUNKEN_BORDER|wxLC_EDIT_LABELS );
// wxLC_LIST|wxLC_USER_TEXT|wxSUNKEN_BORDER); // wxLC_USER_TEXT requires app to supply all text on demand // wxLC_LIST|wxLC_USER_TEXT|wxSUNKEN_BORDER); // wxLC_USER_TEXT requires app to supply all text on demand
frame->m_logWindow = new wxTextCtrl(frame, -1, "", wxPoint(0, 0), wxSize(400, 200), wxTE_MULTILINE|wxSUNKEN_BORDER); frame->m_logWindow = new wxTextCtrl(frame, -1, "", wxPoint(0, 0), wxSize(400, 200), wxTE_MULTILINE|wxSUNKEN_BORDER);
@ -353,6 +354,20 @@ void MyFrame::OnDeleteAll(wxCommandEvent& WXUNUSED(event))
// MyListCtrl // MyListCtrl
void MyListCtrl::OnColClick(wxListEvent& event)
{
if ( !wxGetApp().GetTopWindow() )
return;
wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow;
if ( !text )
return;
wxString msg;
msg.Printf( "OnColumnClick at %d.\n", event.GetColumn() );
text->WriteText(msg);
}
void MyListCtrl::OnBeginDrag(wxListEvent& event) void MyListCtrl::OnBeginDrag(wxListEvent& event)
{ {
if ( !wxGetApp().GetTopWindow() ) if ( !wxGetApp().GetTopWindow() )
@ -406,10 +421,7 @@ void MyListCtrl::OnEndLabelEdit(wxListEvent& event)
text->WriteText("OnEndLabelEdit: "); text->WriteText("OnEndLabelEdit: ");
text->WriteText(event.m_item.m_text); text->WriteText(event.m_item.m_text);
if (event.m_cancelled) text->WriteText("\n");
text->WriteText(" cancelled by user\n");
else
text->WriteText(" accepted by user\n");
} }
void MyListCtrl::OnDeleteItem(wxListEvent& WXUNUSED(event)) void MyListCtrl::OnDeleteItem(wxListEvent& WXUNUSED(event))

View File

@ -27,6 +27,7 @@ public:
{ {
} }
void OnColClick(wxListEvent& event);
void OnBeginDrag(wxListEvent& event); void OnBeginDrag(wxListEvent& event);
void OnBeginRDrag(wxListEvent& event); void OnBeginRDrag(wxListEvent& event);
void OnBeginLabelEdit(wxListEvent& event); void OnBeginLabelEdit(wxListEvent& event);

View File

@ -875,16 +875,22 @@ void wxListHeaderWindow::OnMouse( wxMouseEvent &event )
for (int j = 0; j < m_owner->GetColumnCount(); j++) for (int j = 0; j < m_owner->GetColumnCount(); j++)
{ {
xpos += m_owner->GetColumnWidth( j ); xpos += m_owner->GetColumnWidth( j );
m_column = j;
if ((abs(x-xpos) < 3) && (y < 22)) if ((abs(x-xpos) < 3) && (y < 22))
{ {
hit_border = TRUE; hit_border = TRUE;
m_column = j; break;
}
if (x-xpos < 0)
{
break; break;
} }
m_minX = xpos; m_minX = xpos;
} }
if (event.LeftDown() && hit_border) if (event.LeftDown())
{
if (hit_border)
{ {
m_isDragging = TRUE; m_isDragging = TRUE;
m_currentX = x; m_currentX = x;
@ -892,6 +898,15 @@ void wxListHeaderWindow::OnMouse( wxMouseEvent &event )
CaptureMouse(); CaptureMouse();
return; return;
} }
else
{
wxListEvent le( wxEVT_COMMAND_LIST_COL_CLICK, GetParent()->GetId() );
le.SetEventObject( GetParent() );
le.m_col = m_column;
GetParent()->GetEventHandler()->ProcessEvent( le );
return;
}
}
if (event.Moving()) if (event.Moving())
{ {
@ -2570,16 +2585,21 @@ void wxListCtrl::SetWindowStyleFlag( long flag )
{ {
m_headerWin = new wxListHeaderWindow( this, -1, m_mainWin, m_headerWin = new wxListHeaderWindow( this, -1, m_mainWin,
wxPoint(0,0), wxSize(width,23), wxTAB_TRAVERSAL ); wxPoint(0,0), wxSize(width,23), wxTAB_TRAVERSAL );
if (HasFlag(wxLC_NO_HEADER))
m_headerWin->Show( FALSE );
} }
else else
{ {
if (flag & wxLC_NO_HEADER)
m_headerWin->Show( FALSE );
else
m_headerWin->Show( TRUE ); m_headerWin->Show( TRUE );
} }
} }
} }
else else
{ {
if (HasFlag(wxLC_REPORT)) if (HasFlag(wxLC_REPORT) && !(HasFlag(wxLC_NO_HEADER)))
{ {
m_headerWin->Show( FALSE ); m_headerWin->Show( FALSE );
} }
@ -2943,7 +2963,7 @@ void wxListCtrl::OnIdle( wxIdleEvent &WXUNUSED(event) )
int w = 0; int w = 0;
int h = 0; int h = 0;
if (HasFlag(wxLC_REPORT)) if (HasFlag(wxLC_REPORT) && !HasFlag(wxLC_NO_HEADER))
{ {
m_headerWin->GetPosition( &x, &y ); m_headerWin->GetPosition( &x, &y );
m_headerWin->GetSize( &w, &h ); m_headerWin->GetSize( &w, &h );

View File

@ -15,6 +15,7 @@
#include "wx/utils.h" #include "wx/utils.h"
#include "wx/log.h" #include "wx/log.h"
#include "wx/gdicmn.h" #include "wx/gdicmn.h"
#include "wx/tokenzr.h"
#include <strings.h> #include <strings.h>
#include "gdk/gdk.h" #include "gdk/gdk.h"
@ -99,14 +100,49 @@ wxFont::wxFont()
if (wxTheFontList) wxTheFontList->Append( this ); if (wxTheFontList) wxTheFontList->Append( this );
} }
wxFont::wxFont( char *xFontName ) wxFont::wxFont( GdkFont *font, char *xFontName )
{ {
if (!xFontName) return; if (!xFontName) return;
m_refData = new wxFontRefData(); m_refData = new wxFontRefData();
M_FONTDATA->m_byXFontName = TRUE; // M_FONTDATA->m_byXFontName = TRUE;
M_FONTDATA->m_font = gdk_font_load( xFontName ); M_FONTDATA->m_font = font;
wxString tmp;
wxString fontname( xFontName );
wxStringTokenizer tn( fontname, _T("-") );
tn.GetNextToken(); // foundry
M_FONTDATA->m_faceName = tn.GetNextToken(); // courier
tmp = tn.GetNextToken().MakeUpper();
if (tmp == _T("BOLD")) M_FONTDATA->m_weight = wxBOLD;
tmp = tn.GetNextToken().MakeUpper();
if (tmp == _T("I")) M_FONTDATA->m_style = wxITALIC;
if (tmp == _T("O")) M_FONTDATA->m_style = wxITALIC;
tn.GetNextToken(); // set width
tn.GetNextToken(); // ?
tn.GetNextToken(); // pixel size
tmp = tn.GetNextToken(); // pointsize
int num = wxStrtol (tmp.c_str(), (wxChar **) NULL, 10);
M_FONTDATA->m_pointSize = num / 10;
tn.GetNextToken(); // x-res
tn.GetNextToken(); // y-res
tmp = tn.GetNextToken().MakeUpper();
if (tmp == _T("M")) M_FONTDATA->m_family = wxMODERN;
else if (M_FONTDATA->m_faceName == _T("TIMES")) M_FONTDATA->m_family = wxROMAN;
else if (M_FONTDATA->m_faceName == _T("HELVETICA")) M_FONTDATA->m_family = wxSWISS;
else if (M_FONTDATA->m_faceName == _T("LUCIDATYPEWRITER")) M_FONTDATA->m_family = wxTELETYPE;
else if (M_FONTDATA->m_faceName == _T("LUCIDA")) M_FONTDATA->m_family = wxDECORATIVE;
else if (M_FONTDATA->m_faceName == _T("UTOPIA")) M_FONTDATA->m_family = wxSCRIPT;
} }
wxFont::wxFont( int pointSize, int family, int style, int weight, bool underlined, const wxString& face ) wxFont::wxFont( int pointSize, int family, int style, int weight, bool underlined, const wxString& face )

View File

@ -15,6 +15,7 @@
#include "wx/utils.h" #include "wx/utils.h"
#include "wx/log.h" #include "wx/log.h"
#include "wx/gdicmn.h" #include "wx/gdicmn.h"
#include "wx/tokenzr.h"
#include <strings.h> #include <strings.h>
#include "gdk/gdk.h" #include "gdk/gdk.h"
@ -99,14 +100,49 @@ wxFont::wxFont()
if (wxTheFontList) wxTheFontList->Append( this ); if (wxTheFontList) wxTheFontList->Append( this );
} }
wxFont::wxFont( char *xFontName ) wxFont::wxFont( GdkFont *font, char *xFontName )
{ {
if (!xFontName) return; if (!xFontName) return;
m_refData = new wxFontRefData(); m_refData = new wxFontRefData();
M_FONTDATA->m_byXFontName = TRUE; // M_FONTDATA->m_byXFontName = TRUE;
M_FONTDATA->m_font = gdk_font_load( xFontName ); M_FONTDATA->m_font = font;
wxString tmp;
wxString fontname( xFontName );
wxStringTokenizer tn( fontname, _T("-") );
tn.GetNextToken(); // foundry
M_FONTDATA->m_faceName = tn.GetNextToken(); // courier
tmp = tn.GetNextToken().MakeUpper();
if (tmp == _T("BOLD")) M_FONTDATA->m_weight = wxBOLD;
tmp = tn.GetNextToken().MakeUpper();
if (tmp == _T("I")) M_FONTDATA->m_style = wxITALIC;
if (tmp == _T("O")) M_FONTDATA->m_style = wxITALIC;
tn.GetNextToken(); // set width
tn.GetNextToken(); // ?
tn.GetNextToken(); // pixel size
tmp = tn.GetNextToken(); // pointsize
int num = wxStrtol (tmp.c_str(), (wxChar **) NULL, 10);
M_FONTDATA->m_pointSize = num / 10;
tn.GetNextToken(); // x-res
tn.GetNextToken(); // y-res
tmp = tn.GetNextToken().MakeUpper();
if (tmp == _T("M")) M_FONTDATA->m_family = wxMODERN;
else if (M_FONTDATA->m_faceName == _T("TIMES")) M_FONTDATA->m_family = wxROMAN;
else if (M_FONTDATA->m_faceName == _T("HELVETICA")) M_FONTDATA->m_family = wxSWISS;
else if (M_FONTDATA->m_faceName == _T("LUCIDATYPEWRITER")) M_FONTDATA->m_family = wxTELETYPE;
else if (M_FONTDATA->m_faceName == _T("LUCIDA")) M_FONTDATA->m_family = wxDECORATIVE;
else if (M_FONTDATA->m_faceName == _T("UTOPIA")) M_FONTDATA->m_family = wxSCRIPT;
} }
wxFont::wxFont( int pointSize, int family, int style, int weight, bool underlined, const wxString& face ) wxFont::wxFont( int pointSize, int family, int style, int weight, bool underlined, const wxString& face )