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
const wxString& name);
// Create toolbar
const wxString& name);
// Create toolbar
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);
// If made known to the frame, the frame will manage it automatically.
virtual void SetToolBar(wxToolBar *toolbar) ;
virtual wxToolBar *GetToolBar() const ;
virtual void PositionToolBar();
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);
// If made known to the frame, the frame will manage it automatically.
virtual void SetToolBar(wxToolBar *toolbar) ;
virtual wxToolBar *GetToolBar() const ;
virtual void PositionToolBar();
// Set status line text
virtual void SetStatusText(const wxString& text, int number = 0);
// Set status line text
virtual void SetStatusText(const wxString& text, int number = 0);
wxIcon m_icon;
bool m_iconized;
static bool m_useNativeStatusBar;
wxIcon m_icon;
bool m_iconized;
static bool m_useNativeStatusBar;
wxToolBar * m_frameToolBar ;
wxToolBar * m_frameToolBar ;
LoadFile( name, type );
}
LoadFile( name, type );
}
wxImage::wxImage( wxInputStream& stream, long type )
{
LoadFile( stream, type );
}
wxImage::wxImage( wxInputStream& stream, long type )
{
LoadFile( stream, type );
}
wxImage::wxImage( const wxImage& image )
{
wxImage::wxImage( const wxImage& image )
{
bool wxImage::LoadFile( const wxString& filename, long type )
{
bool wxImage::LoadFile( const wxString& filename, long type )
{
if (wxFileExists(filename))
{
wxFileInputStream stream(filename);
if (wxFileExists(filename))
{
wxFileInputStream stream(filename);
- wxLogWarning( "Image file does not exist." );
+ wxLogError( "Can't load image from file '%s': file does not exist.", filename.c_str() );
+#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;
bool wxImage::LoadFile( wxInputStream& stream, long type )
{
UnRef();
bool wxImage::LoadFile( wxInputStream& stream, long type )
{
UnRef();
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 )
{
wxCHECK_MSG( Ok(), FALSE, "invalid image" );
bool wxImage::SaveFile( wxOutputStream& stream, int type )
{
wxCHECK_MSG( Ok(), FALSE, "invalid image" );
return handler->SaveFile( this, stream );
}
return handler->SaveFile( this, stream );
}
void wxImage::AddHandler( wxImageHandler *handler )
{
void wxImage::AddHandler( wxImageHandler *handler )
{
IMPLEMENT_DYNAMIC_CLASS(wxImageHandler,wxObject)
#endif
IMPLEMENT_DYNAMIC_CLASS(wxImageHandler,wxObject)
#endif
bool wxImageHandler::LoadFile( wxImage *WXUNUSED(image), wxInputStream& WXUNUSED(stream) )
{
return FALSE;
bool wxImageHandler::LoadFile( wxImage *WXUNUSED(image), wxInputStream& WXUNUSED(stream) )
{
return FALSE;
//-----------------------------------------------------------------------------
// wxPNGHandler
//-----------------------------------------------------------------------------
// wxPNGHandler
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);
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);
IMPLEMENT_DYNAMIC_CLASS(wxBMPHandler,wxImageHandler)
#endif
IMPLEMENT_DYNAMIC_CLASS(wxBMPHandler,wxImageHandler)
#endif
bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream )
{
unsigned char *data, *ptr;
bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream )
{
unsigned char *data, *ptr;
// -------------------------
int nLines = m_pTextCtrl->GetNumberOfLines();
for ( int nLine = 0; bOk && nLine < nLines; nLine++ ) {
// -------------------------
int nLines = m_pTextCtrl->GetNumberOfLines();
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
+ );
#ifndef WX_PRECOMP
#include "wx/hash.h"
#ifndef WX_PRECOMP
#include "wx/hash.h"
#include "wx/objstrm.h"
#include "wx/serbase.h"
#include "wx/objstrm.h"
#include "wx/serbase.h"
wxObject::wxObject(void)
{
m_refData = (wxObjectRefData *) NULL;
wxObject::wxObject(void)
{
m_refData = (wxObjectRefData *) NULL;
m_serialObj = (wxObject_Serialize *)NULL;
#endif
}
m_serialObj = (wxObject_Serialize *)NULL;
#endif
}
wxObject::~wxObject(void)
{
UnRef();
wxObject::~wxObject(void)
{
UnRef();
if (m_serialObj)
delete m_serialObj;
#endif
if (m_serialObj)
delete m_serialObj;
#endif
return (wxObject*) NULL;
}
return (wxObject*) NULL;
}
#include "wx/serbase.h"
#include "wx/dynlib.h"
#include "wx/serbase.h"
#include "wx/dynlib.h"
virtual void Copy(wxVariantData& data);
virtual bool Eq(wxVariantData& data) const;
virtual void Copy(wxVariantData& data);
virtual bool Eq(wxVariantData& data) const;
- virtual bool Write(ostream& str) const;
+
+ virtual bool Read(wxString& str);
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);
+ virtual bool Write(ostream& str) const;
+
+#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 "long"; };
protected:
virtual wxString GetType() const { return "long"; };
protected:
-bool wxVariantDataLong::Write(wxOutputStream& str) const
-{
- str << m_value;
- return TRUE;
-}
-
bool wxVariantDataLong::Write(wxString& str) const
{
str.Printf("%ld", m_value);
bool wxVariantDataLong::Write(wxString& str) const
{
str.Printf("%ld", m_value);
+#if wxUSE_STREAM
+bool wxVariantDataLong::Write(wxOutputStream& str) const
+{
+ str << m_value;
+ return TRUE;
+}
+
bool wxVariantDataLong::Read(wxInputStream& str)
{
str >> m_value;
return TRUE;
}
bool wxVariantDataLong::Read(wxInputStream& str)
{
str >> m_value;
return TRUE;
}
bool wxVariantDataLong::Read(wxString& str)
{
bool wxVariantDataLong::Read(wxString& str)
{
virtual void Copy(wxVariantData& data);
virtual bool Eq(wxVariantData& data) const;
virtual void Copy(wxVariantData& data);
virtual bool Eq(wxVariantData& data) const;
+ virtual bool Read(wxString& str);
virtual bool Write(ostream& str) const;
virtual bool Write(wxString& str) 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(istream& str);
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"; };
protected:
virtual wxString GetType() const { return "double"; };
protected:
-bool wxVariantDataReal::Write(wxOutputStream& str) const
-{
- str << m_value;
- return TRUE;
-}
-
bool wxVariantDataReal::Write(wxString& str) const
{
str.Printf("%.4f", m_value);
bool wxVariantDataReal::Write(wxString& str) const
{
str.Printf("%.4f", m_value);
+#if wxUSE_STREAM
+bool wxVariantDataReal::Write(wxOutputStream& str) const
+{
+ str << m_value;
+ return TRUE;
+}
+
bool wxVariantDataReal::Read(wxInputStream& str)
{
str >> (float&)m_value;
return TRUE;
}
bool wxVariantDataReal::Read(wxInputStream& str)
{
str >> (float&)m_value;
return TRUE;
}
bool wxVariantDataReal::Read(wxString& str)
{
bool wxVariantDataReal::Read(wxString& str)
{
virtual void Copy(wxVariantData& data);
virtual bool Eq(wxVariantData& data) const;
virtual bool Write(ostream& str) const;
virtual void Copy(wxVariantData& data);
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 Write(wxString& str) const;
+ virtual bool Read(wxString& str);
virtual bool Read(istream& str);
virtual bool Read(istream& str);
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 "bool"; };
protected:
virtual wxString GetType() const { return "bool"; };
protected:
-bool wxVariantDataBool::Write(wxOutputStream& str) const
-{
- str << (char)m_value;
- return TRUE;
-}
-
bool wxVariantDataBool::Write(wxString& str) const
{
str.Printf("%d", (int) m_value);
bool wxVariantDataBool::Write(wxString& str) const
{
str.Printf("%d", (int) m_value);
+#if wxUSE_STREAM
+bool wxVariantDataBool::Write(wxOutputStream& str) const
+{
+ str << (char)m_value;
+ return TRUE;
+}
+
bool wxVariantDataBool::Read(wxInputStream& str)
{
str >> (char&)m_value;
return TRUE;
}
bool wxVariantDataBool::Read(wxInputStream& str)
{
str >> (char&)m_value;
return TRUE;
}
bool wxVariantDataBool::Read(wxString& str)
{
bool wxVariantDataBool::Read(wxString& str)
{
virtual void Copy(wxVariantData& data);
virtual bool Eq(wxVariantData& data) const;
virtual void Copy(wxVariantData& data);
virtual bool Eq(wxVariantData& data) const;
+ virtual bool Read(istream& str);
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(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 "char"; };
protected:
virtual wxString GetType() const { return "char"; };
protected:
-bool wxVariantDataChar::Write(wxOutputStream& str) const
-{
- str << m_value;
- return TRUE;
-}
-
bool wxVariantDataChar::Write(wxString& str) const
{
str.Printf("%c", m_value);
bool wxVariantDataChar::Write(wxString& str) const
{
str.Printf("%c", m_value);
+#if wxUSE_STREAM
+bool wxVariantDataChar::Write(wxOutputStream& str) const
+{
+ str << m_value;
+ return TRUE;
+}
+
bool wxVariantDataChar::Read(wxInputStream& str)
{
str >> m_value;
return TRUE;
}
bool wxVariantDataChar::Read(wxInputStream& str)
{
str >> m_value;
return TRUE;
}
bool wxVariantDataChar::Read(wxString& str)
{
bool wxVariantDataChar::Read(wxString& str)
{
virtual void Copy(wxVariantData& data);
virtual bool Eq(wxVariantData& data) const;
virtual bool Write(ostream& str) const;
virtual void Copy(wxVariantData& data);
virtual bool Eq(wxVariantData& data) 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 Read(istream& str);
virtual bool Write(wxString& str) const;
virtual bool Read(istream& str);
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"; };
protected:
virtual wxString GetType() const { return "string"; };
protected:
-bool wxVariantDataString::Write(wxOutputStream& str) const
-{
- str << (const char*) m_value;
- return TRUE;
-}
-
bool wxVariantDataString::Write(wxString& str) const
{
str = m_value;
bool wxVariantDataString::Write(wxString& str) const
{
str = m_value;
+#if wxUSE_STREAM
+bool wxVariantDataString::Write(wxOutputStream& str) const
+{
+ str << (const char*) m_value;
+ return TRUE;
+}
+
bool wxVariantDataString::Read(wxInputStream& str)
{
str >> m_value;
return TRUE;
}
bool wxVariantDataString::Read(wxInputStream& str)
{
str >> m_value;
return TRUE;
}
bool wxVariantDataString::Read(wxString& str)
{
bool wxVariantDataString::Read(wxString& str)
{
+#endif // wxUSE_TOOLBAR
+
m_frameMenuBar = NULL;
m_frameStatusBar = NULL;
m_frameMenuBar = NULL;
m_frameStatusBar = NULL;
m_windowStyle = style;
m_frameMenuBar = NULL;
m_windowStyle = style;
m_frameMenuBar = NULL;
m_frameStatusBar = NULL;
//// Motif-specific
m_frameStatusBar = NULL;
//// Motif-specific
m_frameStatusBar->GetSize(& sbw, & sbh);
yy -= sbh;
}
m_frameStatusBar->GetSize(& sbw, & sbh);
yy -= sbh;
}
if (m_frameToolBar)
{
int tbw, tbh;
if (m_frameToolBar)
{
int tbw, tbh;
/*
if (GetMenuBar() != (wxMenuBar*) NULL)
{
/*
if (GetMenuBar() != (wxMenuBar*) NULL)
{
m_frameStatusBar->GetSize(& sbw, & sbh);
height += sbh;
}
m_frameStatusBar->GetSize(& sbw, & sbh);
height += sbh;
}
if (m_frameToolBar)
{
int tbw, tbh;
if (m_frameToolBar)
{
int tbw, tbh;
XtVaSetValues((Widget) m_workArea, XmNheight, height, NULL);
}
XtVaSetValues((Widget) m_workArea, XmNheight, height, NULL);
}
wxWindow *win = (wxWindow *)node->Data();
if ( !win->IsKindOf(CLASSINFO(wxFrame)) &&
!win->IsKindOf(CLASSINFO(wxDialog)) &&
wxWindow *win = (wxWindow *)node->Data();
if ( !win->IsKindOf(CLASSINFO(wxFrame)) &&
!win->IsKindOf(CLASSINFO(wxDialog)) &&
- (win != GetStatusBar()) &&
- (win != GetToolBar()) )
+ (win != GetStatusBar())
+#if wxUSE_TOOLBAR
+ && (win != GetToolBar())
+#endif // wxUSE_TOOLBAR
+ )
{
if ( child )
return; // it's our second subwindow - nothing to do
{
if ( child )
return; // it's our second subwindow - nothing to do
wxPoint wxFrame::GetClientAreaOrigin() const
{
wxPoint pt(0, 0);
wxPoint wxFrame::GetClientAreaOrigin() const
{
wxPoint pt(0, 0);
if (GetToolBar())
{
int w, h;
if (GetToolBar())
{
int w, h;
+#endif // wxUSE_TOOLBAR
+
wxWindow::ClientToScreen(x, y);
}
wxWindow::ClientToScreen(x, y);
}
wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
{
wxCHECK_MSG( m_frameToolBar == NULL, FALSE,
wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
{
wxCHECK_MSG( m_frameToolBar == NULL, FALSE,
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()
{
int cw, ch;
void wxFrame::PositionToolBar()
{
int cw, ch;
void wxFrame::CaptureMouse()
{
void wxFrame::CaptureMouse()
{
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,
XmAnyCallbackStruct *cbs)
{
void wxFrameFocusProc(Widget workArea, XtPointer clientData,
XmAnyCallbackStruct *cbs)
{
//// Motif-specific
bool wxFrame::PreResize()
{
//// Motif-specific
bool wxFrame::PreResize()
{
PositionStatusBar();
return TRUE;
}
PositionStatusBar();
return TRUE;
}
#include "wx/wx.h"
#include "wx/app.h"
#include "wx/timer.h"
#include "wx/wx.h"
#include "wx/app.h"
#include "wx/timer.h"
-#include "wx/motif/toolbar.h"
#include <Xm/Xm.h>
#include <Xm/PushBG.h>
#include <Xm/Xm.h>
#include <Xm/PushBG.h>
else
tool->m_y = m_yMargin;
else
tool->m_y = m_yMargin;
- tool->SetSize(GetDefaultButtonWidth(), GetDefaultButtonHeight());
+ wxSize& size = GetToolSize();
+ tool->SetSize(size.x, size.y);
m_tools.Append((long)index, tool);
return tool;
m_tools.Append((long)index, tool);
return tool;