const wxString& name);
// Create toolbar
+#if wxUSE_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();
+#endif // wxUSE_TOOLBAR
// Set status line text
virtual void SetStatusText(const wxString& text, int number = 0);
wxIcon m_icon;
bool m_iconized;
static bool m_useNativeStatusBar;
+
+#if wxUSE_TOOLBAR
wxToolBar * m_frameToolBar ;
+#endif // wxUSE_TOOLBAR
//// Motif-specific
LoadFile( name, type );
}
+#if wxUSE_STREAM
wxImage::wxImage( wxInputStream& stream, long type )
{
LoadFile( stream, type );
}
+#endif // wxUSE_STREAM
wxImage::wxImage( const wxImage& image )
{
bool wxImage::LoadFile( const wxString& filename, long type )
{
+#if wxUSE_STREAM
if (wxFileExists(filename))
{
wxFileInputStream stream(filename);
}
else {
- wxLogWarning( "Image file does not exist." );
+ wxLogError( "Can't load image from file '%s': file does not exist.", filename.c_str() );
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 )
{
UnRef();
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" );
return handler->SaveFile( this, stream );
}
+#endif // wxUSE_STREAM
void wxImage::AddHandler( wxImageHandler *handler )
{
IMPLEMENT_DYNAMIC_CLASS(wxImageHandler,wxObject)
#endif
+#if wxUSE_STREAM
bool wxImageHandler::LoadFile( wxImage *WXUNUSED(image), wxInputStream& WXUNUSED(stream) )
{
return FALSE;
{
return FALSE;
}
+#endif // wxUSE_STREAM
//-----------------------------------------------------------------------------
// wxPNGHandler
#endif
+#if wxUSE_STREAM
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);
}
return TRUE;
}
+#endif // wxUSE_STREAM
#endif
IMPLEMENT_DYNAMIC_CLASS(wxBMPHandler,wxImageHandler)
#endif
+#if wxUSE_STREAM
bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream )
{
unsigned char *data, *ptr;
return TRUE;
}
+#endif // wxUSE_STREAM
#ifdef __WXMSW__
// -------------------------
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
+ );
}
if ( bOk )
#ifndef WX_PRECOMP
#include "wx/hash.h"
- #ifdef wxUSE_SERIAL
+ #if wxUSE_SERIAL
#include "wx/objstrm.h"
#include "wx/serbase.h"
wxObject::wxObject(void)
{
m_refData = (wxObjectRefData *) NULL;
-#ifdef wxUSE_SERIAL
+#if wxUSE_SERIAL
m_serialObj = (wxObject_Serialize *)NULL;
#endif
}
wxObject::~wxObject(void)
{
UnRef();
-#ifdef wxUSE_SERIAL
+#if wxUSE_SERIAL
if (m_serialObj)
delete m_serialObj;
#endif
return (wxObject*) NULL;
}
-#ifdef wxUSE_SERIAL
+#if wxUSE_SERIAL
#include "wx/serbase.h"
#include "wx/dynlib.h"
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(wxOutputStream &str) const;
virtual bool Read(istream& str);
+ virtual bool Write(ostream& str) const;
+
+#if wxUSE_STREAM
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:
return TRUE;
}
-bool wxVariantDataLong::Write(wxOutputStream& str) const
-{
- str << m_value;
- return TRUE;
-}
-
bool wxVariantDataLong::Write(wxString& str) const
{
str.Printf("%ld", m_value);
return TRUE;
}
+#if wxUSE_STREAM
+bool wxVariantDataLong::Write(wxOutputStream& str) const
+{
+ str << m_value;
+ return TRUE;
+}
+
bool wxVariantDataLong::Read(wxInputStream& str)
{
str >> m_value;
return TRUE;
}
+#endif // wxUSE_STREAM
bool wxVariantDataLong::Read(wxString& str)
{
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(wxOutputStream &str) const;
virtual bool Read(istream& str);
+#if wxUSE_STREAM
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:
return TRUE;
}
-bool wxVariantDataReal::Write(wxOutputStream& str) const
-{
- str << m_value;
- return TRUE;
-}
-
bool wxVariantDataReal::Write(wxString& str) const
{
str.Printf("%.4f", m_value);
return TRUE;
}
+#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;
}
+#endif // wxUSE_STREAM
bool wxVariantDataReal::Read(wxString& str)
{
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 Read(wxString& str);
virtual bool Read(istream& str);
+#if wxUSE_STREAM
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:
return TRUE;
}
-bool wxVariantDataBool::Write(wxOutputStream& str) const
-{
- str << (char)m_value;
- return TRUE;
-}
-
bool wxVariantDataBool::Write(wxString& str) const
{
str.Printf("%d", (int) m_value);
return FALSE;
}
+#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;
}
+#endif // wxUSE_STREAM
bool wxVariantDataBool::Read(wxString& str)
{
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(wxOutputStream& str) const;
+ virtual bool Read(wxString& str);
virtual bool Write(wxString& str) const;
- virtual bool Read(istream& str);
+#if wxUSE_STREAM
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:
return TRUE;
}
-bool wxVariantDataChar::Write(wxOutputStream& str) const
-{
- str << m_value;
- return TRUE;
-}
-
bool wxVariantDataChar::Write(wxString& str) const
{
str.Printf("%c", m_value);
return FALSE;
}
+#if wxUSE_STREAM
+bool wxVariantDataChar::Write(wxOutputStream& str) const
+{
+ str << m_value;
+ return TRUE;
+}
+
bool wxVariantDataChar::Read(wxInputStream& str)
{
str >> m_value;
return TRUE;
}
+#endif // wxUSE_STREAM
bool wxVariantDataChar::Read(wxString& str)
{
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);
+#if wxUSE_STREAM
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:
return TRUE;
}
-bool wxVariantDataString::Write(wxOutputStream& str) const
-{
- str << (const char*) m_value;
- return TRUE;
-}
-
bool wxVariantDataString::Write(wxString& str) const
{
str = m_value;
return TRUE;
}
+#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;
}
+#endif // wxUSE_STREAM
bool wxVariantDataString::Read(wxString& str)
{
wxFrame::wxFrame()
{
+#if wxUSE_TOOLBAR
m_frameToolBar = NULL ;
+#endif // wxUSE_TOOLBAR
+
m_frameMenuBar = NULL;
m_frameStatusBar = NULL;
m_windowStyle = style;
m_frameMenuBar = NULL;
+#if wxUSE_TOOLBAR
m_frameToolBar = NULL ;
+#endif // wxUSE_TOOLBAR
m_frameStatusBar = NULL;
//// Motif-specific
m_frameStatusBar->GetSize(& sbw, & sbh);
yy -= sbh;
}
+#if wxUSE_TOOLBAR
if (m_frameToolBar)
{
int tbw, tbh;
else
yy -= tbh;
}
+#endif // wxUSE_TOOLBAR
/*
if (GetMenuBar() != (wxMenuBar*) NULL)
{
m_frameStatusBar->GetSize(& sbw, & sbh);
height += sbh;
}
+#if wxUSE_TOOLBAR
if (m_frameToolBar)
{
int tbw, tbh;
else
height += tbh;
}
+#endif // wxUSE_TOOLBAR
XtVaSetValues((Widget) m_workArea, XmNheight, height, NULL);
}
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
wxPoint wxFrame::GetClientAreaOrigin() const
{
wxPoint pt(0, 0);
+#if wxUSE_TOOLBAR
if (GetToolBar())
{
int w, h;
pt.y += h;
}
}
+#endif // wxUSE_TOOLBAR
+
return pt;
}
wxWindow::ClientToScreen(x, y);
}
+#if wxUSE_TOOLBAR
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);
}
+void wxFrame::SetToolBar(wxToolBar *toolbar)
+{
+ m_frameToolBar = toolbar;
+}
+
+wxToolBar *wxFrame::GetToolBar() const
+{
+ return m_frameToolBar;
+}
+
void wxFrame::PositionToolBar()
{
int cw, ch;
}
}
}
+#endif // wxUSE_TOOLBAR
void wxFrame::CaptureMouse()
{
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)
{
//// Motif-specific
bool wxFrame::PreResize()
{
+#if wxUSE_TOOLBAR
PositionToolBar();
+#endif // wxUSE_TOOLBAR
PositionStatusBar();
return TRUE;
}
#include "wx/wx.h"
#include "wx/app.h"
#include "wx/timer.h"
-#include "wx/motif/toolbar.h"
+#include "wx/toolbar.h"
#include <Xm/Xm.h>
#include <Xm/PushBG.h>
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;