#include "wx/filefn.h"
// ----------------------------------------------------------------------------
-<<<<<<< file.h
-=======
// constants
// ----------------------------------------------------------------------------
#define wxS_DEFAULT (wxS_IRUSR | wxS_IWUSR | wxS_IRGRP | wxS_IROTH)
// ----------------------------------------------------------------------------
->>>>>>> 1.7
// class wxFile: raw file IO
//
// NB: for space efficiency this class has no virtual functions, including
wxFile(int fd) { m_fd = fd; }
// open/close
-<<<<<<< file.h
- bool Create(const char *szFileName, bool bOverwrite = FALSE);
- bool Open(const char *szFileName, OpenMode mode = read);
- inline bool Close(); // Close is a NOP if not opened
-=======
// create a new file (with the default value of bOverwrite, it will fail if
// the file already exists, otherwise it will overwrite it and succeed)
bool Create(const char *szFileName, bool bOverwrite = FALSE,
bool Open(const char *szFileName, OpenMode mode = read,
int access = wxS_DEFAULT);
bool Close(); // Close is a NOP if not opened
->>>>>>> 1.7
// assign an existing file descriptor and get it back from wxFile object
void Attach(int fd) { Close(); m_fd = fd; }
virtual void SetBrush( const wxBrush &brush ) = 0;
virtual wxBrush *GetBrush(void) { return &m_brush; };
+ virtual void SetBackground( const wxBrush &brush ) = 0;
+ virtual wxBrush *GetBackground(void) { return &m_backgroundBrush; };
+
virtual void SetLogicalFunction( int function ) = 0;
virtual int GetLogicalFunction(void) { return m_logicalFunction; };
virtual void SetFont( const wxFont &font );
virtual void SetPen( const wxPen &pen );
virtual void SetBrush( const wxBrush &brush );
+ virtual void SetBackground( const wxBrush &brush );
virtual void SetLogicalFunction( int function );
virtual void SetTextForeground( const wxColour &col );
virtual void SetTextBackground( const wxColour &col );
// wxDropTarget
//-------------------------------------------------------------------------
-class wxDropTarget: wxObject
+class wxDropTarget: public wxObject
{
public:
#include "wx/window.h"
#include "wx/menu.h"
#include "wx/statusbr.h"
+#include "wx/toolbar.h"
//-----------------------------------------------------------------------------
// classes
class wxFrame: public wxWindow
{
+ DECLARE_DYNAMIC_CLASS(wxFrame)
public:
- // construction
+
wxFrame();
wxFrame( wxWindow *parent, wxWindowID id, const wxString &title,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
~wxFrame();
bool Destroy();
- // operations
- //
virtual bool Show( bool show );
virtual void Enable( bool enable );
- // frame size
virtual void GetClientSize( int *width, int *height ) const;
- // set minimal size for the frame (@@@ other params not implemented)
- void SetSizeHints(int minW, int minH,
- int maxW = -1, int maxH = -1,
- int incW = -1);
+
+ // set minimal/maxmimal size for the frame
+ virtual void SetSizeHints( int minW, int minH, int maxW, int maxH, int incW = -1 );
- // status bar
virtual bool CreateStatusBar( int number = 1 );
- wxStatusBar *GetStatusBar();
+ virtual wxStatusBar *GetStatusBar();
virtual void SetStatusText( const wxString &text, int number = 0 );
virtual void SetStatusWidths( int n, int *width );
- // menu bar
- void SetMenuBar( wxMenuBar *menuBar );
- wxMenuBar *GetMenuBar();
+ virtual wxToolBar *CreateToolBar( int style = 0,
+ int orientation = wxHORIZONTAL, int rowsOrColumns = 1 );
+ virtual wxToolBar *GetToolBar();
+
+ virtual void SetMenuBar( wxMenuBar *menuBar );
+ virtual wxMenuBar *GetMenuBar();
- // frame title
void SetTitle( const wxString &title );
wxString GetTitle() const { return m_title; }
- // implementation
- void OnActivate( wxActivateEvent &event ) { } // called from docview.cpp
+ void OnActivate( wxActivateEvent &WXUNUSED(event) ) { } // called from docview.cpp
void OnSize( wxSizeEvent &event );
void OnCloseWindow( wxCloseEvent& event );
void OnIdle(wxIdleEvent& event);
+ virtual void AddChild( wxWindow *child );
virtual void GtkOnSize( int x, int y, int width, int height );
private:
GtkWidget *m_mainWindow;
wxMenuBar *m_frameMenuBar;
wxStatusBar *m_frameStatusBar;
+ wxToolBar *m_frameToolBar;
+ int m_toolBarHeight;
bool m_doingOnSize;
+ bool m_addPrivateChild; // for toolbar (and maybe menubar)
wxString m_title;
- DECLARE_DYNAMIC_CLASS(wxFrame)
DECLARE_EVENT_TABLE()
};
void GetClientSize(int *width, int *height) const;
wxMDIChildFrame *GetActiveChild(void) const;
- virtual void SetToolBar( wxToolBar *toolbar );
- virtual wxWindow *GetToolBar(void) const;
-
wxMDIClientWindow *GetClientWindow(void) const;
virtual wxMDIClientWindow *OnCreateClient(void);
wxMDIClientWindow *m_clientWindow;
bool m_parentFrameActive;
wxMenuBar *m_mdiMenuBar;
- wxToolBar *m_toolBar;
DECLARE_EVENT_TABLE()
};
const wxString& helpString1 = "", const wxString& helpString2 = "");
virtual void AddSeparator(void);
virtual void ClearTools(void);
+
+ virtual void Layout(void);
virtual void EnableTool(int toolIndex, bool enable);
virtual void ToggleTool(int toolIndex, bool toggle); // toggle is TRUE if toggled on
virtual void SetBrush( const wxBrush &brush ) = 0;
virtual wxBrush *GetBrush(void) { return &m_brush; };
+ virtual void SetBackground( const wxBrush &brush ) = 0;
+ virtual wxBrush *GetBackground(void) { return &m_backgroundBrush; };
+
virtual void SetLogicalFunction( int function ) = 0;
virtual int GetLogicalFunction(void) { return m_logicalFunction; };
virtual void SetFont( const wxFont &font );
virtual void SetPen( const wxPen &pen );
virtual void SetBrush( const wxBrush &brush );
+ virtual void SetBackground( const wxBrush &brush );
virtual void SetLogicalFunction( int function );
virtual void SetTextForeground( const wxColour &col );
virtual void SetTextBackground( const wxColour &col );
// wxDropTarget
//-------------------------------------------------------------------------
-class wxDropTarget: wxObject
+class wxDropTarget: public wxObject
{
public:
#include "wx/window.h"
#include "wx/menu.h"
#include "wx/statusbr.h"
+#include "wx/toolbar.h"
//-----------------------------------------------------------------------------
// classes
class wxFrame: public wxWindow
{
+ DECLARE_DYNAMIC_CLASS(wxFrame)
public:
- // construction
+
wxFrame();
wxFrame( wxWindow *parent, wxWindowID id, const wxString &title,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
~wxFrame();
bool Destroy();
- // operations
- //
virtual bool Show( bool show );
virtual void Enable( bool enable );
- // frame size
virtual void GetClientSize( int *width, int *height ) const;
- // set minimal size for the frame (@@@ other params not implemented)
- void SetSizeHints(int minW, int minH,
- int maxW = -1, int maxH = -1,
- int incW = -1);
+
+ // set minimal/maxmimal size for the frame
+ virtual void SetSizeHints( int minW, int minH, int maxW, int maxH, int incW = -1 );
- // status bar
virtual bool CreateStatusBar( int number = 1 );
- wxStatusBar *GetStatusBar();
+ virtual wxStatusBar *GetStatusBar();
virtual void SetStatusText( const wxString &text, int number = 0 );
virtual void SetStatusWidths( int n, int *width );
- // menu bar
- void SetMenuBar( wxMenuBar *menuBar );
- wxMenuBar *GetMenuBar();
+ virtual wxToolBar *CreateToolBar( int style = 0,
+ int orientation = wxHORIZONTAL, int rowsOrColumns = 1 );
+ virtual wxToolBar *GetToolBar();
+
+ virtual void SetMenuBar( wxMenuBar *menuBar );
+ virtual wxMenuBar *GetMenuBar();
- // frame title
void SetTitle( const wxString &title );
wxString GetTitle() const { return m_title; }
- // implementation
- void OnActivate( wxActivateEvent &event ) { } // called from docview.cpp
+ void OnActivate( wxActivateEvent &WXUNUSED(event) ) { } // called from docview.cpp
void OnSize( wxSizeEvent &event );
void OnCloseWindow( wxCloseEvent& event );
void OnIdle(wxIdleEvent& event);
+ virtual void AddChild( wxWindow *child );
virtual void GtkOnSize( int x, int y, int width, int height );
private:
GtkWidget *m_mainWindow;
wxMenuBar *m_frameMenuBar;
wxStatusBar *m_frameStatusBar;
+ wxToolBar *m_frameToolBar;
+ int m_toolBarHeight;
bool m_doingOnSize;
+ bool m_addPrivateChild; // for toolbar (and maybe menubar)
wxString m_title;
- DECLARE_DYNAMIC_CLASS(wxFrame)
DECLARE_EVENT_TABLE()
};
void GetClientSize(int *width, int *height) const;
wxMDIChildFrame *GetActiveChild(void) const;
- virtual void SetToolBar( wxToolBar *toolbar );
- virtual wxWindow *GetToolBar(void) const;
-
wxMDIClientWindow *GetClientWindow(void) const;
virtual wxMDIClientWindow *OnCreateClient(void);
wxMDIClientWindow *m_clientWindow;
bool m_parentFrameActive;
wxMenuBar *m_mdiMenuBar;
- wxToolBar *m_toolBar;
DECLARE_EVENT_TABLE()
};
const wxString& helpString1 = "", const wxString& helpString2 = "");
virtual void AddSeparator(void);
virtual void ClearTools(void);
+
+ virtual void Layout(void);
virtual void EnableTool(int toolIndex, bool enable);
virtual void ToggleTool(int toolIndex, bool toggle); // toggle is TRUE if toggled on
// ----------------------------------------------------------------------------
// global functions
// ----------------------------------------------------------------------------
-inline WXDLLEXPORT wxLocale* wxGetLocale() { return g_pLocale; }
+
+WXDLLEXPORT wxLocale* wxGetLocale();
// get the translation of the string in the current locale
inline WXDLLEXPORT const char *wxGetTranslation(const char *sz)
wxList(int N, wxObject *Objects[]);
wxList(wxObject *object, ...);
-#ifdef USE_STORABLE_CLASSES
- wxList( istream &stream, char *data );
- virtual void StoreObject( ostream &stream );
-#endif
-
~wxList(void);
inline int Number(void) const { return n; }
*/
};
+
+/*
+The code is wrong and doesn't compile. Chris Breeze als reported, that
+some functions of wxTransformMatrix cannot work because it is not
+known if he matrix has been inverted. Be careful when using it.
+
// Transform X value from logical to device
inline double wxTransformMatrix::TransformX(double x) const
{
-// return (m_isIdentity ? x : (x * m_matrix[0][0] + y * m_matrix[1][0] + m_matrix[2][0]));
- return 0;
+ return (m_isIdentity ? x : (x * m_matrix[0][0] + y * m_matrix[1][0] + m_matrix[2][0]));
}
// Transform Y value from logical to device
inline double wxTransformMatrix::TransformY(double y) const
{
-// return (m_isIdentity ? y : (x * m_matrix[0][1] + y * m_matrix[1][1] + m_matrix[2][1]));
- return 0;
+ return (m_isIdentity ? y : (x * m_matrix[0][1] + y * m_matrix[1][1] + m_matrix[2][1]));
}
+*/
// Is the matrix the identity matrix?
// Perhaps there's some kind of optimization we can do to make this
#endif
#include <wx/stream.h>
-#include "zlib.h"
+#include "../zlib/zlib.h"
class wxZlibInputStream: public wxFilterInputStream {
public:
protected:
size_t DoRead(void *buffer, size_t size);
- off_t DoSeekInput(off_t pos, wxSeekMode WXUNUSED(mode)) { return wxInvalidOffset; }
+ off_t DoSeekInput(off_t WXUNUSED(pos), wxSeekMode WXUNUSED(mode)) { return wxInvalidOffset; }
off_t DoTellInput() const { return wxInvalidOffset; }
protected:
protected:
size_t DoWrite(const void *buffer, size_t size);
- off_t DoSeekOutput(off_t pos, wxSeekMode WXUNUSED(mode)) { return wxInvalidOffset; }
+ off_t DoSeekOutput(off_t WXUNUSED(pos), wxSeekMode WXUNUSED(mode)) { return wxInvalidOffset; }
off_t DoTellOutput() const { return wxInvalidOffset; }
protected:
wxGTK uses GNU configure. If you have problems with your make use GNU
make instead.
+* Additional libraries
+-----------------------
+
+wxGTK requires the GTK (The Gimp Toolkit) to be installed,
+which probably makes sense.
+
+There will be a few more features of wxGTK, which will
+require further libraries (on some platforms). These
+features will be optional. I hope to teach configure
+to check that out automatically.
+
+Thread support:
+
+ Requires pthreads under Linux with glibc 2. pthreads are
+ always present on such systems, so just compile.
+
+ Requires pcthreads under Linux with libc 5. If you
+ haven't installed pcthreads, there will be no thread
+ support in wxGTK, but the library will compile.
+
+Python scripting language support:
+
+ Requires Python. Soon to come.
+
+* Other things to do
+-----------------------------
+
+Copy the two files from ~/wxGTK/misc/imlib to your
+home directory. You may also edit imrc by hand as
+you like. The palette file is required when using
+wxGTK in 256-colour mode.
+
+If you want to use wxGTK's ODBC support, you'll have
+to create a .odbc.ini file. The readme file in
+~/wxGTK/src/iodbc tells you what to do.
+
+
* Create your configuration
-----------------------------
+
+This must be done in ~/wxGTK/install/gtk
+
Usage:
./configure options
broken.
--with-mem_tracing Add built-in memory tracing.
- Not yet.
- --with-debug Add debug info to object
+ --with-debug_info Add debug info to object
files.
+ --with-debug_flag Define __DEBUG__ and __WXDEBUG__ when
+ compiling.
+
* Feature Options
-------------------
matically enables all features, as long as they are already
implemented.
-* Additional libraries
------------------------
-
-[Note: Currently wxGTK will compile out-of-the-box
- with no extra libraries required. Support for
- OpenGl, threads, Python and hopefully ODBC
- support will soon be added.]
-
-wxGTK requires the GTK (The Gimp Toolkit) to be installed,
-which probably makes sense.
-
-There will be a few more features of wxGTK, which will
-require further libraries (on some platforms). These
-features will be optional. I hope to teach configure
-to check that out automatically.
-
-Thread support:
-
- Requires pthreads under Linux without glibc or glibc 2.
-
-OpenGl:
-
- Requires OpenGl or MesaGl.
-
-Python scripting language support:
-
- Requires Python.
-
* Compiling
-------------
+This must be done in ~/wxGTK
+
First you have to create all makefiles in all subdirectories:
make makefiles
--------------------------
I propose to put all contributed programs in the directory
-"user", with a directory of its own.
+"~/wcGTK/user", with a directory of its own.
This directory then should include the following files:
#define USE_MEMORY_TRACING $USE_MEM_TRACING
EOF
- cat >> confdefs.h <<EOF
-#define USE_GLOBAL_MEMORY_OPERATORS $USE_MEM_TRACING
-EOF
-
-fi
+ fi
PROFILE=
if test "$USE_PROFILE" = 1 ; then
# Extract the first word of "gtk-config", so it can be a program name with args.
set dummy gtk-config; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:6056: checking for $ac_word" >&5
+echo "configure:6052: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_GTK_CONFIG'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
min_gtk_version=0.99.7
echo $ac_n "checking for GTK - version >= $min_gtk_version""... $ac_c" 1>&6
-echo "configure:6087: checking for GTK - version >= $min_gtk_version" >&5
+echo "configure:6083: checking for GTK - version >= $min_gtk_version" >&5
no_gtk=""
if test "$GTK_CONFIG" != "no" ; then
GTK_CFLAGS=`$GTK_CONFIG --cflags`
echo $ac_n "cross compiling; assumed OK... $ac_c"
else
cat > conftest.$ac_ext <<EOF
-#line 6100 "configure"
+#line 6096 "configure"
#include "confdefs.h"
#include <gtk/gtk.h>
}
EOF
-if { (eval echo configure:6122: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6118: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
:
else
if test "$USE_OPENGL" = 1; then
echo $ac_n "checking for OpenGL includes""... $ac_c" 1>&6
-echo "configure:6178: checking for OpenGL includes" >&5
+echo "configure:6174: checking for OpenGL includes" >&5
ac_find_includes=
for ac_dir in $SEARCH_INCLUDE;
OPENGL_INCLUDE="-I$ac_find_includes"
echo "$ac_t""found $ac_find_includes" 1>&6
echo $ac_n "checking for OpenGL library""... $ac_c" 1>&6
-echo "configure:6193: checking for OpenGL library" >&5
+echo "configure:6189: checking for OpenGL library" >&5
ac_find_libraries=
for ac_dir in $SEARCH_LIB;
if test "$USE_MEM_TRACING" = 1 ; then
AC_DEFINE_UNQUOTED(USE_MEMORY_TRACING,$USE_MEM_TRACING)
- AC_DEFINE_UNQUOTED(USE_GLOBAL_MEMORY_OPERATORS,$USE_MEM_TRACING)
+ dnl AC_DEFINE_UNQUOTED(USE_GLOBAL_MEMORY_OPERATORS,$USE_MEM_TRACING)
fi
PROFILE=
#include "wx/mdi.h"
#endif
-#ifdef __WXMSW__
-#ifdef __WIN95__
-#include <wx/tbar95.h>
-#else
-#include <wx/tbarmsw.h>
-#endif
-#endif
+#include <wx/toolbar.h>
#ifdef __WXGTK__
-//#include "list.xpm"
-//#include "folder.xpm"
+#include "folder.xpm"
#endif
#include "mdi.h"
wxTE_MULTILINE|wxSUNKEN_BORDER);
textWindow->SetValue("A help window");
-#ifdef __WXMSW__
toolBar = new TestRibbon(this, 0, 0, 100, 30, wxNO_BORDER, wxVERTICAL, 1);
SetToolBar(toolBar);
-#endif
}
void MyFrame::OnQuit(wxCommandEvent& event)
int tw = 0;
int th = 0;
-#ifdef __WXMSW__
wxWindow* tbar = GetToolBar();
if (tbar)
{
tbar->GetSize(&tw, &th);
tbar->SetSize(w, th);
}
-#endif
textWindow->SetSize(0, th, 200, h-th);
GetClientWindow()->SetSize(200, th, w - 200, h-th);
return TRUE;
}
-#ifdef __WXMSW__
-
BEGIN_EVENT_TABLE(TestRibbon, wxToolBar)
EVT_PAINT(TestRibbon::OnPaint)
END_EVENT_TABLE()
{
wxBitmap* bitmaps[8];
+#ifdef __WXMSW__
bitmaps[0] = new wxBitmap("icon1", wxBITMAP_TYPE_RESOURCE);
bitmaps[1] = new wxBitmap("icon2", wxBITMAP_TYPE_RESOURCE);
bitmaps[2] = new wxBitmap("icon3", wxBITMAP_TYPE_RESOURCE);
bitmaps[5] = new wxBitmap("icon6", wxBITMAP_TYPE_RESOURCE);
bitmaps[6] = new wxBitmap("icon7", wxBITMAP_TYPE_RESOURCE);
bitmaps[7] = new wxBitmap("icon8", wxBITMAP_TYPE_RESOURCE);
+#else
+ bitmaps[0] = new wxBitmap( folder_xpm );
+ bitmaps[1] = new wxBitmap( folder_xpm );
+ bitmaps[2] = new wxBitmap( folder_xpm );
+ bitmaps[3] = new wxBitmap( folder_xpm );
+ bitmaps[4] = new wxBitmap( folder_xpm );
+ bitmaps[5] = new wxBitmap( folder_xpm );
+ bitmaps[6] = new wxBitmap( folder_xpm );
+ bitmaps[7] = new wxBitmap( folder_xpm );
+#endif
#ifdef __WXMSW__
int width = 24;
dc.DrawLine(0, h-1, w, h-1);
}
-#endif
DECLARE_EVENT_TABLE()
};
-#ifdef __WXMSW__
-
class TestRibbon: public wxToolBar
{
public:
DECLARE_EVENT_TABLE()
};
-#endif
-
// Define a new frame
class MyFrame: public wxMDIParentFrame
{
public:
wxTextCtrl *textWindow;
-#ifdef __WXMSW__
TestRibbon* toolBar;
-#endif
MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, const long style);
bool OnClose(void);
#error You must set WXDEBUG to 1 on the 'make' command line or make.env.
#endif
-#define new WXDEBUG_NEW
+// #define new WXDEBUG_NEW
// Define a new application type
class MyApp: public wxApp
frame->Show(TRUE);
// wxDebugContext::SetCheckpoint();
- wxDebugContext::SetFile("debug.log");
+// wxDebugContext::SetFile("debug.log");
wxString *thing = new wxString; // WXDEBUG_NEW wxString;
wxDate* date = new wxDate;
const char *data = (const char*) thing ;
- wxDebugContext::PrintClasses();
- wxDebugContext::Dump();
- wxDebugContext::PrintStatistics();
+// wxDebugContext::PrintClasses();
+// wxDebugContext::Dump();
+// wxDebugContext::PrintStatistics();
// Don't delete these two objects, to force wxApp to flag a memory leak.
// delete thing;
preview = new wxWindowsPrintPreview(printout, view->OnCreatePrintout());
else
#endif
- preview = new wxPostScriptPrintPreview(printout, view->OnCreatePrintout());
+ preview = new wxPostScriptPrintPreview(printout, view->OnCreatePrintout());
wxPreviewFrame *frame = new wxPreviewFrame(preview, (wxFrame *)wxTheApp->GetTopWindow(), "Print Preview",
wxPoint(100, 100), wxSize(600, 650));
while (table.entries[i].m_fn != NULL)
{
- wxEventType eventType = (wxEventType) table.entries[i].m_eventType;
+// wxEventType eventType = (wxEventType) table.entries[i].m_eventType;
if ((event.GetEventType() == table.entries[i].m_eventType) &&
(table.entries[i].m_id == -1 || // Match, if event spec says any id will do (id == -1)
while (node)
{
wxEventTableEntry *entry = (wxEventTableEntry*)node->Data();
- wxEventType eventType = (wxEventType) entry->m_eventType;
+
+// wxEventType eventType = (wxEventType) entry->m_eventType;
if (entry->m_fn)
{
}
void
+#ifdef __WXMSW__
wxUnix2DosFilename (char *s)
+#else
+wxUnix2DosFilename (char *WXUNUSED(s))
+#endif
{
// Yes, I really mean this to happen under DOS only! JACS
#ifdef __WXMSW__
uint nPosDos = pSepDos ? pSepDos - pszFileName : 0;
if ( nPosDos > nPosUnix )
nPosUnix = nPosDos;
- uint nLen = Strlen(pszFileName);
+// uint nLen = Strlen(pszFileName);
if ( pstrPath )
*pstrPath = wxString(pszFileName, nPosUnix);
#include "wx/frame.h"
-void wxFrame::OnIdle(wxIdleEvent& event)
+void wxFrame::OnIdle(wxIdleEvent& WXUNUSED(event) )
{
DoMenuUpdates();
}
}
}
-#ifdef USE_STORABLE_CLASSES
-wxList::wxList( istream &stream, char *WXUNUSED(data) )
-{
- char buf[200];
- unsigned int num;
- stream.read( (char*)(&num), sizeof(num) );
- for (unsigned int i = 0; i < num; i++)
- {
- int len;
- stream.read( (char*)(&len), sizeof(len) );
- stream.read( (char*)(&buf), len );
- buf[len] = 0;
- Append( wxCreateStoredObject( buf, stream, NULL ) );
- };
-};
-
-void wxList::StoreObject( ostream &stream )
-{
- unsigned int num = Number();
- stream.write( (char*)(&num), sizeof(num) );
- wxNode *node = First();
- while (node)
- {
- wxObject *obj = (wxObject*) node->Data();
- wxClassInfo *obj_info = obj->GetClassInfo();
- int len = strlen(obj_info->className);
- stream.write( (char*)(&len), sizeof(len) );
- stream.write( obj_info->className, len );
- obj->StoreObject( stream );
- node = node->Next();
- };
-};
-#endif
-
wxNode *wxList::Append(wxObject *object)
{
wxNode *node = new wxNode(this, last_node, NULL, object);
}
}
-void wxLog::DoLogString(const char *szString)
+void wxLog::DoLogString(const char *WXUNUSED(szString))
{
wxFAIL_MSG("DoLogString must be overrided if it's called.");
}
// @@ what about status bar? needed (for menu prompts)?
}
-void wxLogFrame::OnClose(wxCommandEvent& event)
+void wxLogFrame::OnClose(wxCommandEvent& WXUNUSED(event))
{
// just hide the window
Show(FALSE);
}
-void wxLogFrame::OnCloseWindow(wxCloseEvent& event)
+void wxLogFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
{
// just hide the window
Show(FALSE);
}
-void wxLogFrame::OnSave(wxCommandEvent& event)
+void wxLogFrame::OnSave(wxCommandEvent& WXUNUSED(event))
{
// get the file name
// -----------------
// open file
// ---------
wxFile file;
- bool bOk;
+ bool bOk = FALSE;
if ( wxFile::Exists(szFileName) ) {
- bool bAppend;
+ bool bAppend = FALSE;
wxString strMsg;
strMsg.Printf(_("Append log to file '%s' "
"(choosing [No] will overwrite it)?"), szFileName);
}
}
-void wxLogFrame::OnClear(wxCommandEvent& event)
+void wxLogFrame::OnClear(wxCommandEvent& WXUNUSED(event))
{
m_pTextCtrl->Clear();
}
ErrorMsg ("Object already deleted");
else {
// Can't use the error routines as we have no recognisable object.
- wxTrace("Can't verify memory struct - all bets are off!\n");
+ // wxTrace("Can't verify memory struct - all bets are off!\n");
}
return 0;
}
return sqlstate;
}
-bool wxDatabase::Open(char *thedatasource, bool exclusive, bool readOnly, char *username, char *password)
+bool wxDatabase::Open(char *thedatasource, bool WXUNUSED(exclusive),
+ bool WXUNUSED(readOnly), char *username, char *password)
{
err_occured = FALSE;
char nameBuf[400];
int nameSize = 0;
- retcode = SQLGetInfo(hDBC, SQL_DATABASE_NAME, nameBuf, sizeof(nameBuf), (short *)&nameSize);
+ retcode = SQLGetInfo(hDBC, SQL_DATABASE_NAME, (unsigned char*)nameBuf, sizeof(nameBuf), (short *)&nameSize);
if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO)
return NULL;
return FALSE;
}
-void wxDatabase::SetLoginTimeout(long seconds)
+void wxDatabase::SetLoginTimeout(long WXUNUSED(seconds))
{
}
-void wxDatabase::SetQueryTimeout(long seconds)
+void wxDatabase::SetQueryTimeout(long WXUNUSED(seconds))
{
}
-void wxDatabase::SetSynchronousMode(bool synchronous)
+void wxDatabase::SetSynchronousMode(bool WXUNUSED(synchronous))
{
}
}
// Overridables
-void wxDatabase::OnSetOptions(wxRecordSet *recordSet)
+void wxDatabase::OnSetOptions(wxRecordSet *WXUNUSED(recordSet))
{
}
-void wxDatabase::OnWaitForDataSource(bool stillExecuting)
+void wxDatabase::OnWaitForDataSource(bool WXUNUSED(stillExecuting))
{
}
bool wxDatabase::GetInfo(long infoType, long *buf)
{
short sz = 0;
- retcode = SQLGetInfo(hDBC, (UWORD)infoType, (char *)buf, sizeof(buf), &sz);
+ retcode = SQLGetInfo(hDBC, (UWORD)infoType, (unsigned char*)buf, sizeof(buf), &sz);
if (retcode != SQL_ERROR)
return TRUE;
bufSize = sizeof(buf);
short sz = 0;
- retcode = SQLGetInfo(hDBC, (UWORD)infoType, buf, bufSize, &sz);
+ retcode = SQLGetInfo(hDBC, (UWORD)infoType, (unsigned char*)buf, bufSize, &sz);
if (retcode != SQL_ERROR)
return TRUE;
int bufSize = sizeof(buf);
short sz = 0;
- retcode = SQLGetInfo(hDBC, (UWORD)SQL_ODBC_VER, buf, bufSize, &sz);
+ retcode = SQLGetInfo(hDBC, (UWORD)SQL_ODBC_VER, (unsigned char*)buf, bufSize, &sz);
if (hDBC != 0 && noDBC)
{
int bufSize = sizeof(buf);
short sz = 0;
- retcode = SQLGetInfo(hDBC, (UWORD)SQL_ODBC_VER, buf, bufSize, &sz);
+ retcode = SQLGetInfo(hDBC, (UWORD)SQL_ODBC_VER, (unsigned char*)buf, bufSize, &sz);
if (hDBC != 0 && noDBC)
{
}
// If SQL is non-NULL, table and columns can be NULL.
-bool wxRecordSet::BeginQuery(int openType, char *sql, int options)
+bool wxRecordSet::BeginQuery(int WXUNUSED(openType), char *WXUNUSED(sql), int WXUNUSED(options))
{
// Needs to construct an appropriate SQL statement. By default
// (i.e. if table and columns are provided) then
do {
((wxQueryCol*)node->Data())->FillVar(recnum);
- } while (node = node->Next());
+ } while ((node = node->Next()));
}
bool wxRecordSet::GetResultSet(void)
bool wxRecordSet::GetColumns(char* table)
{
char* name=NULL;
- char* wildcard = "%";
+// char* wildcard = "%";
name = table ? table : tablename;
bool wxRecordSet::GetPrimaryKeys(char* table)
{
char* name=NULL;
- char* wildcard = "%";
+// char* wildcard = "%";
name = table ? table : tablename;
{
char* Pkname=NULL;
char* Fkname=NULL;
- char* wildcard = "%";
+// char* wildcard = "%";
// Try to disable situation: both PkTableName and FkTableName are NULL
// set Pkname from tablename
((wxQueryCol*)node->Data())->SetFieldDirty(cursor, dirty);
}
-void wxRecordSet::SetFieldNull(void *p, bool isNull)
+void wxRecordSet::SetFieldNull(void *WXUNUSED(p), bool WXUNUSED(isNull))
{
}
wxNode* node = fields.Nth(row);
if (!node)
- return NULL;
+ return 0;
return ((wxQueryField*)node->Data())->GetSize();
}
{
if (data) // JACS
delete[] (char*)data;
- if (data = new char[size+1])
+ if ((data = new char[size+1]))
{
char *str = (char *)data;
int i;
{
if (data) // JACS
delete (long*)data;
- if (data = new long)
+ if ((data = new long))
*(long*)data = 0L;
break;
}
{
if (data)
delete (short*)data;
- if (data = new short)
+ if ((data = new short))
*(short*)data = 0;
break;
}
{
if (data)
delete (double*)data;
- if (data = new double)
+ if ((data = new double))
*(double*)data = 0;
break;
}
{
if (data)
delete (float*)data;
- if (data = new float)
+ if ((data = new float))
*(float*)data = (float)0;
break;
}
#include <wx/stream.h>
#include <wx/zstream.h>
#include <wx/utils.h>
-#include "zlib.h"
+#include "../zlib/zlib.h"
#ifdef __BORLANDC__
#pragma hdrstop
#include "wx/postscrp.h"
#include "wx/intl.h"
#include "wx/log.h"
+#include "wx/memory.h"
#include "unistd.h"
wxClassInfo::InitializeClasses();
+#if (WXDEBUG && USE_MEMORY_TRACING) || USE_DEBUG_CONTEXT
+
+#if !defined(_WINDLL)
+ streambuf* sBuf = new wxDebugStreamBuf;
+#else
+ streambuf* sBuf = NULL;
+#endif
+ ostream* oStr = new ostream(sBuf) ;
+ wxDebugContext::SetStream(oStr, sBuf);
+
+#endif
+
if (!wxTheApp)
{
if (!wxApp::GetInitializerFunction())
wxApp::CommonCleanUp();
+#if (WXDEBUG && USE_MEMORY_TRACING) || USE_DEBUG_CONTEXT
+ // At this point we want to check if there are any memory
+ // blocks that aren't part of the wxDebugContext itself,
+ // as a special case. Then when dumping we need to ignore
+ // wxDebugContext, too.
+ if (wxDebugContext::CountObjectsLeft() > 0)
+ {
+ wxTrace("There were memory leaks.\n");
+ wxDebugContext::Dump();
+ wxDebugContext::PrintStatistics();
+ }
+ wxDebugContext::SetStream(NULL, NULL);
+#endif
+
return retValue;
};
};
};
+// CMB 21/7/98: Added SetBackground. Sets background brush
+// for Clear() and bg colour for shapes filled with cross-hatch brush
+void wxPaintDC::SetBackground( const wxBrush &brush )
+{
+ if (!Ok()) return;
+
+ if (m_backgroundBrush == brush) return;
+
+ m_backgroundBrush = brush;
+
+ if (!m_backgroundBrush.Ok()) return;
+
+ m_backgroundBrush.GetColour().CalcPixel( m_cmap );
+ gdk_gc_set_background( m_brushGC, m_backgroundBrush.GetColour().GetColor() );
+ gdk_gc_set_foreground( m_bgGC, m_backgroundBrush.GetColour().GetColor() );
+
+ GdkFill fillStyle = GDK_SOLID;
+ switch (m_backgroundBrush.GetStyle())
+ {
+ case wxSOLID:
+ case wxTRANSPARENT:
+ break;
+ default:
+ fillStyle = GDK_STIPPLED;
+ };
+
+ gdk_gc_set_fill( m_bgGC, fillStyle );
+
+ if (m_backgroundBrush.GetStyle() == wxSTIPPLE)
+ {
+ gdk_gc_set_stipple( m_bgGC, m_backgroundBrush.GetStipple()->GetPixmap() );
+ };
+
+ if (IS_HATCH(m_backgroundBrush.GetStyle()))
+ {
+ int num = m_backgroundBrush.GetStyle() - wxBDIAGONAL_HATCH;
+ gdk_gc_set_stipple( m_bgGC, hatches[num] );
+ };
+};
+
void wxPaintDC::SetLogicalFunction( int function )
{
if (m_logicalFunction == function) return;
void wxPaintDC::SetBackgroundMode( int mode )
{
m_backgroundMode = mode;
+
+ // CMB 21/7/98: fill style of cross-hatch brushes is affected by
+ // transparent/solid background mode
+ if (m_brush.GetStyle() != wxSOLID && m_brush.GetStyle() != wxTRANSPARENT)
+ {
+ gdk_gc_set_fill( m_brushGC,
+ (m_backgroundMode == wxTRANSPARENT) ? GDK_STIPPLED : GDK_OPAQUE_STIPPLED);
+ }
};
void wxPaintDC::SetPalette( const wxPalette& WXUNUSED(palette) )
m_doingOnSize = FALSE;
m_frameMenuBar = NULL;
m_frameStatusBar = NULL;
+ m_frameToolBar = NULL;
m_sizeSet = FALSE;
+ m_addPrivateChild = FALSE;
wxTopLevelWindows.Insert( this );
};
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
+ m_doingOnSize = FALSE;
+ m_frameMenuBar = NULL;
+ m_frameStatusBar = NULL;
+ m_frameToolBar = NULL;
m_sizeSet = FALSE;
+ m_addPrivateChild = FALSE;
Create( parent, id, title, pos, size, style, name );
wxTopLevelWindows.Insert( this );
};
gtk_container_add( GTK_CONTAINER(m_mainWindow), m_wxwindow );
- m_frameMenuBar = NULL;
- m_frameStatusBar = NULL;
-
gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
GTK_SIGNAL_FUNC(gtk_frame_size_callback), (gpointer)this );
{
if (m_frameMenuBar) (*height) -= wxMENU_HEIGHT;
if (m_frameStatusBar) (*height) -= wxSTATUS_HEIGHT;
+ if (m_frameToolBar)
+ {
+ int y = 0;
+ m_frameToolBar->GetSize( NULL, &y );
+ (*height) -= y;
+ }
};
};
main_height -= wxMENU_HEIGHT;
};
+ int toolbar_height = 0;
+ if (m_frameToolBar) m_frameToolBar->GetSize( NULL, &toolbar_height );
+
+ main_y += toolbar_height;
+ main_height -= toolbar_height;
+
gtk_widget_set_uposition( GTK_WIDGET(m_wxwindow), main_x, main_y );
gtk_widget_set_usize( GTK_WIDGET(m_wxwindow), main_width, main_height );
gtk_widget_set_usize( m_frameMenuBar->m_widget, width-2, wxMENU_HEIGHT-2 );
};
+ if (m_frameToolBar)
+ {
+ gtk_widget_set_uposition( m_frameToolBar->m_widget, 1, wxMENU_HEIGHT );
+ gtk_widget_set_usize( m_frameToolBar->m_widget, width-2, toolbar_height );
+ };
+
if (m_frameStatusBar)
{
m_frameStatusBar->SetSize( 0, main_height-wxSTATUS_HEIGHT, width, wxSTATUS_HEIGHT );
// no child: go out !
if (!GetChildren()->First())
return;
-
+
// do we have exactly one child?
wxWindow *child = NULL;
for(wxNode *node = GetChildren()->First(); node; node = node->Next())
wxWindow *win = (wxWindow *)node->Data();
if (!win->IsKindOf(CLASSINFO(wxFrame)) &&
!win->IsKindOf(CLASSINFO(wxDialog))
-#if 0 // not in m_children anyway
+#if 0 // not in m_children anyway
&& (win != m_frameMenuBar) &&
+ (win != m_frameToolBar) &&
(win != m_frameStatusBar)
#endif
)
}
};
+void wxFrame::AddChild( wxWindow *child )
+{
+ if (m_addPrivateChild)
+ {
+ gtk_myfixed_put( GTK_MYFIXED(m_mainWindow), child->m_widget, child->m_x, child->m_y );
+
+ gtk_widget_set_usize( child->m_widget, child->m_width, child->m_height );
+ }
+ else
+ {
+ m_children.Append( child );
+
+ if (m_wxwindow)
+ gtk_myfixed_put( GTK_MYFIXED(m_wxwindow), child->m_widget, child->m_x, child->m_y );
+
+ gtk_widget_set_usize( child->m_widget, child->m_width, child->m_height );
+ }
+};
+
static void SetInvokingWindow( wxMenu *menu, wxWindow *win )
{
menu->SetInvokingWindow( win );
}
};
+wxMenuBar *wxFrame::GetMenuBar(void)
+{
+ return m_frameMenuBar;
+};
+
+wxToolBar *wxFrame::CreateToolBar( int style, int WXUNUSED(orientation), int WXUNUSED(rowsOrColumns) )
+{
+ m_addPrivateChild = TRUE;
+
+ m_frameToolBar = new wxToolBar( this, -1, wxDefaultPosition, wxDefaultSize, style );
+
+ m_addPrivateChild = FALSE;
+
+ return m_frameToolBar;
+};
+
+wxToolBar *wxFrame::GetToolBar(void)
+{
+ return m_frameToolBar;
+};
+
bool wxFrame::CreateStatusBar( int number )
{
if (m_frameStatusBar)
if (m_frameStatusBar) m_frameStatusBar->SetStatusWidths( n, width );
};
-wxStatusBar *wxFrame::GetStatusBar()
+wxStatusBar *wxFrame::GetStatusBar(void)
{
return m_frameStatusBar;
};
-wxMenuBar *wxFrame::GetMenuBar()
-{
- return m_frameMenuBar;
-};
-
void wxFrame::SetTitle( const wxString &title )
{
m_title = title;
gtk_window_set_title( GTK_WINDOW(m_widget), title );
};
-void wxFrame::SetSizeHints(int minW, int minH, int maxW, int maxH, int incW)
+void wxFrame::SetSizeHints(int minW, int minH, int maxW, int maxH, int WXUNUSED(incW) )
{
- // VZ: I don't know a way to set the max size for the window in GTK and have
- // no idea about what incW might be
- gtk_widget_set_usize(m_widget, minW, minH);
+ if (m_wxwindow)
+ gdk_window_set_hints( m_wxwindow->window, -1, -1,
+ minW, minH, maxW, maxH, GDK_HINT_MIN_SIZE | GDK_HINT_MIN_SIZE );
}
m_clientWindow = NULL;
m_currentChild = NULL;
m_parentFrameActive = TRUE;
- m_toolBar = NULL;
};
wxMDIParentFrame::wxMDIParentFrame( wxWindow *parent,
m_clientWindow = NULL;
m_currentChild = NULL;
m_parentFrameActive = TRUE;
- m_toolBar = NULL;
Create( parent, id, title, pos, size, style, name );
};
wxFrame::GetClientSize( width, height );
};
-void wxMDIParentFrame::SetToolBar( wxToolBar *toolbar )
-{
- m_toolBar = toolbar;
-};
-
-wxWindow *wxMDIParentFrame::GetToolBar(void) const
-{
- return m_toolBar;
-};
-
wxMDIChildFrame *wxMDIParentFrame::GetActiveChild(void) const
{
return m_currentChild;
while (node)
{
wxMenuItem *menuitem = (wxMenuItem*)node->Data();
- if (menuitem->GetSubMenu()) SetInvokingWindow( menuitem->GetSubMenu(), win );
+ if (menuitem->IsSubMenu())
+ SetInvokingWindow( menuitem->GetSubMenu(), win );
node = node->Next();
};
};
gtk_signal_connect( GTK_OBJECT(child->m_widget), "size_allocate",
GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)child );
-
+
gtk_notebook_append_page( GTK_NOTEBOOK(m_widget), child->m_widget, label_widget );
mdi_child->m_page = (GtkNotebookPage*) (g_list_last(GTK_NOTEBOOK(m_widget)->children)->data);
bool wxToolBar::OnLeftClick( int toolIndex, bool toggleDown )
{
+ wxCommandEvent event( wxEVENT_TYPE_MENU_COMMAND, toolIndex );
+ event.SetEventObject( this );
+ event.SetInt( toolIndex );
+ event.SetExtraLong( (long) toggleDown);
+
+/*
wxCommandEvent event(wxEVT_COMMAND_TOOL_CLICKED, toolIndex);
event.SetEventObject(this);
+ event.SetInt( toolIndex );
event.SetExtraLong((long) toggleDown);
+*/
GetEventHandler()->ProcessEvent(event);
void wxToolBar::OnRightClick( int toolIndex, float WXUNUSED(x), float WXUNUSED(y) )
{
- wxCommandEvent event(wxEVT_COMMAND_TOOL_RCLICKED, toolIndex);
- event.SetEventObject(this);
+ wxCommandEvent event( wxEVENT_TYPE_MENU_COMMAND, toolIndex );
+ event.SetEventObject( this );
+ event.SetInt( toolIndex );
GetEventHandler()->ProcessEvent(event);
};
{
wxCommandEvent event(wxEVT_COMMAND_TOOL_ENTER, toolIndex);
event.SetEventObject(this);
+ event.SetInt( toolIndex );
GetEventHandler()->ProcessEvent(event);
};
{
};
+void wxToolBar::Layout(void)
+{
+ m_x = 0;
+ m_y = 0;
+ m_width = 100;
+ m_height = 0;
+
+ wxNode *node = m_tools.First();
+ while (node)
+ {
+ wxToolBarTool *tool = (wxToolBarTool*)node->Data();
+ if (tool->m_bitmap1.Ok())
+ {
+ int tool_height = tool->m_bitmap1.GetHeight();
+ if (tool_height > m_height) m_height = tool_height;
+ };
+
+ node = node->Next();
+ };
+
+ m_height += 10;
+};
+
void wxToolBar::EnableTool(int toolIndex, bool enable)
{
};
{
};
-int wxTextCtrl::overflow(int c)
+int wxTextCtrl::overflow( int WXUNUSED(c) )
{
int len = pptr() - pbase();
char *txt = new char[len+1];
bool wxWindow::OnClose(void)
{
- printf( "OnClose event.\n" );
return TRUE;
};
// for wxFrame, wxDialog, wxWindow and
// wxMDIParentFrame.
+ // wxFrame and wxDialog as children aren't placed into the parents
+
+ if (child->IsKindOf(CLASSINFO(wxFrame)) || child->IsKindOf(CLASSINFO(wxDialog)))
+ {
+ m_children.Append( child );
+
+ if ((child->m_x != -1) && (child->m_y != -1))
+ gtk_widget_set_uposition( child->m_widget, child->m_x, child->m_y );
+
+ return;
+ }
+
+ // In the case of an wxMDIChildFrame descendant, we use the
+ // client windows's AddChild()
+
if (IsKindOf(CLASSINFO(wxMDIParentFrame)))
{
if (child->IsKindOf(CLASSINFO(wxMDIChildFrame)))
{
client->AddChild( child );
return;
- };
- };
- };
+ }
+ }
+ }
- // wxNotebooks are very special, so they have their own AddChild
+ // wxNotebook is very special, so it has a private AddChild()
if (IsKindOf(CLASSINFO(wxNotebook)))
{
wxNotebook *tab = (wxNotebook*)this;
tab->AddChild( child );
return;
- };
+ }
- m_children.Append( child );
- if (child->IsKindOf(CLASSINFO(wxFrame)) || child->IsKindOf(CLASSINFO(wxDialog)))
+ // wxFrame has a private AddChild
+
+ if (IsKindOf(CLASSINFO(wxFrame)))
{
- if ((child->m_x != -1) && (child->m_y != -1))
- gtk_widget_set_uposition( child->m_widget, child->m_x, child->m_y );
+ wxFrame *frame = (wxFrame*)this;
+ frame->AddChild( child );
+ return;
}
- else
- {
- if (m_wxwindow)
- gtk_myfixed_put( GTK_MYFIXED(m_wxwindow), child->m_widget, child->m_x, child->m_y );
- };
+
+ // All the rest
+
+ m_children.Append( child );
+ if (m_wxwindow) gtk_myfixed_put( GTK_MYFIXED(m_wxwindow), child->m_widget, child->m_x, child->m_y );
gtk_widget_set_usize( child->m_widget, child->m_width, child->m_height );
};
#include "wx/postscrp.h"
#include "wx/intl.h"
#include "wx/log.h"
+#include "wx/memory.h"
#include "unistd.h"
wxClassInfo::InitializeClasses();
+#if (WXDEBUG && USE_MEMORY_TRACING) || USE_DEBUG_CONTEXT
+
+#if !defined(_WINDLL)
+ streambuf* sBuf = new wxDebugStreamBuf;
+#else
+ streambuf* sBuf = NULL;
+#endif
+ ostream* oStr = new ostream(sBuf) ;
+ wxDebugContext::SetStream(oStr, sBuf);
+
+#endif
+
if (!wxTheApp)
{
if (!wxApp::GetInitializerFunction())
wxApp::CommonCleanUp();
+#if (WXDEBUG && USE_MEMORY_TRACING) || USE_DEBUG_CONTEXT
+ // At this point we want to check if there are any memory
+ // blocks that aren't part of the wxDebugContext itself,
+ // as a special case. Then when dumping we need to ignore
+ // wxDebugContext, too.
+ if (wxDebugContext::CountObjectsLeft() > 0)
+ {
+ wxTrace("There were memory leaks.\n");
+ wxDebugContext::Dump();
+ wxDebugContext::PrintStatistics();
+ }
+ wxDebugContext::SetStream(NULL, NULL);
+#endif
+
return retValue;
};
};
};
+// CMB 21/7/98: Added SetBackground. Sets background brush
+// for Clear() and bg colour for shapes filled with cross-hatch brush
+void wxPaintDC::SetBackground( const wxBrush &brush )
+{
+ if (!Ok()) return;
+
+ if (m_backgroundBrush == brush) return;
+
+ m_backgroundBrush = brush;
+
+ if (!m_backgroundBrush.Ok()) return;
+
+ m_backgroundBrush.GetColour().CalcPixel( m_cmap );
+ gdk_gc_set_background( m_brushGC, m_backgroundBrush.GetColour().GetColor() );
+ gdk_gc_set_foreground( m_bgGC, m_backgroundBrush.GetColour().GetColor() );
+
+ GdkFill fillStyle = GDK_SOLID;
+ switch (m_backgroundBrush.GetStyle())
+ {
+ case wxSOLID:
+ case wxTRANSPARENT:
+ break;
+ default:
+ fillStyle = GDK_STIPPLED;
+ };
+
+ gdk_gc_set_fill( m_bgGC, fillStyle );
+
+ if (m_backgroundBrush.GetStyle() == wxSTIPPLE)
+ {
+ gdk_gc_set_stipple( m_bgGC, m_backgroundBrush.GetStipple()->GetPixmap() );
+ };
+
+ if (IS_HATCH(m_backgroundBrush.GetStyle()))
+ {
+ int num = m_backgroundBrush.GetStyle() - wxBDIAGONAL_HATCH;
+ gdk_gc_set_stipple( m_bgGC, hatches[num] );
+ };
+};
+
void wxPaintDC::SetLogicalFunction( int function )
{
if (m_logicalFunction == function) return;
void wxPaintDC::SetBackgroundMode( int mode )
{
m_backgroundMode = mode;
+
+ // CMB 21/7/98: fill style of cross-hatch brushes is affected by
+ // transparent/solid background mode
+ if (m_brush.GetStyle() != wxSOLID && m_brush.GetStyle() != wxTRANSPARENT)
+ {
+ gdk_gc_set_fill( m_brushGC,
+ (m_backgroundMode == wxTRANSPARENT) ? GDK_STIPPLED : GDK_OPAQUE_STIPPLED);
+ }
};
void wxPaintDC::SetPalette( const wxPalette& WXUNUSED(palette) )
m_doingOnSize = FALSE;
m_frameMenuBar = NULL;
m_frameStatusBar = NULL;
+ m_frameToolBar = NULL;
m_sizeSet = FALSE;
+ m_addPrivateChild = FALSE;
wxTopLevelWindows.Insert( this );
};
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
+ m_doingOnSize = FALSE;
+ m_frameMenuBar = NULL;
+ m_frameStatusBar = NULL;
+ m_frameToolBar = NULL;
m_sizeSet = FALSE;
+ m_addPrivateChild = FALSE;
Create( parent, id, title, pos, size, style, name );
wxTopLevelWindows.Insert( this );
};
gtk_container_add( GTK_CONTAINER(m_mainWindow), m_wxwindow );
- m_frameMenuBar = NULL;
- m_frameStatusBar = NULL;
-
gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
GTK_SIGNAL_FUNC(gtk_frame_size_callback), (gpointer)this );
{
if (m_frameMenuBar) (*height) -= wxMENU_HEIGHT;
if (m_frameStatusBar) (*height) -= wxSTATUS_HEIGHT;
+ if (m_frameToolBar)
+ {
+ int y = 0;
+ m_frameToolBar->GetSize( NULL, &y );
+ (*height) -= y;
+ }
};
};
main_height -= wxMENU_HEIGHT;
};
+ int toolbar_height = 0;
+ if (m_frameToolBar) m_frameToolBar->GetSize( NULL, &toolbar_height );
+
+ main_y += toolbar_height;
+ main_height -= toolbar_height;
+
gtk_widget_set_uposition( GTK_WIDGET(m_wxwindow), main_x, main_y );
gtk_widget_set_usize( GTK_WIDGET(m_wxwindow), main_width, main_height );
gtk_widget_set_usize( m_frameMenuBar->m_widget, width-2, wxMENU_HEIGHT-2 );
};
+ if (m_frameToolBar)
+ {
+ gtk_widget_set_uposition( m_frameToolBar->m_widget, 1, wxMENU_HEIGHT );
+ gtk_widget_set_usize( m_frameToolBar->m_widget, width-2, toolbar_height );
+ };
+
if (m_frameStatusBar)
{
m_frameStatusBar->SetSize( 0, main_height-wxSTATUS_HEIGHT, width, wxSTATUS_HEIGHT );
// no child: go out !
if (!GetChildren()->First())
return;
-
+
// do we have exactly one child?
wxWindow *child = NULL;
for(wxNode *node = GetChildren()->First(); node; node = node->Next())
wxWindow *win = (wxWindow *)node->Data();
if (!win->IsKindOf(CLASSINFO(wxFrame)) &&
!win->IsKindOf(CLASSINFO(wxDialog))
-#if 0 // not in m_children anyway
+#if 0 // not in m_children anyway
&& (win != m_frameMenuBar) &&
+ (win != m_frameToolBar) &&
(win != m_frameStatusBar)
#endif
)
}
};
+void wxFrame::AddChild( wxWindow *child )
+{
+ if (m_addPrivateChild)
+ {
+ gtk_myfixed_put( GTK_MYFIXED(m_mainWindow), child->m_widget, child->m_x, child->m_y );
+
+ gtk_widget_set_usize( child->m_widget, child->m_width, child->m_height );
+ }
+ else
+ {
+ m_children.Append( child );
+
+ if (m_wxwindow)
+ gtk_myfixed_put( GTK_MYFIXED(m_wxwindow), child->m_widget, child->m_x, child->m_y );
+
+ gtk_widget_set_usize( child->m_widget, child->m_width, child->m_height );
+ }
+};
+
static void SetInvokingWindow( wxMenu *menu, wxWindow *win )
{
menu->SetInvokingWindow( win );
}
};
+wxMenuBar *wxFrame::GetMenuBar(void)
+{
+ return m_frameMenuBar;
+};
+
+wxToolBar *wxFrame::CreateToolBar( int style, int WXUNUSED(orientation), int WXUNUSED(rowsOrColumns) )
+{
+ m_addPrivateChild = TRUE;
+
+ m_frameToolBar = new wxToolBar( this, -1, wxDefaultPosition, wxDefaultSize, style );
+
+ m_addPrivateChild = FALSE;
+
+ return m_frameToolBar;
+};
+
+wxToolBar *wxFrame::GetToolBar(void)
+{
+ return m_frameToolBar;
+};
+
bool wxFrame::CreateStatusBar( int number )
{
if (m_frameStatusBar)
if (m_frameStatusBar) m_frameStatusBar->SetStatusWidths( n, width );
};
-wxStatusBar *wxFrame::GetStatusBar()
+wxStatusBar *wxFrame::GetStatusBar(void)
{
return m_frameStatusBar;
};
-wxMenuBar *wxFrame::GetMenuBar()
-{
- return m_frameMenuBar;
-};
-
void wxFrame::SetTitle( const wxString &title )
{
m_title = title;
gtk_window_set_title( GTK_WINDOW(m_widget), title );
};
-void wxFrame::SetSizeHints(int minW, int minH, int maxW, int maxH, int incW)
+void wxFrame::SetSizeHints(int minW, int minH, int maxW, int maxH, int WXUNUSED(incW) )
{
- // VZ: I don't know a way to set the max size for the window in GTK and have
- // no idea about what incW might be
- gtk_widget_set_usize(m_widget, minW, minH);
+ if (m_wxwindow)
+ gdk_window_set_hints( m_wxwindow->window, -1, -1,
+ minW, minH, maxW, maxH, GDK_HINT_MIN_SIZE | GDK_HINT_MIN_SIZE );
}
m_clientWindow = NULL;
m_currentChild = NULL;
m_parentFrameActive = TRUE;
- m_toolBar = NULL;
};
wxMDIParentFrame::wxMDIParentFrame( wxWindow *parent,
m_clientWindow = NULL;
m_currentChild = NULL;
m_parentFrameActive = TRUE;
- m_toolBar = NULL;
Create( parent, id, title, pos, size, style, name );
};
wxFrame::GetClientSize( width, height );
};
-void wxMDIParentFrame::SetToolBar( wxToolBar *toolbar )
-{
- m_toolBar = toolbar;
-};
-
-wxWindow *wxMDIParentFrame::GetToolBar(void) const
-{
- return m_toolBar;
-};
-
wxMDIChildFrame *wxMDIParentFrame::GetActiveChild(void) const
{
return m_currentChild;
while (node)
{
wxMenuItem *menuitem = (wxMenuItem*)node->Data();
- if (menuitem->GetSubMenu()) SetInvokingWindow( menuitem->GetSubMenu(), win );
+ if (menuitem->IsSubMenu())
+ SetInvokingWindow( menuitem->GetSubMenu(), win );
node = node->Next();
};
};
gtk_signal_connect( GTK_OBJECT(child->m_widget), "size_allocate",
GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)child );
-
+
gtk_notebook_append_page( GTK_NOTEBOOK(m_widget), child->m_widget, label_widget );
mdi_child->m_page = (GtkNotebookPage*) (g_list_last(GTK_NOTEBOOK(m_widget)->children)->data);
bool wxToolBar::OnLeftClick( int toolIndex, bool toggleDown )
{
+ wxCommandEvent event( wxEVENT_TYPE_MENU_COMMAND, toolIndex );
+ event.SetEventObject( this );
+ event.SetInt( toolIndex );
+ event.SetExtraLong( (long) toggleDown);
+
+/*
wxCommandEvent event(wxEVT_COMMAND_TOOL_CLICKED, toolIndex);
event.SetEventObject(this);
+ event.SetInt( toolIndex );
event.SetExtraLong((long) toggleDown);
+*/
GetEventHandler()->ProcessEvent(event);
void wxToolBar::OnRightClick( int toolIndex, float WXUNUSED(x), float WXUNUSED(y) )
{
- wxCommandEvent event(wxEVT_COMMAND_TOOL_RCLICKED, toolIndex);
- event.SetEventObject(this);
+ wxCommandEvent event( wxEVENT_TYPE_MENU_COMMAND, toolIndex );
+ event.SetEventObject( this );
+ event.SetInt( toolIndex );
GetEventHandler()->ProcessEvent(event);
};
{
wxCommandEvent event(wxEVT_COMMAND_TOOL_ENTER, toolIndex);
event.SetEventObject(this);
+ event.SetInt( toolIndex );
GetEventHandler()->ProcessEvent(event);
};
{
};
+void wxToolBar::Layout(void)
+{
+ m_x = 0;
+ m_y = 0;
+ m_width = 100;
+ m_height = 0;
+
+ wxNode *node = m_tools.First();
+ while (node)
+ {
+ wxToolBarTool *tool = (wxToolBarTool*)node->Data();
+ if (tool->m_bitmap1.Ok())
+ {
+ int tool_height = tool->m_bitmap1.GetHeight();
+ if (tool_height > m_height) m_height = tool_height;
+ };
+
+ node = node->Next();
+ };
+
+ m_height += 10;
+};
+
void wxToolBar::EnableTool(int toolIndex, bool enable)
{
};
{
};
-int wxTextCtrl::overflow(int c)
+int wxTextCtrl::overflow( int WXUNUSED(c) )
{
int len = pptr() - pbase();
char *txt = new char[len+1];
bool wxWindow::OnClose(void)
{
- printf( "OnClose event.\n" );
return TRUE;
};
// for wxFrame, wxDialog, wxWindow and
// wxMDIParentFrame.
+ // wxFrame and wxDialog as children aren't placed into the parents
+
+ if (child->IsKindOf(CLASSINFO(wxFrame)) || child->IsKindOf(CLASSINFO(wxDialog)))
+ {
+ m_children.Append( child );
+
+ if ((child->m_x != -1) && (child->m_y != -1))
+ gtk_widget_set_uposition( child->m_widget, child->m_x, child->m_y );
+
+ return;
+ }
+
+ // In the case of an wxMDIChildFrame descendant, we use the
+ // client windows's AddChild()
+
if (IsKindOf(CLASSINFO(wxMDIParentFrame)))
{
if (child->IsKindOf(CLASSINFO(wxMDIChildFrame)))
{
client->AddChild( child );
return;
- };
- };
- };
+ }
+ }
+ }
- // wxNotebooks are very special, so they have their own AddChild
+ // wxNotebook is very special, so it has a private AddChild()
if (IsKindOf(CLASSINFO(wxNotebook)))
{
wxNotebook *tab = (wxNotebook*)this;
tab->AddChild( child );
return;
- };
+ }
- m_children.Append( child );
- if (child->IsKindOf(CLASSINFO(wxFrame)) || child->IsKindOf(CLASSINFO(wxDialog)))
+ // wxFrame has a private AddChild
+
+ if (IsKindOf(CLASSINFO(wxFrame)))
{
- if ((child->m_x != -1) && (child->m_y != -1))
- gtk_widget_set_uposition( child->m_widget, child->m_x, child->m_y );
+ wxFrame *frame = (wxFrame*)this;
+ frame->AddChild( child );
+ return;
}
- else
- {
- if (m_wxwindow)
- gtk_myfixed_put( GTK_MYFIXED(m_wxwindow), child->m_widget, child->m_x, child->m_y );
- };
+
+ // All the rest
+
+ m_children.Append( child );
+ if (m_wxwindow) gtk_myfixed_put( GTK_MYFIXED(m_wxwindow), child->m_widget, child->m_x, child->m_y );
gtk_widget_set_usize( child->m_widget, child->m_width, child->m_height );
};
#ifndef _LINUX_CONFIG_H
#define _LINUX_CONFIG_H
+#ifdef __LINUX__
#include <linux/autoconf.h>
+#endif
/*
* Defines for what uname() should return
IMPLEMENT_DYNAMIC_CLASS( MyFrame, wxFrame )
BEGIN_EVENT_TABLE(MyFrame,wxFrame)
- EVT_SIZE (MyFrame::OnSize)
EVT_MENU (ID_ABOUT, MyFrame::OnAbout)
- EVT_TOOL (ID_ABOUT, MyFrame::OnAbout)
EVT_MENU (ID_QUIT, MyFrame::OnCommand)
- EVT_TOOL (ID_QUIT, MyFrame::OnCommand)
EVT_MENU (ID_HOME, MyFrame::OnCommand)
- EVT_TOOL (ID_HOME, MyFrame::OnCommand)
EVT_MENU (ID_PARENT, MyFrame::OnCommand)
- EVT_TOOL (ID_PARENT, MyFrame::OnCommand)
EVT_MENU (ID_LIST, MyFrame::OnView)
EVT_MENU (ID_REPORT, MyFrame::OnView)
EVT_MENU (ID_ICON, MyFrame::OnView)
- EVT_TOOL (ID_LIST, MyFrame::OnView)
- EVT_TOOL (ID_REPORT, MyFrame::OnView)
- EVT_TOOL (ID_ICON, MyFrame::OnView)
- EVT_TOOL (ID_TREE, MyFrame::OnView)
- EVT_TOOL (ID_SINGLE, MyFrame::OnView)
- EVT_TOOL (ID_COMMANDER, MyFrame::OnView)
+ EVT_MENU (ID_TREE, MyFrame::OnView)
+ EVT_MENU (ID_SINGLE, MyFrame::OnView)
+ EVT_MENU (ID_COMMANDER, MyFrame::OnView)
EVT_LIST_KEY_DOWN (ID_FILECTRL, MyFrame::OnListKeyDown)
EVT_LIST_DELETE_ITEM (ID_FILECTRL, MyFrame::OnListDeleteItem)
EVT_LIST_END_LABEL_EDIT (ID_FILECTRL, MyFrame::OnListEndLabelEdit)
SetStatusText( "Welcome", 0 );
SetStatusText( "wxFile v0.2 by Robert Roebling.", 1 );
- m_tb = new wxToolBar( this, ID_TOOLBAR, wxPoint(2,60), wxSize(300-4,26) );
+ wxToolBar *m_tb = CreateToolBar( ID_TOOLBAR );
m_tb->SetMargins( 2, 2 );
- wxBitmap *bm;
m_tb->AddSeparator();
-
- bm = new wxBitmap( exit_xpm );
- m_tb->AddTool( ID_QUIT, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "Exit wxFile" );
+ m_tb->AddTool( ID_QUIT, wxBitmap( exit_xpm ), wxNullBitmap, FALSE, -1, -1, NULL, "Exit wxFile" );
m_tb->AddSeparator();
-
- bm = new wxBitmap( prev_xpm );
- m_tb->AddTool( ID_PARENT, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "Go to parent directory" );
- bm = new wxBitmap( home_xpm );
- m_tb->AddTool( ID_HOME, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "Go to home directory" );
+ m_tb->AddTool( ID_PARENT, wxBitmap( prev_xpm ), wxNullBitmap, FALSE, -1, -1, NULL, "Go to parent directory" );
+ m_tb->AddTool( ID_HOME, wxBitmap( home_xpm ), wxNullBitmap, FALSE, -1, -1, NULL, "Go to home directory" );
m_tb->AddSeparator();
-
- bm = new wxBitmap( delete_xpm );
- m_tb->AddTool( ID_DELETE, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "Delete file" );
+ m_tb->AddTool( ID_DELETE, wxBitmap( delete_xpm ), wxNullBitmap, FALSE, -1, -1, NULL, "Delete file" );
m_tb->AddSeparator();
-
- bm = new wxBitmap( fileopen_xpm );
- m_tb->AddTool( ID_MD, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "Create directory" );
+ m_tb->AddTool( ID_MD, wxBitmap( fileopen_xpm ), wxNullBitmap, FALSE, -1, -1, NULL, "Create directory" );
m_tb->AddSeparator();
-
- bm = new wxBitmap( listview_xpm );
- m_tb->AddTool( ID_LIST, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "List view" );
- bm = new wxBitmap( reportview_xpm );
- m_tb->AddTool( ID_REPORT, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "Report view" );
- bm = new wxBitmap( iconview_xpm );
- m_tb->AddTool( ID_ICON, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "Icon view" );
+ m_tb->AddTool( ID_LIST, wxBitmap( listview_xpm ), wxNullBitmap, FALSE, -1, -1, NULL, "List view" );
+ m_tb->AddTool( ID_REPORT, wxBitmap( reportview_xpm ), wxNullBitmap, FALSE, -1, -1, NULL, "Report view" );
+ m_tb->AddTool( ID_ICON, wxBitmap( iconview_xpm ), wxNullBitmap, FALSE, -1, -1, NULL, "Icon view" );
m_tb->AddSeparator();
-
- bm = new wxBitmap( treeview_xpm );
- m_tb->AddTool( ID_TREE, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "Tree view" );
- bm = new wxBitmap( commanderview_xpm );
- m_tb->AddTool( ID_COMMANDER, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "Commander view" );
- bm = new wxBitmap( singleview_xpm );
- m_tb->AddTool( ID_SINGLE, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "Single view" );
+ m_tb->AddTool( ID_TREE, wxBitmap( treeview_xpm ), wxNullBitmap, FALSE, -1, -1, NULL, "Tree view" );
+ m_tb->AddTool( ID_COMMANDER, wxBitmap( commanderview_xpm ), wxNullBitmap, FALSE, -1, -1, NULL, "Commander view" );
+ m_tb->AddTool( ID_SINGLE, wxBitmap( singleview_xpm ), wxNullBitmap, FALSE, -1, -1, NULL, "Single view" );
m_tb->AddSeparator();
-
- bm = new wxBitmap( search_xpm );
- m_tb->AddTool( ID_MOUNT, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "Mount devices" );
+ m_tb->AddTool( ID_MOUNT, wxBitmap( search_xpm ), wxNullBitmap, FALSE, -1, -1, NULL, "Mount devices" );
m_tb->AddSeparator();
-
- bm = new wxBitmap( save_xpm );
- m_tb->AddTool( ID_SEARCH, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "Find file(s)" );
+ m_tb->AddTool( ID_SEARCH, wxBitmap( save_xpm ), wxNullBitmap, FALSE, -1, -1, NULL, "Find file(s)" );
m_tb->AddSeparator();
-
- bm = new wxBitmap( help_xpm );
- m_tb->AddTool( ID_ABOUT, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "About wxFile" );
+ m_tb->AddTool( ID_ABOUT, wxBitmap( help_xpm ), wxNullBitmap, FALSE, -1, -1, NULL, "About wxFile" );
m_tb->Layout();
m_splitter->SetMinimumPaneSize( 10 );
};
-void MyFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
-{
- int x = 0;
- int y = 0;
- GetClientSize( &x, &y );
-
- m_tb->SetSize( 1, 0, x-2, 30 );
- m_splitter->SetSize( 0, 31, x, y-31 );
-};
-
void MyFrame::OnView( wxCommandEvent &event )
{
int x = 0;
public:
MyFrame(void);
- void OnSize( wxSizeEvent &event );
void OnCommand( wxCommandEvent &event );
void OnAbout( wxCommandEvent &event );
void OnView( wxCommandEvent &event );
BEGIN_EVENT_TABLE(MyFrame,wxFrame)
EVT_MENU (-1, MyFrame::OnCommand)
EVT_COMMAND (-1,-1, MyFrame::OnCommand)
- EVT_CHAR (wxLayoutWindow::OnChar)
+ EVT_CHAR ( wxLayoutWindow::OnChar )
END_EVENT_TABLE()
MyFrame::MyFrame(void) :
#endif
#include "wxllist.h"
-#include "iostream"
+#include "iostream.h"
#include <wx/dc.h>
#include <wx/postscrp.h>
//virtual void OnDraw(wxDC &dc);
void OnPaint(wxPaintEvent &WXUNUSED(event));
- virtual void OnMouse(wxMouseEvent& event);
- virtual void OnChar(wxKeyEvent& event);
+ /*virtual*/ void OnMouse(wxMouseEvent& event);
+ /*virtual*/ void OnChar(wxKeyEvent& event);
void UpdateScrollbars(void);
void Print(void);
void Erase(void)
m_canvas = new MyCanvas( this, -1, wxPoint(2,62), wxSize(300-4,120-4) );
m_canvas->SetScrollbars( 10, 10, 50, 50 );
- m_tb = new wxToolBar( this, -1, wxPoint(2,60), wxSize(300-4,26) );
+ m_tb = CreateToolBar();
m_tb->SetMargins( 2, 2 );
-
- wxBitmap *bm = new wxBitmap( list_xpm );
- m_tb->AddTool( 0, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "This is a button" );
- bm = new wxBitmap( folder_xpm );
- m_tb->AddTool( 0, *bm, wxNullBitmap, TRUE, -1, -1, NULL, "This is a toggle" );
-
+ m_tb->AddTool( 0, wxBitmap( list_xpm ), wxNullBitmap, FALSE, -1, -1, NULL, "This is a button" );
+ m_tb->AddTool( 0, wxBitmap( folder_xpm ), wxNullBitmap, TRUE, -1, -1, NULL, "This is a toggle" );
m_tb->Layout();
- m_tb->Show( TRUE );
// m_timer.Start( 1000, TRUE );
};