1. wxMotif fixes for compilation in "no compatible" mode

2. Common fixes to be able to link minimal sample without stream classes, tree ctrl, list ctrl &c


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1431 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-01-19 19:36:07 +00:00
parent 9982bf4c66
commit 1ccbb61aba
7 changed files with 147 additions and 72 deletions

View File

@@ -114,12 +114,14 @@ public:
const wxString& name); const wxString& name);
// Create toolbar // Create toolbar
#if wxUSE_TOOLBAR
virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER|wxTB_HORIZONTAL, wxWindowID id = -1, const wxString& name = wxToolBarNameStr); virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER|wxTB_HORIZONTAL, wxWindowID id = -1, const wxString& name = wxToolBarNameStr);
virtual wxToolBar *OnCreateToolBar(long style, wxWindowID id, const wxString& name); virtual wxToolBar *OnCreateToolBar(long style, wxWindowID id, const wxString& name);
// If made known to the frame, the frame will manage it automatically. // If made known to the frame, the frame will manage it automatically.
virtual void SetToolBar(wxToolBar *toolbar) ; virtual void SetToolBar(wxToolBar *toolbar) ;
virtual wxToolBar *GetToolBar() const ; virtual wxToolBar *GetToolBar() const ;
virtual void PositionToolBar(); virtual void PositionToolBar();
#endif // wxUSE_TOOLBAR
// Set status line text // Set status line text
virtual void SetStatusText(const wxString& text, int number = 0); virtual void SetStatusText(const wxString& text, int number = 0);
@@ -188,7 +190,10 @@ protected:
wxIcon m_icon; wxIcon m_icon;
bool m_iconized; bool m_iconized;
static bool m_useNativeStatusBar; static bool m_useNativeStatusBar;
#if wxUSE_TOOLBAR
wxToolBar * m_frameToolBar ; wxToolBar * m_frameToolBar ;
#endif // wxUSE_TOOLBAR
//// Motif-specific //// Motif-specific

View File

@@ -100,10 +100,12 @@ wxImage::wxImage( const wxString& name, long type )
LoadFile( name, type ); LoadFile( name, type );
} }
#if wxUSE_STREAM
wxImage::wxImage( wxInputStream& stream, long type ) wxImage::wxImage( wxInputStream& stream, long type )
{ {
LoadFile( stream, type ); LoadFile( stream, type );
} }
#endif // wxUSE_STREAM
wxImage::wxImage( const wxImage& image ) wxImage::wxImage( const wxImage& image )
{ {
@@ -310,6 +312,7 @@ int wxImage::GetHeight() const
bool wxImage::LoadFile( const wxString& filename, long type ) bool wxImage::LoadFile( const wxString& filename, long type )
{ {
#if wxUSE_STREAM
if (wxFileExists(filename)) if (wxFileExists(filename))
{ {
wxFileInputStream stream(filename); wxFileInputStream stream(filename);
@@ -317,12 +320,28 @@ bool wxImage::LoadFile( const wxString& filename, long type )
} }
else { else {
wxLogWarning( "Image file does not exist." ); wxLogError( "Can't load image from file '%s': file does not exist.", filename.c_str() );
return FALSE; return FALSE;
} }
#else // !wxUSE_STREAM
return FALSE;
#endif // wxUSE_STREAM
} }
bool wxImage::SaveFile( const wxString& filename, int type )
{
#if wxUSE_STREAM
wxFileOutputStream stream(filename);
if ( stream.LastError() == wxStream_NOERROR )
return SaveFile(stream, type);
else
#endif // wxUSE_STREAM
return FALSE;
}
#if wxUSE_STREAM
bool wxImage::LoadFile( wxInputStream& stream, long type ) bool wxImage::LoadFile( wxInputStream& stream, long type )
{ {
UnRef(); UnRef();
@@ -341,16 +360,6 @@ bool wxImage::LoadFile( wxInputStream& stream, long type )
return handler->LoadFile( this, stream ); return handler->LoadFile( this, stream );
} }
bool wxImage::SaveFile( const wxString& filename, int type )
{
wxFileOutputStream stream(filename);
if ( stream.LastError() == wxStream_NOERROR )
return SaveFile(stream, type);
else
return FALSE;
}
bool wxImage::SaveFile( wxOutputStream& stream, int type ) bool wxImage::SaveFile( wxOutputStream& stream, int type )
{ {
wxCHECK_MSG( Ok(), FALSE, "invalid image" ); wxCHECK_MSG( Ok(), FALSE, "invalid image" );
@@ -366,6 +375,7 @@ bool wxImage::SaveFile( wxOutputStream& stream, int type )
return handler->SaveFile( this, stream ); return handler->SaveFile( this, stream );
} }
#endif // wxUSE_STREAM
void wxImage::AddHandler( wxImageHandler *handler ) void wxImage::AddHandler( wxImageHandler *handler )
{ {
@@ -463,6 +473,7 @@ void wxImage::CleanUpHandlers()
IMPLEMENT_DYNAMIC_CLASS(wxImageHandler,wxObject) IMPLEMENT_DYNAMIC_CLASS(wxImageHandler,wxObject)
#endif #endif
#if wxUSE_STREAM
bool wxImageHandler::LoadFile( wxImage *WXUNUSED(image), wxInputStream& WXUNUSED(stream) ) bool wxImageHandler::LoadFile( wxImage *WXUNUSED(image), wxInputStream& WXUNUSED(stream) )
{ {
return FALSE; return FALSE;
@@ -472,6 +483,7 @@ bool wxImageHandler::SaveFile( wxImage *WXUNUSED(image), wxOutputStream& WXUNUSE
{ {
return FALSE; return FALSE;
} }
#endif // wxUSE_STREAM
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxPNGHandler // wxPNGHandler
@@ -484,6 +496,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxPNGHandler,wxImageHandler)
#endif #endif
#if wxUSE_STREAM
static void _PNG_stream_reader( png_structp png_ptr, png_bytep data, png_size_t length ) static void _PNG_stream_reader( png_structp png_ptr, png_bytep data, png_size_t length )
{ {
((wxInputStream*) png_get_io_ptr( png_ptr )) -> Read(data, length); ((wxInputStream*) png_get_io_ptr( png_ptr )) -> Read(data, length);
@@ -736,6 +749,7 @@ bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream )
} }
return TRUE; return TRUE;
} }
#endif // wxUSE_STREAM
#endif #endif
@@ -749,6 +763,7 @@ bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream )
IMPLEMENT_DYNAMIC_CLASS(wxBMPHandler,wxImageHandler) IMPLEMENT_DYNAMIC_CLASS(wxBMPHandler,wxImageHandler)
#endif #endif
#if wxUSE_STREAM
bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream ) bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream )
{ {
unsigned char *data, *ptr; unsigned char *data, *ptr;
@@ -1098,6 +1113,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream )
return TRUE; return TRUE;
} }
#endif // wxUSE_STREAM
#ifdef __WXMSW__ #ifdef __WXMSW__

View File

@@ -693,7 +693,14 @@ void wxLogFrame::OnSave(wxCommandEvent& WXUNUSED(event))
// ------------------------- // -------------------------
int nLines = m_pTextCtrl->GetNumberOfLines(); int nLines = m_pTextCtrl->GetNumberOfLines();
for ( int nLine = 0; bOk && nLine < nLines; nLine++ ) { for ( int nLine = 0; bOk && nLine < nLines; nLine++ ) {
bOk = file.Write(m_pTextCtrl->GetLineText(nLine) + wxTextFile::GetEOL()); bOk = file.Write(m_pTextCtrl->GetLineText(nLine) +
// we're not going to pull in the whole wxTextFile if all we need is this...
#if wxUSE_TEXTFILE
wxTextFile::GetEOL()
#else // !wxUSE_TEXTFILE
'\n'
#endif // wxUSE_TEXTFILE
);
} }
if ( bOk ) if ( bOk )

View File

@@ -22,7 +22,7 @@
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/hash.h" #include "wx/hash.h"
#ifdef wxUSE_SERIAL #if wxUSE_SERIAL
#include "wx/objstrm.h" #include "wx/objstrm.h"
#include "wx/serbase.h" #include "wx/serbase.h"
@@ -64,7 +64,7 @@ wxHashTable* wxClassInfo::sm_classTable = (wxHashTable*) NULL;
wxObject::wxObject(void) wxObject::wxObject(void)
{ {
m_refData = (wxObjectRefData *) NULL; m_refData = (wxObjectRefData *) NULL;
#ifdef wxUSE_SERIAL #if wxUSE_SERIAL
m_serialObj = (wxObject_Serialize *)NULL; m_serialObj = (wxObject_Serialize *)NULL;
#endif #endif
} }
@@ -72,7 +72,7 @@ wxObject::wxObject(void)
wxObject::~wxObject(void) wxObject::~wxObject(void)
{ {
UnRef(); UnRef();
#ifdef wxUSE_SERIAL #if wxUSE_SERIAL
if (m_serialObj) if (m_serialObj)
delete m_serialObj; delete m_serialObj;
#endif #endif
@@ -269,7 +269,7 @@ wxObject *wxCreateDynamicObject(const char *name)
return (wxObject*) NULL; return (wxObject*) NULL;
} }
#ifdef wxUSE_SERIAL #if wxUSE_SERIAL
#include "wx/serbase.h" #include "wx/serbase.h"
#include "wx/dynlib.h" #include "wx/dynlib.h"

View File

@@ -293,12 +293,17 @@ public:
virtual void Copy(wxVariantData& data); virtual void Copy(wxVariantData& data);
virtual bool Eq(wxVariantData& data) const; virtual bool Eq(wxVariantData& data) const;
virtual bool Write(ostream& str) const;
virtual bool Write(wxString& str) const;
virtual bool Write(wxOutputStream &str) const;
virtual bool Read(istream& str);
virtual bool Read(wxInputStream& str);
virtual bool Read(wxString& str); virtual bool Read(wxString& str);
virtual bool Write(wxString& str) const;
virtual bool Read(istream& str);
virtual bool Write(ostream& str) const;
#if wxUSE_STREAM
virtual bool Read(wxInputStream& str);
virtual bool Write(wxOutputStream &str) const;
#endif // wxUSE_STREAM
virtual wxString GetType() const { return "long"; }; virtual wxString GetType() const { return "long"; };
protected: protected:
@@ -333,12 +338,6 @@ bool wxVariantDataLong::Write(ostream& str) const
return TRUE; return TRUE;
} }
bool wxVariantDataLong::Write(wxOutputStream& str) const
{
str << m_value;
return TRUE;
}
bool wxVariantDataLong::Write(wxString& str) const bool wxVariantDataLong::Write(wxString& str) const
{ {
str.Printf("%ld", m_value); str.Printf("%ld", m_value);
@@ -351,11 +350,19 @@ bool wxVariantDataLong::Read(istream& str)
return TRUE; return TRUE;
} }
#if wxUSE_STREAM
bool wxVariantDataLong::Write(wxOutputStream& str) const
{
str << m_value;
return TRUE;
}
bool wxVariantDataLong::Read(wxInputStream& str) bool wxVariantDataLong::Read(wxInputStream& str)
{ {
str >> m_value; str >> m_value;
return TRUE; return TRUE;
} }
#endif // wxUSE_STREAM
bool wxVariantDataLong::Read(wxString& str) bool wxVariantDataLong::Read(wxString& str)
{ {
@@ -379,12 +386,14 @@ public:
virtual void Copy(wxVariantData& data); virtual void Copy(wxVariantData& data);
virtual bool Eq(wxVariantData& data) const; virtual bool Eq(wxVariantData& data) const;
virtual bool Read(wxString& str);
virtual bool Write(ostream& str) const; virtual bool Write(ostream& str) const;
virtual bool Write(wxString& str) const; virtual bool Write(wxString& str) const;
virtual bool Write(wxOutputStream &str) const;
virtual bool Read(istream& str); virtual bool Read(istream& str);
#if wxUSE_STREAM
virtual bool Read(wxInputStream& str); virtual bool Read(wxInputStream& str);
virtual bool Read(wxString& str); virtual bool Write(wxOutputStream &str) const;
#endif // wxUSE_STREAM
virtual wxString GetType() const { return "double"; }; virtual wxString GetType() const { return "double"; };
protected: protected:
@@ -419,12 +428,6 @@ bool wxVariantDataReal::Write(ostream& str) const
return TRUE; return TRUE;
} }
bool wxVariantDataReal::Write(wxOutputStream& str) const
{
str << m_value;
return TRUE;
}
bool wxVariantDataReal::Write(wxString& str) const bool wxVariantDataReal::Write(wxString& str) const
{ {
str.Printf("%.4f", m_value); str.Printf("%.4f", m_value);
@@ -437,11 +440,19 @@ bool wxVariantDataReal::Read(istream& str)
return TRUE; return TRUE;
} }
#if wxUSE_STREAM
bool wxVariantDataReal::Write(wxOutputStream& str) const
{
str << m_value;
return TRUE;
}
bool wxVariantDataReal::Read(wxInputStream& str) bool wxVariantDataReal::Read(wxInputStream& str)
{ {
str >> (float&)m_value; str >> (float&)m_value;
return TRUE; return TRUE;
} }
#endif // wxUSE_STREAM
bool wxVariantDataReal::Read(wxString& str) bool wxVariantDataReal::Read(wxString& str)
{ {
@@ -466,11 +477,13 @@ public:
virtual void Copy(wxVariantData& data); virtual void Copy(wxVariantData& data);
virtual bool Eq(wxVariantData& data) const; virtual bool Eq(wxVariantData& data) const;
virtual bool Write(ostream& str) const; virtual bool Write(ostream& str) const;
virtual bool Write(wxOutputStream& str) const;
virtual bool Write(wxString& str) const; virtual bool Write(wxString& str) const;
virtual bool Read(istream& str);
virtual bool Read(wxInputStream& str);
virtual bool Read(wxString& str); virtual bool Read(wxString& str);
virtual bool Read(istream& str);
#if wxUSE_STREAM
virtual bool Read(wxInputStream& str);
virtual bool Write(wxOutputStream& str) const;
#endif // wxUSE_STREAM
virtual wxString GetType() const { return "bool"; }; virtual wxString GetType() const { return "bool"; };
protected: protected:
@@ -505,12 +518,6 @@ bool wxVariantDataBool::Write(ostream& str) const
return TRUE; return TRUE;
} }
bool wxVariantDataBool::Write(wxOutputStream& str) const
{
str << (char)m_value;
return TRUE;
}
bool wxVariantDataBool::Write(wxString& str) const bool wxVariantDataBool::Write(wxString& str) const
{ {
str.Printf("%d", (int) m_value); str.Printf("%d", (int) m_value);
@@ -524,11 +531,19 @@ bool wxVariantDataBool::Read(istream& WXUNUSED(str))
return FALSE; return FALSE;
} }
#if wxUSE_STREAM
bool wxVariantDataBool::Write(wxOutputStream& str) const
{
str << (char)m_value;
return TRUE;
}
bool wxVariantDataBool::Read(wxInputStream& str) bool wxVariantDataBool::Read(wxInputStream& str)
{ {
str >> (char&)m_value; str >> (char&)m_value;
return TRUE; return TRUE;
} }
#endif // wxUSE_STREAM
bool wxVariantDataBool::Read(wxString& str) bool wxVariantDataBool::Read(wxString& str)
{ {
@@ -552,12 +567,14 @@ public:
virtual void Copy(wxVariantData& data); virtual void Copy(wxVariantData& data);
virtual bool Eq(wxVariantData& data) const; virtual bool Eq(wxVariantData& data) const;
virtual bool Write(ostream& str) const;
virtual bool Write(wxOutputStream& str) const;
virtual bool Write(wxString& str) const;
virtual bool Read(istream& str); virtual bool Read(istream& str);
virtual bool Read(wxInputStream& str); virtual bool Write(ostream& str) const;
virtual bool Read(wxString& str); virtual bool Read(wxString& str);
virtual bool Write(wxString& str) const;
#if wxUSE_STREAM
virtual bool Read(wxInputStream& str);
virtual bool Write(wxOutputStream& str) const;
#endif // wxUSE_STREAM
virtual wxString GetType() const { return "char"; }; virtual wxString GetType() const { return "char"; };
protected: protected:
@@ -592,12 +609,6 @@ bool wxVariantDataChar::Write(ostream& str) const
return TRUE; return TRUE;
} }
bool wxVariantDataChar::Write(wxOutputStream& str) const
{
str << m_value;
return TRUE;
}
bool wxVariantDataChar::Write(wxString& str) const bool wxVariantDataChar::Write(wxString& str) const
{ {
str.Printf("%c", m_value); str.Printf("%c", m_value);
@@ -611,11 +622,19 @@ bool wxVariantDataChar::Read(istream& WXUNUSED(str))
return FALSE; return FALSE;
} }
#if wxUSE_STREAM
bool wxVariantDataChar::Write(wxOutputStream& str) const
{
str << m_value;
return TRUE;
}
bool wxVariantDataChar::Read(wxInputStream& str) bool wxVariantDataChar::Read(wxInputStream& str)
{ {
str >> m_value; str >> m_value;
return TRUE; return TRUE;
} }
#endif // wxUSE_STREAM
bool wxVariantDataChar::Read(wxString& str) bool wxVariantDataChar::Read(wxString& str)
{ {
@@ -649,11 +668,13 @@ public:
virtual void Copy(wxVariantData& data); virtual void Copy(wxVariantData& data);
virtual bool Eq(wxVariantData& data) const; virtual bool Eq(wxVariantData& data) const;
virtual bool Write(ostream& str) const; virtual bool Write(ostream& str) const;
virtual bool Write(wxOutputStream& str) const; virtual bool Read(wxString& str);
virtual bool Write(wxString& str) const; virtual bool Write(wxString& str) const;
virtual bool Read(istream& str); virtual bool Read(istream& str);
#if wxUSE_STREAM
virtual bool Read(wxInputStream& str); virtual bool Read(wxInputStream& str);
virtual bool Read(wxString& str); virtual bool Write(wxOutputStream& str) const;
#endif // wxUSE_STREAM
virtual wxString GetType() const { return "string"; }; virtual wxString GetType() const { return "string"; };
protected: protected:
@@ -684,12 +705,6 @@ bool wxVariantDataString::Write(ostream& str) const
return TRUE; return TRUE;
} }
bool wxVariantDataString::Write(wxOutputStream& str) const
{
str << (const char*) m_value;
return TRUE;
}
bool wxVariantDataString::Write(wxString& str) const bool wxVariantDataString::Write(wxString& str) const
{ {
str = m_value; str = m_value;
@@ -702,11 +717,19 @@ bool wxVariantDataString::Read(istream& str)
return TRUE; return TRUE;
} }
#if wxUSE_STREAM
bool wxVariantDataString::Write(wxOutputStream& str) const
{
str << (const char*) m_value;
return TRUE;
}
bool wxVariantDataString::Read(wxInputStream& str) bool wxVariantDataString::Read(wxInputStream& str)
{ {
str >> m_value; str >> m_value;
return TRUE; return TRUE;
} }
#endif // wxUSE_STREAM
bool wxVariantDataString::Read(wxString& str) bool wxVariantDataString::Read(wxString& str)
{ {

View File

@@ -84,7 +84,10 @@ bool wxFrame::m_useNativeStatusBar = FALSE;
wxFrame::wxFrame() wxFrame::wxFrame()
{ {
#if wxUSE_TOOLBAR
m_frameToolBar = NULL ; m_frameToolBar = NULL ;
#endif // wxUSE_TOOLBAR
m_frameMenuBar = NULL; m_frameMenuBar = NULL;
m_frameStatusBar = NULL; m_frameStatusBar = NULL;
@@ -115,7 +118,9 @@ bool wxFrame::Create(wxWindow *parent,
m_windowStyle = style; m_windowStyle = style;
m_frameMenuBar = NULL; m_frameMenuBar = NULL;
#if wxUSE_TOOLBAR
m_frameToolBar = NULL ; m_frameToolBar = NULL ;
#endif // wxUSE_TOOLBAR
m_frameStatusBar = NULL; m_frameStatusBar = NULL;
//// Motif-specific //// Motif-specific
@@ -363,6 +368,7 @@ void wxFrame::GetClientSize(int *x, int *y) const
m_frameStatusBar->GetSize(& sbw, & sbh); m_frameStatusBar->GetSize(& sbw, & sbh);
yy -= sbh; yy -= sbh;
} }
#if wxUSE_TOOLBAR
if (m_frameToolBar) if (m_frameToolBar)
{ {
int tbw, tbh; int tbw, tbh;
@@ -372,6 +378,7 @@ void wxFrame::GetClientSize(int *x, int *y) const
else else
yy -= tbh; yy -= tbh;
} }
#endif // wxUSE_TOOLBAR
/* /*
if (GetMenuBar() != (wxMenuBar*) NULL) if (GetMenuBar() != (wxMenuBar*) NULL)
{ {
@@ -415,6 +422,7 @@ void wxFrame::SetClientSize(int width, int height)
m_frameStatusBar->GetSize(& sbw, & sbh); m_frameStatusBar->GetSize(& sbw, & sbh);
height += sbh; height += sbh;
} }
#if wxUSE_TOOLBAR
if (m_frameToolBar) if (m_frameToolBar)
{ {
int tbw, tbh; int tbw, tbh;
@@ -424,6 +432,7 @@ void wxFrame::SetClientSize(int width, int height)
else else
height += tbh; height += tbh;
} }
#endif // wxUSE_TOOLBAR
XtVaSetValues((Widget) m_workArea, XmNheight, height, NULL); XtVaSetValues((Widget) m_workArea, XmNheight, height, NULL);
} }
@@ -732,8 +741,11 @@ void wxFrame::OnSize(wxSizeEvent& event)
wxWindow *win = (wxWindow *)node->Data(); wxWindow *win = (wxWindow *)node->Data();
if ( !win->IsKindOf(CLASSINFO(wxFrame)) && if ( !win->IsKindOf(CLASSINFO(wxFrame)) &&
!win->IsKindOf(CLASSINFO(wxDialog)) && !win->IsKindOf(CLASSINFO(wxDialog)) &&
(win != GetStatusBar()) && (win != GetStatusBar())
(win != GetToolBar()) ) #if wxUSE_TOOLBAR
&& (win != GetToolBar())
#endif // wxUSE_TOOLBAR
)
{ {
if ( child ) if ( child )
return; // it's our second subwindow - nothing to do return; // it's our second subwindow - nothing to do
@@ -867,6 +879,7 @@ void wxFrame::ProcessCommand(int id)
wxPoint wxFrame::GetClientAreaOrigin() const wxPoint wxFrame::GetClientAreaOrigin() const
{ {
wxPoint pt(0, 0); wxPoint pt(0, 0);
#if wxUSE_TOOLBAR
if (GetToolBar()) if (GetToolBar())
{ {
int w, h; int w, h;
@@ -881,6 +894,8 @@ wxPoint wxFrame::GetClientAreaOrigin() const
pt.y += h; pt.y += h;
} }
} }
#endif // wxUSE_TOOLBAR
return pt; return pt;
} }
@@ -908,6 +923,7 @@ void wxFrame::ClientToScreen(int *x, int *y) const
wxWindow::ClientToScreen(x, y); wxWindow::ClientToScreen(x, y);
} }
#if wxUSE_TOOLBAR
wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name) wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
{ {
wxCHECK_MSG( m_frameToolBar == NULL, FALSE, wxCHECK_MSG( m_frameToolBar == NULL, FALSE,
@@ -931,6 +947,16 @@ wxToolBar* wxFrame::OnCreateToolBar(long style, wxWindowID id, const wxString& n
return new wxToolBar(this, id, wxPoint(0, 0), wxSize(100, 24), style, name); return new wxToolBar(this, id, wxPoint(0, 0), wxSize(100, 24), style, name);
} }
void wxFrame::SetToolBar(wxToolBar *toolbar)
{
m_frameToolBar = toolbar;
}
wxToolBar *wxFrame::GetToolBar() const
{
return m_frameToolBar;
}
void wxFrame::PositionToolBar() void wxFrame::PositionToolBar()
{ {
int cw, ch; int cw, ch;
@@ -956,6 +982,7 @@ void wxFrame::PositionToolBar()
} }
} }
} }
#endif // wxUSE_TOOLBAR
void wxFrame::CaptureMouse() void wxFrame::CaptureMouse()
{ {
@@ -1011,12 +1038,6 @@ void wxFrame::Lower(void)
XLowerWindow(XtDisplay((Widget) m_frameShell), parent_window); XLowerWindow(XtDisplay((Widget) m_frameShell), parent_window);
} }
void wxFrame::SetToolBar(wxToolBar *toolbar)
{ m_frameToolBar = toolbar; }
wxToolBar *wxFrame::GetToolBar() const
{ return m_frameToolBar; }
void wxFrameFocusProc(Widget workArea, XtPointer clientData, void wxFrameFocusProc(Widget workArea, XtPointer clientData,
XmAnyCallbackStruct *cbs) XmAnyCallbackStruct *cbs)
{ {
@@ -1055,7 +1076,9 @@ static void wxFrameMapProc(Widget frameShell, XtPointer clientData,
//// Motif-specific //// Motif-specific
bool wxFrame::PreResize() bool wxFrame::PreResize()
{ {
#if wxUSE_TOOLBAR
PositionToolBar(); PositionToolBar();
#endif // wxUSE_TOOLBAR
PositionStatusBar(); PositionStatusBar();
return TRUE; return TRUE;
} }

View File

@@ -16,7 +16,7 @@
#include "wx/wx.h" #include "wx/wx.h"
#include "wx/app.h" #include "wx/app.h"
#include "wx/timer.h" #include "wx/timer.h"
#include "wx/motif/toolbar.h" #include "wx/toolbar.h"
#include <Xm/Xm.h> #include <Xm/Xm.h>
#include <Xm/PushBG.h> #include <Xm/PushBG.h>
@@ -605,7 +605,8 @@ wxToolBarTool *wxToolBar::AddTool(int index, const wxBitmap& bitmap, const wxBit
else else
tool->m_y = m_yMargin; tool->m_y = m_yMargin;
tool->SetSize(GetDefaultButtonWidth(), GetDefaultButtonHeight()); wxSize& size = GetToolSize();
tool->SetSize(size.x, size.y);
m_tools.Append((long)index, tool); m_tools.Append((long)index, tool);
return tool; return tool;