warning msgs

toolbar updates
mdi fixes
dnd works now
Forty Thieves drawing optimization
wxDF_Text constants
ListCtrl bugs fixed
memory leak work
imrc now refers to home dir
dcclient/memory leak fixed


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@381 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
1998-07-27 20:50:48 +00:00
parent bf79063cc8
commit e3e65dac0c
76 changed files with 1654 additions and 474 deletions

View File

@@ -680,15 +680,22 @@ typedef enum {
// Don't do parent client adjustments (for implementation only) // Don't do parent client adjustments (for implementation only)
#define wxSIZE_NO_ADJUSTMENTS 0x0008 #define wxSIZE_NO_ADJUSTMENTS 0x0008
// Clipboard formats
// Numbers as per winuser.h // Data format for drag & drop and clipboard operations
# define wxCF_TEXT 1 /* CF_TEXT */ // numbers as per winuser.h
# define wxCF_BITMAP 2 /* CF_BITMAP */
# define wxCF_METAFILE 3 /* CF_METAFILEPICT */ enum wxDataFormat
# define wxCF_DIB 8 /* CF_DIB */ {
# define wxCF_OEMTEXT 7 /* CF_OEMTEXT */ wxDF_TEXT = 1, /* CF_TEXT */
wxDF_BITMAP = 2, /* CF_BITMAP */
wxDF_METAFILE = 3, /* CF_METAFILEPICT */
wxDF_DIB = 8, /* CF_DIB */
wxDF_OEMTEXT = 7, /* CF_OEMTEXT */
wxDF_FILENAME = 15 /* CF_HDROP */
};
// Virtual keycodes // Virtual keycodes
enum _Virtual_keycodes { enum _Virtual_keycodes {
WXK_BACK = 8, WXK_BACK = 8,
WXK_TAB = 9, WXK_TAB = 9,
@@ -872,8 +879,5 @@ typedef int (*WXFARPROC)();
#endif #endif
// for drag & drop and clipboard operations
typedef unsigned short wxDataFormat;
#endif #endif
// __WXDEFSH__ // __WXDEFSH__

View File

@@ -475,7 +475,7 @@ class wxListMainWindow: public wxScrolledWindow
bool m_renameAccept; bool m_renameAccept;
wxString m_renameRes; wxString m_renameRes;
bool m_isCreated; bool m_isCreated;
bool m_isDragging; int m_dragCount;
public: public:
wxListMainWindow(void); wxListMainWindow(void);
@@ -524,6 +524,7 @@ class wxListMainWindow: public wxScrolledWindow
int GetItemState( long item, long stateMask ); int GetItemState( long item, long stateMask );
int GetItemCount( void ); int GetItemCount( void );
void GetItemRect( long index, wxRectangle &rect ); void GetItemRect( long index, wxRectangle &rect );
bool GetItemPosition(long item, wxPoint& pos);
int GetSelectedItemCount( void ); int GetSelectedItemCount( void );
void SetMode( long mode ); void SetMode( long mode );
long GetMode( void ) const; long GetMode( void ) const;
@@ -582,8 +583,8 @@ class wxListCtrl: public wxControl
void SetItemText( long item, const wxString& str ); void SetItemText( long item, const wxString& str );
long GetItemData( long item ); long GetItemData( long item );
bool SetItemData( long item, long data ); bool SetItemData( long item, long data );
bool GetItemRect( long item, wxRectangle& rect, int code = wxLIST_RECT_BOUNDS ); // not supported in wxGLC bool GetItemRect( long item, wxRectangle& rect, int code = wxLIST_RECT_BOUNDS );
bool GetItemPosition( long item, wxPoint& pos ) const; // not supported in wxGLC bool GetItemPosition( long item, wxPoint& pos );
bool SetItemPosition( long item, const wxPoint& pos ); // not supported in wxGLC bool SetItemPosition( long item, const wxPoint& pos ); // not supported in wxGLC
int GetItemCount(void); int GetItemCount(void);
void SetItemSpacing( int spacing, bool isSmall = FALSE ); void SetItemSpacing( int spacing, bool isSmall = FALSE );

View File

@@ -26,11 +26,119 @@
class wxWindow; class wxWindow;
class wxDataObject;
class wxTextDataObject;
class wxFileDataObject;
class wxDropTarget; class wxDropTarget;
class wxTextDropTarget; class wxTextDropTarget;
class wxDragSource; class wxFileDropTarget;
class wxTextDragSource;
class wxDropSource;
//-------------------------------------------------------------------------
// wxDataObject
//-------------------------------------------------------------------------
class wxDataObject: public wxObject
{
public:
// all data formats (values are the same as in windows.h, do not change!)
enum StdFormat
{
Invalid,
Text,
Bitmap,
MetafilePict,
Sylk,
Dif,
Tiff,
OemText,
Dib,
Palette,
Pendata,
Riff,
Wave,
UnicodeText,
EnhMetafile,
Hdrop,
Locale,
Max
};
// function to return symbolic name of clipboard format (debug messages)
static const char *GetFormatName(wxDataFormat format);
// ctor & dtor
wxDataObject() {};
~wxDataObject() {};
// pure virtuals to override
// get the best suited format for our data
virtual wxDataFormat GetPreferredFormat() const = 0;
// decide if we support this format (should be one of values of
// StdFormat enumerations or a user-defined format)
virtual bool IsSupportedFormat(wxDataFormat format) const = 0;
// get the (total) size of data
virtual uint GetDataSize() const = 0;
// copy raw data to provided pointer
virtual void GetDataHere(void *pBuf) const = 0;
};
// ----------------------------------------------------------------------------
// wxTextDataObject is a specialization of wxDataObject for text data
// ----------------------------------------------------------------------------
class wxTextDataObject : public wxDataObject
{
public:
// ctors
wxTextDataObject() { }
wxTextDataObject(const wxString& strText) : m_strText(strText) { }
void Init(const wxString& strText) { m_strText = strText; }
// implement base class pure virtuals
virtual wxDataFormat GetPreferredFormat() const
{ return wxDF_TEXT; }
virtual bool IsSupportedFormat(wxDataFormat format) const
{ return format == wxDF_TEXT; }
virtual uint GetDataSize() const
{ return m_strText.Len() + 1; } // +1 for trailing '\0'of course
virtual void GetDataHere(void *pBuf) const
{ memcpy(pBuf, m_strText.c_str(), GetDataSize()); }
private:
wxString m_strText;
};
// ----------------------------------------------------------------------------
// wxFileDataObject is a specialization of wxDataObject for file names
// ----------------------------------------------------------------------------
class wxFileDataObject : public wxDataObject
{
public:
wxFileDataObject(void) { }
void AddFile( const wxString &file )
{ m_files += file; m_files += ";"; }
// implement base class pure virtuals
virtual wxDataFormat GetPreferredFormat() const
{ return wxDF_FILENAME; }
virtual bool IsSupportedFormat(wxDataFormat format) const
{ return format == wxDF_FILENAME; }
virtual uint GetDataSize() const
{ return m_files.Len() + 1; } // +1 for trailing '\0'of course
virtual void GetDataHere(void *pBuf) const
{ memcpy(pBuf, m_files.c_str(), GetDataSize()); }
private:
wxString m_files;
};
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// wxDropTarget // wxDropTarget
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
@@ -41,14 +149,22 @@ class wxDropTarget: public wxObject
wxDropTarget(); wxDropTarget();
~wxDropTarget(); ~wxDropTarget();
virtual void OnEnter() { } virtual void OnEnter() { }
virtual void OnLeave() { } virtual void OnLeave() { }
virtual bool OnDrop( long x, long y, const void *pData ) = 0; virtual bool OnDrop( long x, long y, const void *pData ) = 0;
public: // protected:
friend wxWindow;
// Override these to indicate what kind of data you support:
virtual size_t GetFormatCount() const = 0;
virtual wxDataFormat GetFormat(size_t n) const = 0;
void Drop( GdkEvent *event, int x, int y ); void Drop( GdkEvent *event, int x, int y );
virtual void RegisterWidget( GtkWidget *widget ) = 0; void RegisterWidget( GtkWidget *widget );
void UnregisterWidget( GtkWidget *widget ); void UnregisterWidget( GtkWidget *widget );
}; };
@@ -63,54 +179,74 @@ class wxTextDropTarget: public wxDropTarget
wxTextDropTarget() {}; wxTextDropTarget() {};
virtual bool OnDrop( long x, long y, const void *pData ); virtual bool OnDrop( long x, long y, const void *pData );
virtual bool OnDropText( long x, long y, const char *psz ); virtual bool OnDropText( long x, long y, const char *psz );
virtual void RegisterWidget( GtkWidget *widget );
protected:
virtual size_t GetFormatCount() const;
virtual wxDataFormat GetFormat(size_t n) const;
}; };
//------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxDragSource // A drop target which accepts files (dragged from File Manager or Explorer)
//------------------------------------------------------------------------- // ----------------------------------------------------------------------------
class wxDragSource: public wxObject class wxFileDropTarget: public wxDropTarget
{ {
public: public:
wxDragSource( wxWindow *win ); wxFileDropTarget() {};
~wxDragSource(void);
void SetData( char *data, long size );
void Start( int x, int y );
virtual bool OnDrop(long x, long y, const void *pData);
virtual bool OnDropFiles( long x, long y,
size_t nFiles, const char * const aszFiles[]);
protected:
virtual size_t GetFormatCount() const;
virtual wxDataFormat GetFormat(size_t n) const;
};
//-------------------------------------------------------------------------
// wxDropSource
//-------------------------------------------------------------------------
class wxDropSource: public wxObject
{
public: public:
void ConnectWindow(void); enum DragResult
void UnconnectWindow(void); {
virtual void RegisterWindow(void) = 0; Error, // error prevented the d&d operation from completing
None, // drag target didn't accept the data
Copy, // the data was successfully copied
Move, // the data was successfully moved
Cancel // the operation was cancelled by user (not an error)
};
wxDropSource( wxWindow *win );
wxDropSource( wxDataObject &data, wxWindow *win );
~wxDropSource(void);
void SetData( wxDataObject &data );
DragResult DoDragDrop( bool bAllowMove = FALSE );
virtual bool GiveFeedback( DragResult WXUNUSED(effect), bool WXUNUSED(bScrolling) ) { return TRUE; };
protected:
void RegisterWindow(void);
void UnregisterWindow(void); void UnregisterWindow(void);
GtkWidget *m_widget; GtkWidget *m_widget;
wxWindow *m_window; wxWindow *m_window;
char *m_data;
long m_size; wxDataObject *m_data;
wxCursor m_defaultCursor; wxCursor m_defaultCursor;
wxCursor m_goaheadCursor; wxCursor m_goaheadCursor;
}; };
//-------------------------------------------------------------------------
// wxTextDragSource
//-------------------------------------------------------------------------
class wxTextDragSource: public wxDragSource
{
public:
wxTextDragSource( wxWindow *win ) : wxDragSource(win) {};
void SetTextData( const wxString &text );
void RegisterWindow(void);
private:
wxString m_tmp;
};
#endif #endif
//__GTKDNDH__ //__GTKDNDH__

View File

@@ -64,13 +64,14 @@ public:
// set minimal/maxmimal size for the frame // set minimal/maxmimal size for the frame
virtual void SetSizeHints( int minW, int minH, int maxW, int maxH, int incW = -1 ); virtual void SetSizeHints( int minW, int minH, int maxW, int maxH, int incW = -1 );
virtual bool CreateStatusBar( int number = 1 ); virtual wxStatusBar* CreateStatusBar(int number=1, long style = wxST_SIZEGRIP, wxWindowID id = 0,
const wxString& name = "statusBar");
virtual wxStatusBar *GetStatusBar(); virtual wxStatusBar *GetStatusBar();
virtual void SetStatusText( const wxString &text, int number = 0 ); virtual void SetStatusText( const wxString &text, int number = 0 );
virtual void SetStatusWidths( int n, int *width ); virtual void SetStatusWidths( int n, int *width );
virtual wxToolBar *CreateToolBar( int style = 0, virtual wxToolBar* CreateToolBar( long style = wxNO_BORDER|wxTB_HORIZONTAL, wxWindowID id = -1,
int orientation = wxHORIZONTAL, int rowsOrColumns = 1 ); const wxString& name = wxToolBarNameStr);
virtual wxToolBar *GetToolBar(); virtual wxToolBar *GetToolBar();
virtual void SetMenuBar( wxMenuBar *menuBar ); virtual void SetMenuBar( wxMenuBar *menuBar );

View File

@@ -73,6 +73,8 @@ class wxListBox: public wxControl
void SetString( int n, const wxString &string ); void SetString( int n, const wxString &string );
void SetStringSelection( const wxString &string, bool select = TRUE ); void SetStringSelection( const wxString &string, bool select = TRUE );
virtual GtkWidget *GetDropTargetWidget(void);
private: private:
GtkList *m_list; GtkList *m_list;

View File

@@ -129,6 +129,7 @@ class wxMDIChildFrame: public wxPanel
bool Destroy(void); bool Destroy(void);
void OnCloseWindow( wxCloseEvent& event ); void OnCloseWindow( wxCloseEvent& event );
void OnSize( wxSizeEvent &event );
public: public:

View File

@@ -156,7 +156,6 @@ private:
uint m_idHandler; // the change page handler id uint m_idHandler; // the change page handler id
DECLARE_DYNAMIC_CLASS(wxNotebook) DECLARE_DYNAMIC_CLASS(wxNotebook)
DECLARE_EVENT_TABLE()
}; };
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -113,7 +113,7 @@ class wxToolBar: public wxControl
virtual void AddSeparator(void); virtual void AddSeparator(void);
virtual void ClearTools(void); virtual void ClearTools(void);
virtual void Layout(void); virtual void Realize(void);
virtual void EnableTool(int toolIndex, bool enable); virtual void EnableTool(int toolIndex, bool enable);
virtual void ToggleTool(int toolIndex, bool toggle); // toggle is TRUE if toggled on virtual void ToggleTool(int toolIndex, bool toggle); // toggle is TRUE if toggled on

View File

@@ -99,6 +99,8 @@ public:
wxTextCtrl& operator<<(double d); wxTextCtrl& operator<<(double d);
wxTextCtrl& operator<<(const char c); wxTextCtrl& operator<<(const char c);
virtual GtkWidget* GetDropTargetWidget(void);
private: private:
bool m_modified; bool m_modified;

View File

@@ -167,7 +167,10 @@ public:
virtual void SetDropTarget( wxDropTarget *dropTarget ); virtual void SetDropTarget( wxDropTarget *dropTarget );
virtual wxDropTarget *GetDropTarget() const; virtual wxDropTarget *GetDropTarget() const;
private:
virtual GtkWidget* GetDropTargetWidget(void);
public:
virtual void SetScrollbar( int orient, int pos, int thumbVisible, virtual void SetScrollbar( int orient, int pos, int thumbVisible,
int range, bool refresh = TRUE ); int range, bool refresh = TRUE );
virtual void SetScrollPos( int orient, int pos, bool refresh = TRUE ); virtual void SetScrollPos( int orient, int pos, bool refresh = TRUE );
@@ -182,6 +185,7 @@ public:
// update the UI state (called from OnIdle) // update the UI state (called from OnIdle)
void UpdateWindowUI(); void UpdateWindowUI();
public: // cannot get private going yet public: // cannot get private going yet
void PreCreation( wxWindow *parent, wxWindowID id, const wxPoint &pos, void PreCreation( wxWindow *parent, wxWindowID id, const wxPoint &pos,

View File

@@ -26,11 +26,119 @@
class wxWindow; class wxWindow;
class wxDataObject;
class wxTextDataObject;
class wxFileDataObject;
class wxDropTarget; class wxDropTarget;
class wxTextDropTarget; class wxTextDropTarget;
class wxDragSource; class wxFileDropTarget;
class wxTextDragSource;
class wxDropSource;
//-------------------------------------------------------------------------
// wxDataObject
//-------------------------------------------------------------------------
class wxDataObject: public wxObject
{
public:
// all data formats (values are the same as in windows.h, do not change!)
enum StdFormat
{
Invalid,
Text,
Bitmap,
MetafilePict,
Sylk,
Dif,
Tiff,
OemText,
Dib,
Palette,
Pendata,
Riff,
Wave,
UnicodeText,
EnhMetafile,
Hdrop,
Locale,
Max
};
// function to return symbolic name of clipboard format (debug messages)
static const char *GetFormatName(wxDataFormat format);
// ctor & dtor
wxDataObject() {};
~wxDataObject() {};
// pure virtuals to override
// get the best suited format for our data
virtual wxDataFormat GetPreferredFormat() const = 0;
// decide if we support this format (should be one of values of
// StdFormat enumerations or a user-defined format)
virtual bool IsSupportedFormat(wxDataFormat format) const = 0;
// get the (total) size of data
virtual uint GetDataSize() const = 0;
// copy raw data to provided pointer
virtual void GetDataHere(void *pBuf) const = 0;
};
// ----------------------------------------------------------------------------
// wxTextDataObject is a specialization of wxDataObject for text data
// ----------------------------------------------------------------------------
class wxTextDataObject : public wxDataObject
{
public:
// ctors
wxTextDataObject() { }
wxTextDataObject(const wxString& strText) : m_strText(strText) { }
void Init(const wxString& strText) { m_strText = strText; }
// implement base class pure virtuals
virtual wxDataFormat GetPreferredFormat() const
{ return wxDF_TEXT; }
virtual bool IsSupportedFormat(wxDataFormat format) const
{ return format == wxDF_TEXT; }
virtual uint GetDataSize() const
{ return m_strText.Len() + 1; } // +1 for trailing '\0'of course
virtual void GetDataHere(void *pBuf) const
{ memcpy(pBuf, m_strText.c_str(), GetDataSize()); }
private:
wxString m_strText;
};
// ----------------------------------------------------------------------------
// wxFileDataObject is a specialization of wxDataObject for file names
// ----------------------------------------------------------------------------
class wxFileDataObject : public wxDataObject
{
public:
wxFileDataObject(void) { }
void AddFile( const wxString &file )
{ m_files += file; m_files += ";"; }
// implement base class pure virtuals
virtual wxDataFormat GetPreferredFormat() const
{ return wxDF_FILENAME; }
virtual bool IsSupportedFormat(wxDataFormat format) const
{ return format == wxDF_FILENAME; }
virtual uint GetDataSize() const
{ return m_files.Len() + 1; } // +1 for trailing '\0'of course
virtual void GetDataHere(void *pBuf) const
{ memcpy(pBuf, m_files.c_str(), GetDataSize()); }
private:
wxString m_files;
};
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// wxDropTarget // wxDropTarget
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
@@ -41,14 +149,22 @@ class wxDropTarget: public wxObject
wxDropTarget(); wxDropTarget();
~wxDropTarget(); ~wxDropTarget();
virtual void OnEnter() { } virtual void OnEnter() { }
virtual void OnLeave() { } virtual void OnLeave() { }
virtual bool OnDrop( long x, long y, const void *pData ) = 0; virtual bool OnDrop( long x, long y, const void *pData ) = 0;
public: // protected:
friend wxWindow;
// Override these to indicate what kind of data you support:
virtual size_t GetFormatCount() const = 0;
virtual wxDataFormat GetFormat(size_t n) const = 0;
void Drop( GdkEvent *event, int x, int y ); void Drop( GdkEvent *event, int x, int y );
virtual void RegisterWidget( GtkWidget *widget ) = 0; void RegisterWidget( GtkWidget *widget );
void UnregisterWidget( GtkWidget *widget ); void UnregisterWidget( GtkWidget *widget );
}; };
@@ -63,54 +179,74 @@ class wxTextDropTarget: public wxDropTarget
wxTextDropTarget() {}; wxTextDropTarget() {};
virtual bool OnDrop( long x, long y, const void *pData ); virtual bool OnDrop( long x, long y, const void *pData );
virtual bool OnDropText( long x, long y, const char *psz ); virtual bool OnDropText( long x, long y, const char *psz );
virtual void RegisterWidget( GtkWidget *widget );
protected:
virtual size_t GetFormatCount() const;
virtual wxDataFormat GetFormat(size_t n) const;
}; };
//------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxDragSource // A drop target which accepts files (dragged from File Manager or Explorer)
//------------------------------------------------------------------------- // ----------------------------------------------------------------------------
class wxDragSource: public wxObject class wxFileDropTarget: public wxDropTarget
{ {
public: public:
wxDragSource( wxWindow *win ); wxFileDropTarget() {};
~wxDragSource(void);
void SetData( char *data, long size );
void Start( int x, int y );
virtual bool OnDrop(long x, long y, const void *pData);
virtual bool OnDropFiles( long x, long y,
size_t nFiles, const char * const aszFiles[]);
protected:
virtual size_t GetFormatCount() const;
virtual wxDataFormat GetFormat(size_t n) const;
};
//-------------------------------------------------------------------------
// wxDropSource
//-------------------------------------------------------------------------
class wxDropSource: public wxObject
{
public: public:
void ConnectWindow(void); enum DragResult
void UnconnectWindow(void); {
virtual void RegisterWindow(void) = 0; Error, // error prevented the d&d operation from completing
None, // drag target didn't accept the data
Copy, // the data was successfully copied
Move, // the data was successfully moved
Cancel // the operation was cancelled by user (not an error)
};
wxDropSource( wxWindow *win );
wxDropSource( wxDataObject &data, wxWindow *win );
~wxDropSource(void);
void SetData( wxDataObject &data );
DragResult DoDragDrop( bool bAllowMove = FALSE );
virtual bool GiveFeedback( DragResult WXUNUSED(effect), bool WXUNUSED(bScrolling) ) { return TRUE; };
protected:
void RegisterWindow(void);
void UnregisterWindow(void); void UnregisterWindow(void);
GtkWidget *m_widget; GtkWidget *m_widget;
wxWindow *m_window; wxWindow *m_window;
char *m_data;
long m_size; wxDataObject *m_data;
wxCursor m_defaultCursor; wxCursor m_defaultCursor;
wxCursor m_goaheadCursor; wxCursor m_goaheadCursor;
}; };
//-------------------------------------------------------------------------
// wxTextDragSource
//-------------------------------------------------------------------------
class wxTextDragSource: public wxDragSource
{
public:
wxTextDragSource( wxWindow *win ) : wxDragSource(win) {};
void SetTextData( const wxString &text );
void RegisterWindow(void);
private:
wxString m_tmp;
};
#endif #endif
//__GTKDNDH__ //__GTKDNDH__

View File

@@ -64,13 +64,14 @@ public:
// set minimal/maxmimal size for the frame // set minimal/maxmimal size for the frame
virtual void SetSizeHints( int minW, int minH, int maxW, int maxH, int incW = -1 ); virtual void SetSizeHints( int minW, int minH, int maxW, int maxH, int incW = -1 );
virtual bool CreateStatusBar( int number = 1 ); virtual wxStatusBar* CreateStatusBar(int number=1, long style = wxST_SIZEGRIP, wxWindowID id = 0,
const wxString& name = "statusBar");
virtual wxStatusBar *GetStatusBar(); virtual wxStatusBar *GetStatusBar();
virtual void SetStatusText( const wxString &text, int number = 0 ); virtual void SetStatusText( const wxString &text, int number = 0 );
virtual void SetStatusWidths( int n, int *width ); virtual void SetStatusWidths( int n, int *width );
virtual wxToolBar *CreateToolBar( int style = 0, virtual wxToolBar* CreateToolBar( long style = wxNO_BORDER|wxTB_HORIZONTAL, wxWindowID id = -1,
int orientation = wxHORIZONTAL, int rowsOrColumns = 1 ); const wxString& name = wxToolBarNameStr);
virtual wxToolBar *GetToolBar(); virtual wxToolBar *GetToolBar();
virtual void SetMenuBar( wxMenuBar *menuBar ); virtual void SetMenuBar( wxMenuBar *menuBar );

View File

@@ -73,6 +73,8 @@ class wxListBox: public wxControl
void SetString( int n, const wxString &string ); void SetString( int n, const wxString &string );
void SetStringSelection( const wxString &string, bool select = TRUE ); void SetStringSelection( const wxString &string, bool select = TRUE );
virtual GtkWidget *GetDropTargetWidget(void);
private: private:
GtkList *m_list; GtkList *m_list;

View File

@@ -129,6 +129,7 @@ class wxMDIChildFrame: public wxPanel
bool Destroy(void); bool Destroy(void);
void OnCloseWindow( wxCloseEvent& event ); void OnCloseWindow( wxCloseEvent& event );
void OnSize( wxSizeEvent &event );
public: public:

View File

@@ -156,7 +156,6 @@ private:
uint m_idHandler; // the change page handler id uint m_idHandler; // the change page handler id
DECLARE_DYNAMIC_CLASS(wxNotebook) DECLARE_DYNAMIC_CLASS(wxNotebook)
DECLARE_EVENT_TABLE()
}; };
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -113,7 +113,7 @@ class wxToolBar: public wxControl
virtual void AddSeparator(void); virtual void AddSeparator(void);
virtual void ClearTools(void); virtual void ClearTools(void);
virtual void Layout(void); virtual void Realize(void);
virtual void EnableTool(int toolIndex, bool enable); virtual void EnableTool(int toolIndex, bool enable);
virtual void ToggleTool(int toolIndex, bool toggle); // toggle is TRUE if toggled on virtual void ToggleTool(int toolIndex, bool toggle); // toggle is TRUE if toggled on

View File

@@ -99,6 +99,8 @@ public:
wxTextCtrl& operator<<(double d); wxTextCtrl& operator<<(double d);
wxTextCtrl& operator<<(const char c); wxTextCtrl& operator<<(const char c);
virtual GtkWidget* GetDropTargetWidget(void);
private: private:
bool m_modified; bool m_modified;

View File

@@ -167,7 +167,10 @@ public:
virtual void SetDropTarget( wxDropTarget *dropTarget ); virtual void SetDropTarget( wxDropTarget *dropTarget );
virtual wxDropTarget *GetDropTarget() const; virtual wxDropTarget *GetDropTarget() const;
private:
virtual GtkWidget* GetDropTargetWidget(void);
public:
virtual void SetScrollbar( int orient, int pos, int thumbVisible, virtual void SetScrollbar( int orient, int pos, int thumbVisible,
int range, bool refresh = TRUE ); int range, bool refresh = TRUE );
virtual void SetScrollPos( int orient, int pos, bool refresh = TRUE ); virtual void SetScrollPos( int orient, int pos, bool refresh = TRUE );
@@ -182,6 +185,7 @@ public:
// update the UI state (called from OnIdle) // update the UI state (called from OnIdle)
void UpdateWindowUI(); void UpdateWindowUI();
public: // cannot get private going yet public: // cannot get private going yet
void PreCreation( wxWindow *parent, wxWindowID id, const wxPoint &pos, void PreCreation( wxWindow *parent, wxWindowID id, const wxPoint &pos,

View File

@@ -31,15 +31,15 @@ class WXDLLEXPORT wxConnectionBase: public wxObject
inline ~wxConnectionBase(void) {} inline ~wxConnectionBase(void) {}
// Calls that CLIENT can make // Calls that CLIENT can make
virtual bool Execute(char *data, int size = -1, int format = wxCF_TEXT) = 0; virtual bool Execute(char *data, int size = -1, wxDataFormat format = wxDF_TEXT ) = 0;
virtual bool Execute(const wxString& str) { return Execute((char *)(const char *)str, -1, wxCF_TEXT); } virtual bool Execute(const wxString& str) { return Execute((char *)(const char *)str, -1, wxDF_TEXT); }
virtual char *Request(const wxString& item, int *size = NULL, int format = wxCF_TEXT) = 0; virtual char *Request(const wxString& item, int *size = NULL, wxDataFormat format = wxDF_TEXT) = 0;
virtual bool Poke(const wxString& item, char *data, int size = -1, int format = wxCF_TEXT) = 0; virtual bool Poke(const wxString& item, char *data, int size = -1, wxDataFormat format = wxDF_TEXT) = 0;
virtual bool StartAdvise(const wxString& item) = 0; virtual bool StartAdvise(const wxString& item) = 0;
virtual bool StopAdvise(const wxString& item) = 0; virtual bool StopAdvise(const wxString& item) = 0;
// Calls that SERVER can make // Calls that SERVER can make
virtual bool Advise(const wxString& item, char *data, int size = -1, int format = wxCF_TEXT) = 0; virtual bool Advise(const wxString& item, char *data, int size = -1, wxDataFormat format = wxDF_TEXT) = 0;
// Calls that both can make // Calls that both can make
virtual bool Disconnect(void) = 0; virtual bool Disconnect(void) = 0;

View File

@@ -135,7 +135,7 @@ wxObject* WXDLLEXPORT_CTORFN wxConstructorFor##name(void) \
#endif #endif
#define IS_KIND_OF(obj, className) obj->IsKindOf(&className::class##name) #define IS_KIND_OF(obj, className) obj->IsKindOf(&className::class##className)
// Unfortunately Borland seems to need this include. // Unfortunately Borland seems to need this include.
#ifdef __BORLANDC__ #ifdef __BORLANDC__

View File

@@ -5,7 +5,7 @@
# The file that contains palette entries for a global palette for all Imlib # The file that contains palette entries for a global palette for all Imlib
# based programs. # based programs.
# options: full path to palette file # options: full path to palette file
PaletteFile /etc/im_palette.pal PaletteFile ~/im_palette.pal
# This defines if when the display is greater than 8 bit, that it still remaps # This defines if when the display is greater than 8 bit, that it still remaps
# the images to the palette defined, rather than using "perfect" rendering # the images to the palette defined, rather than using "perfect" rendering
# options: yes/no # options: yes/no

1
samples/dnd/Makefile Normal file
View File

@@ -0,0 +1 @@
include ../../src/gtk/setup/general/makeapp

26
samples/dnd/Makefile.in Normal file
View File

@@ -0,0 +1,26 @@
# WXXT base directory
WXBASEDIR=@WXBASEDIR@
# set the OS type for compilation
OS=@OS@
# compile a library only
RULE=bin
# define library name
BIN_TARGET=dnd
# define library sources
BIN_SRC=\
dnd.cpp
#define library objects
BIN_OBJ=\
dnd.o
# additional things needed to link
BIN_LINK=
# additional things needed to compile
ADD_COMPILE=
# include the definitions now
include ../../../template.mak

View File

@@ -138,8 +138,12 @@ DnDFrame::DnDFrame(wxFrame *frame, char *title, int x, int y, int w, int h)
m_strText("wxWindows drag & drop works :-)") m_strText("wxWindows drag & drop works :-)")
{ {
#ifdef __WXMSW__
// frame icon and status bar // frame icon and status bar
SetIcon(wxIcon("mondrian")); SetIcon(wxIcon("mondrian"));
#endif
const int widths[] = { -1 }; const int widths[] = { -1 };
CreateStatusBar(); CreateStatusBar();
@@ -172,6 +176,7 @@ DnDFrame::DnDFrame(wxFrame *frame, char *title, int x, int y, int w, int h)
m_ctrlFile = new wxListBox(this, -1, pos, size, 1, &strFile, wxLB_HSCROLL); m_ctrlFile = new wxListBox(this, -1, pos, size, 1, &strFile, wxLB_HSCROLL);
m_ctrlText = new wxListBox(this, -1, pos, size, 1, &strText, wxLB_HSCROLL); m_ctrlText = new wxListBox(this, -1, pos, size, 1, &strText, wxLB_HSCROLL);
m_ctrlLog = new wxTextCtrl(this, -1, "", pos, size, m_ctrlLog = new wxTextCtrl(this, -1, "", pos, size,
wxTE_MULTILINE | wxTE_READONLY | wxTE_MULTILINE | wxTE_READONLY |
wxSUNKEN_BORDER| wxHSCROLL); wxSUNKEN_BORDER| wxHSCROLL);
@@ -181,7 +186,7 @@ DnDFrame::DnDFrame(wxFrame *frame, char *title, int x, int y, int w, int h)
m_pLogPrev = wxLog::SetActiveTarget(m_pLog); m_pLogPrev = wxLog::SetActiveTarget(m_pLog);
// associate drop targets with 2 text controls // associate drop targets with 2 text controls
m_ctrlFile->SetDropTarget(new DnDFile(m_ctrlFile)); // m_ctrlFile->SetDropTarget(new DnDFile(m_ctrlFile));
m_ctrlText->SetDropTarget(new DnDText(m_ctrlText)); m_ctrlText->SetDropTarget(new DnDText(m_ctrlText));
wxLayoutConstraints *c; wxLayoutConstraints *c;
@@ -274,7 +279,7 @@ void DnDFrame::OnHelp(wxCommandEvent& /* event */)
dialog.ShowModal(); dialog.ShowModal();
} }
void DnDFrame::OnLogClear(wxCommandEvent& event) void DnDFrame::OnLogClear(wxCommandEvent& /* event */ )
{ {
m_ctrlLog->Clear(); m_ctrlLog->Clear();
} }
@@ -284,12 +289,12 @@ bool DnDFrame::OnClose()
return TRUE; return TRUE;
} }
void DnDFrame::OnMouseBtnDown(wxMouseEvent& event) void DnDFrame::OnMouseBtnDown(wxMouseEvent& /* event */ )
{ {
if ( !m_strText.IsEmpty() ) { if ( !m_strText.IsEmpty() ) {
// start drag operation // start drag operation
wxTextDataObject data(m_strText); wxTextDataObject data(m_strText);
wxDropSource dragSource(data); wxDropSource dragSource(data, this);
const char *pc; const char *pc;
switch ( dragSource.DoDragDrop(TRUE) ) { switch ( dragSource.DoDragDrop(TRUE) ) {

View File

@@ -244,7 +244,7 @@ MyFrame::MyFrame(wxDocManager *manager, wxFrame *frame, const wxString& title,
editMenu = NULL; editMenu = NULL;
} }
void MyFrame::OnAbout(wxCommandEvent& event) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) )
{ {
(void)wxMessageBox("DocView Demo\nAuthor: Julian Smart julian.smart@ukonline.co.uk\nUsage: docview.exe [-single]", "About DocView"); (void)wxMessageBox("DocView Demo\nAuthor: Julian Smart julian.smart@ukonline.co.uk\nUsage: docview.exe [-single]", "About DocView");
} }

View File

@@ -44,7 +44,7 @@ END_EVENT_TABLE()
// What to do when a view is created. Creates actual // What to do when a view is created. Creates actual
// windows for displaying the view. // windows for displaying the view.
bool DrawingView::OnCreate(wxDocument *doc, long flags) bool DrawingView::OnCreate(wxDocument *doc, long WXUNUSED(flags) )
{ {
if (!singleWindowMode) if (!singleWindowMode)
{ {
@@ -99,7 +99,7 @@ void DrawingView::OnDraw(wxDC *dc)
} }
} }
void DrawingView::OnUpdate(wxView *sender, wxObject *hint) void DrawingView::OnUpdate(wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint))
{ {
if (canvas) if (canvas)
canvas->Refresh(); canvas->Refresh();
@@ -147,7 +147,7 @@ bool DrawingView::OnClose(bool deleteWindow)
return TRUE; return TRUE;
} }
void DrawingView::OnCut(wxCommandEvent& event) void DrawingView::OnCut(wxCommandEvent& WXUNUSED(event) )
{ {
DrawingDocument *doc = (DrawingDocument *)GetDocument(); DrawingDocument *doc = (DrawingDocument *)GetDocument();
doc->GetCommandProcessor()->Submit(new DrawingCommand("Cut Last Segment", DOODLE_CUT, doc, NULL)); doc->GetCommandProcessor()->Submit(new DrawingCommand("Cut Last Segment", DOODLE_CUT, doc, NULL));
@@ -155,7 +155,7 @@ void DrawingView::OnCut(wxCommandEvent& event)
IMPLEMENT_DYNAMIC_CLASS(TextEditView, wxView) IMPLEMENT_DYNAMIC_CLASS(TextEditView, wxView)
bool TextEditView::OnCreate(wxDocument *doc, long flags) bool TextEditView::OnCreate(wxDocument *doc, long WXUNUSED(flags) )
{ {
frame = wxGetApp().CreateChildFrame(doc, this, FALSE); frame = wxGetApp().CreateChildFrame(doc, this, FALSE);
@@ -178,11 +178,11 @@ bool TextEditView::OnCreate(wxDocument *doc, long flags)
} }
// Handled by wxTextWindow // Handled by wxTextWindow
void TextEditView::OnDraw(wxDC *dc) void TextEditView::OnDraw(wxDC *WXUNUSED(dc) )
{ {
} }
void TextEditView::OnUpdate(wxView *sender, wxObject *hint) void TextEditView::OnUpdate(wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) )
{ {
} }
@@ -264,11 +264,13 @@ void MyCanvas::OnMouseEvent(wxMouseEvent& event)
currentSegment = new DoodleSegment; currentSegment = new DoodleSegment;
DoodleLine *newLine = new DoodleLine; DoodleLine *newLine = new DoodleLine;
newLine->x1 = xpos; newLine->y1 = ypos; newLine->x1 = (long)xpos;
newLine->x2 = pt.x; newLine->y2 = pt.y; newLine->y1 = (long)ypos;
newLine->x2 = pt.x;
newLine->y2 = pt.y;
currentSegment->lines.Append(newLine); currentSegment->lines.Append(newLine);
dc.DrawLine(xpos, ypos, pt.x, pt.y); dc.DrawLine( (long)xpos, (long)ypos, pt.x, pt.y);
} }
xpos = pt.x; xpos = pt.x;
ypos = pt.y; ypos = pt.y;

View File

@@ -79,8 +79,7 @@ bool MyApp::OnInit(void)
// Make a panel with a message // Make a panel with a message
wxPanel *panel = new wxPanel(frame, -1, wxPoint(0, 0), wxSize(400, 200), wxTAB_TRAVERSAL); wxPanel *panel = new wxPanel(frame, -1, wxPoint(0, 0), wxSize(400, 200), wxTAB_TRAVERSAL);
wxStaticText *msg = new wxStaticText(panel, 311, "Hello!", wxPoint(10, 10), wxSize(-1, -1), (void)new wxStaticText(panel, 311, "Hello!", wxPoint(10, 10), wxSize(-1, -1), 0);
0);
// Show the frame // Show the frame
frame->Show(TRUE); frame->Show(TRUE);

View File

@@ -109,6 +109,7 @@ void FortyCanvas::OnDraw(wxDC& dc)
m_game->DisplayScore(dc); m_game->DisplayScore(dc);
delete m_playerDialog; delete m_playerDialog;
m_playerDialog = 0; m_playerDialog = 0;
Refresh();
} }
else else
{ {

View File

@@ -11,12 +11,12 @@
// Last modified: 22nd July 1998 - ported to wxWindows 2.0 // Last modified: 22nd July 1998 - ported to wxWindows 2.0
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
//+-------------------------------------------------------------+ //+-------------------------------------------------------------+
//| Description: | //| Description
//| A class for drawing playing cards. | //| A class for drawing playing cards.
//| Currently assumes that the card symbols have been | //| Currently assumes that the card symbols have been
//| loaded into hbmap_symbols and the pictures for the | //| loaded into hbmap_symbols and the pictures for the
//| Jack, Queen and King have been loaded into | //| Jack, Queen and King have been loaded into
//| hbmap_pictures. | //| hbmap_pictures.
//+-------------------------------------------------------------+ //+-------------------------------------------------------------+
#ifdef __GNUG__ #ifdef __GNUG__

View File

@@ -41,6 +41,7 @@
#include "card.h" #include "card.h"
#include "pile.h" #include "pile.h"
#include "wx/app.h"
//+-------------------------------------------------------------+ //+-------------------------------------------------------------+
//| Pile::Pile() | //| Pile::Pile() |
@@ -72,12 +73,21 @@ Pile::Pile(int x, int y, int dx, int dy)
//| at the origin of the pile, shifting each subsequent | //| at the origin of the pile, shifting each subsequent |
//| card by the pile's x and y offsets. | //| card by the pile's x and y offsets. |
//+-------------------------------------------------------------+ //+-------------------------------------------------------------+
void Pile::Redraw(wxDC& dc) void Pile::Redraw(wxDC& dc )
{ {
wxWindow *frame = wxTheApp->GetTopWindow();
wxWindow *canvas = NULL;
if (frame)
{
wxNode *node = frame->GetChildren()->First();
if (node) canvas = (wxWindow*)node->Data();
}
if (m_topCard >= 0) if (m_topCard >= 0)
{ {
if (m_dx == 0 && m_dy == 0) if (m_dx == 0 && m_dy == 0)
{ {
if ((canvas) && (canvas->IsExposed(m_x,m_y,60,200)))
m_cards[m_topCard]->Draw(dc, m_x, m_y); m_cards[m_topCard]->Draw(dc, m_x, m_y);
} }
else else
@@ -86,6 +96,7 @@ void Pile::Redraw(wxDC& dc)
int y = m_y; int y = m_y;
for (int i = 0; i <= m_topCard; i++) for (int i = 0; i <= m_topCard; i++)
{ {
if ((canvas) && (canvas->IsExposed(x,y,60,200)))
m_cards[i]->Draw(dc, x, y); m_cards[i]->Draw(dc, x, y);
x += m_dx; x += m_dx;
y += m_dy; y += m_dy;
@@ -94,6 +105,7 @@ void Pile::Redraw(wxDC& dc)
} }
else else
{ {
if ((canvas) && (canvas->IsExposed(m_x,m_y,60,200)))
Card::DrawNullCard(dc, m_x, m_y); Card::DrawNullCard(dc, m_x, m_y);
} }
} }

View File

@@ -102,20 +102,20 @@ MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, c
InitToolBar(GetToolBar()); InitToolBar(GetToolBar());
} }
void MyFrame::OnQuit(wxCommandEvent& event) void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event) )
{ {
Close(TRUE); Close(TRUE);
} }
void MyFrame::OnAbout(wxCommandEvent& event) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) )
{ {
(void)wxMessageBox("wxWindows 2.0 MDI Demo\nAuthor: Julian Smart (c) 1997\nUsage: mdi.exe", "About MDI Demo"); (void)wxMessageBox("wxWindows 2.0 MDI Demo\nAuthor: Julian Smart (c) 1997\nUsage: mdi.exe", "About MDI Demo");
} }
void MyFrame::OnNewWindow(wxCommandEvent& event) void MyFrame::OnNewWindow(wxCommandEvent& WXUNUSED(event) )
{ {
// Make another frame, containing a canvas // Make another frame, containing a canvas
MyChild *subframe = new MyChild(frame, "Canvas Frame", wxPoint(10, 10), wxSize(300, 300), MyChild *subframe = new MyChild(frame, "Canvas Frame", wxPoint(4, 4), wxSize(100, 100),
wxDEFAULT_FRAME); wxDEFAULT_FRAME);
char titleBuf[100]; char titleBuf[100];
@@ -241,12 +241,10 @@ bool MyFrame::OnClose(void)
return TRUE; return TRUE;
} }
void MyFrame::OnSize(wxSizeEvent& event) void MyFrame::OnSize(wxSizeEvent& WXUNUSED(event) )
{ {
int w, h; int w, h;
GetClientSize(&w, &h); GetClientSize(&w, &h);
int tw = 0;
int th = 0;
textWindow->SetSize(0, 0, 200, h); textWindow->SetSize(0, 0, 200, h);
GetClientWindow()->SetSize(200, 0, w - 200, h); GetClientWindow()->SetSize(200, 0, w - 200, h);
@@ -318,7 +316,6 @@ void MyFrame::InitToolBar(wxToolBar* toolBar)
#else #else
int width = 16; int width = 16;
#endif #endif
int offX = 5;
int currentX = 5; int currentX = 5;
toolBar->AddTool(0, *bitmaps[0], wxNullBitmap, FALSE, currentX, -1, NULL, "New file"); toolBar->AddTool(0, *bitmaps[0], wxNullBitmap, FALSE, currentX, -1, NULL, "New file");

View File

@@ -28,7 +28,7 @@
#include "wx/date.h" #include "wx/date.h"
#if !WXDEBUG #if !WXDEBUG
#error You must set WXDEBUG to 1 on the 'make' command line or make.env. #error You must set WXDEBUG to 1 on the 'make' command line (MSW) or with configure (GTK)
#endif #endif
// #define new WXDEBUG_NEW // #define new WXDEBUG_NEW

View File

@@ -84,8 +84,7 @@ bool MyApp::OnInit(void)
// Make a panel with a message // Make a panel with a message
wxPanel *panel = new wxPanel(frame, -1, wxPoint(0, 0), wxSize(400, 200), wxTAB_TRAVERSAL); wxPanel *panel = new wxPanel(frame, -1, wxPoint(0, 0), wxSize(400, 200), wxTAB_TRAVERSAL);
wxStaticText *msg = new wxStaticText(panel, 311, "Hello!", wxPoint(10, 10), wxSize(-1, -1), (void)new wxStaticText(panel, 311, "Hello!", wxPoint(10, 10), wxSize(-1, -1), 0);
0);
// Show the frame // Show the frame
frame->Show(TRUE); frame->Show(TRUE);

View File

@@ -89,18 +89,18 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, cons
canvas = NULL; canvas = NULL;
} }
void MyFrame::OnQuit(wxCommandEvent& event) void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{ {
Close(TRUE); Close(TRUE);
} }
void MyFrame::OnAbout(wxCommandEvent& event) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ {
(void)wxMessageBox("PNG demo\nJulian Smart (c) 1998", (void)wxMessageBox("PNG demo\nJulian Smart (c) 1998",
"About PNG Demo", wxOK); "About PNG Demo", wxOK);
} }
void MyFrame::OnLoadFile(wxCommandEvent& event) void MyFrame::OnLoadFile(wxCommandEvent& WXUNUSED(event))
{ {
// Show file selector. // Show file selector.
char *f = wxFileSelector("Open Image", NULL, NULL,"png", char *f = wxFileSelector("Open Image", NULL, NULL,"png",
@@ -136,7 +136,7 @@ MyCanvas::~MyCanvas(void)
} }
// Define the repainting behaviour // Define the repainting behaviour
void MyCanvas::OnPaint(wxPaintEvent& event) void MyCanvas::OnPaint(wxPaintEvent& WXUNUSED(event))
{ {
wxPaintDC dc(this); wxPaintDC dc(this);
dc.SetPen(wxRED_PEN); dc.SetPen(wxRED_PEN);

View File

@@ -159,12 +159,12 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, cons
canvas = NULL; canvas = NULL;
} }
void MyFrame::OnExit(wxCommandEvent& event) void MyFrame::OnExit(wxCommandEvent& WXUNUSED(event))
{ {
Close(TRUE); Close(TRUE);
} }
void MyFrame::OnPrint(wxCommandEvent& event) void MyFrame::OnPrint(wxCommandEvent& WXUNUSED(event))
{ {
#ifdef __WXMSW__ #ifdef __WXMSW__
wxGetApp().SetPrintMode(wxPRINT_WINDOWS); wxGetApp().SetPrintMode(wxPRINT_WINDOWS);
@@ -177,7 +177,7 @@ void MyFrame::OnPrint(wxCommandEvent& event)
wxMessageBox("There was a problem printing.\nPerhaps your current printer is not set correctly?", "Printing", wxOK); wxMessageBox("There was a problem printing.\nPerhaps your current printer is not set correctly?", "Printing", wxOK);
} }
void MyFrame::OnPrintPS(wxCommandEvent& event) void MyFrame::OnPrintPS(wxCommandEvent& WXUNUSED(event))
{ {
wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT); wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT);
@@ -186,7 +186,7 @@ void MyFrame::OnPrintPS(wxCommandEvent& event)
printer.Print(this, &printout, TRUE); printer.Print(this, &printout, TRUE);
} }
void MyFrame::OnPrintPreview(wxCommandEvent& event) void MyFrame::OnPrintPreview(wxCommandEvent& WXUNUSED(event))
{ {
#ifdef __WXMSW__ #ifdef __WXMSW__
wxGetApp().SetPrintMode(wxPRINT_WINDOWS); wxGetApp().SetPrintMode(wxPRINT_WINDOWS);
@@ -211,7 +211,7 @@ void MyFrame::OnPrintPreview(wxCommandEvent& event)
frame->Show(TRUE); frame->Show(TRUE);
} }
void MyFrame::OnPrintPreviewPS(wxCommandEvent& event) void MyFrame::OnPrintPreviewPS(wxCommandEvent& WXUNUSED(event))
{ {
wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT); wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT);
@@ -226,7 +226,7 @@ void MyFrame::OnPrintPreviewPS(wxCommandEvent& event)
frame->Show(TRUE); frame->Show(TRUE);
} }
void MyFrame::OnPrintSetup(wxCommandEvent& event) void MyFrame::OnPrintSetup(wxCommandEvent& WXUNUSED(event))
{ {
#ifdef __WXMSW__ #ifdef __WXMSW__
wxGetApp().SetPrintMode(wxPRINT_WINDOWS); wxGetApp().SetPrintMode(wxPRINT_WINDOWS);
@@ -247,7 +247,7 @@ void MyFrame::OnPrintSetup(wxCommandEvent& event)
orientation = printerDialog.GetPrintData().GetOrientation(); orientation = printerDialog.GetPrintData().GetOrientation();
} }
void MyFrame::OnPageSetup(wxCommandEvent& event) void MyFrame::OnPageSetup(wxCommandEvent& WXUNUSED(event))
{ {
#ifdef __WXMSW__ #ifdef __WXMSW__
wxGetApp().SetPrintMode(wxPRINT_WINDOWS); wxGetApp().SetPrintMode(wxPRINT_WINDOWS);
@@ -268,7 +268,7 @@ void MyFrame::OnPageSetup(wxCommandEvent& event)
orientation = data.GetOrientation(); orientation = data.GetOrientation();
} }
void MyFrame::OnPrintSetupPS(wxCommandEvent& event) void MyFrame::OnPrintSetupPS(wxCommandEvent& WXUNUSED(event))
{ {
wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT); wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT);
@@ -282,7 +282,7 @@ void MyFrame::OnPrintSetupPS(wxCommandEvent& event)
orientation = printerDialog.GetPrintData().GetOrientation(); orientation = printerDialog.GetPrintData().GetOrientation();
} }
void MyFrame::OnPageSetupPS(wxCommandEvent& event) void MyFrame::OnPageSetupPS(wxCommandEvent& WXUNUSED(event))
{ {
wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT); wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT);
@@ -295,7 +295,7 @@ void MyFrame::OnPageSetupPS(wxCommandEvent& event)
orientation = pageSetupDialog.GetPageSetupData().GetOrientation(); orientation = pageSetupDialog.GetPageSetupData().GetOrientation();
} }
void MyFrame::OnPrintAbout(wxCommandEvent& event) void MyFrame::OnPrintAbout(wxCommandEvent& WXUNUSED(event))
{ {
(void)wxMessageBox("wxWindows printing demo\nAuthor: Julian Smart julian.smart@ukonline.co.uk", (void)wxMessageBox("wxWindows printing demo\nAuthor: Julian Smart julian.smart@ukonline.co.uk",
"About wxWindows printing demo", wxOK|wxCENTRE); "About wxWindows printing demo", wxOK|wxCENTRE);
@@ -309,19 +309,19 @@ void MyFrame::Draw(wxDC& dc)
dc.SetBrush(wxCYAN_BRUSH); dc.SetBrush(wxCYAN_BRUSH);
dc.SetPen(wxRED_PEN); dc.SetPen(wxRED_PEN);
dc.DrawRectangle(0.0, 30.0, 200.0, 100.0); dc.DrawRectangle(0, 30, 200, 100);
dc.DrawText("Rectangle 200 by 100", 40.0, 40.0); dc.DrawText("Rectangle 200 by 100", 40, 40);
dc.DrawEllipse(50.0, 140.0, 100.0, 50.0); dc.DrawEllipse(50, 140, 100, 50);
dc.DrawText("Test message: this is in 11 point text", 10.0, 180.0); dc.DrawText("Test message: this is in 11 point text", 10, 180);
dc.SetPen(wxBLACK_PEN); dc.SetPen(wxBLACK_PEN);
dc.DrawLine(0.0, 0.0, 200.0, 200.0); dc.DrawLine(0, 0, 200, 200);
dc.DrawLine(200.0, 0.0, 0.0, 200.0); dc.DrawLine(200, 0, 0, 200);
} }
void MyFrame::OnSize(wxSizeEvent& event) void MyFrame::OnSize(wxSizeEvent& event )
{ {
wxFrame::OnSize(event); wxFrame::OnSize(event);
} }
@@ -346,7 +346,7 @@ void MyCanvas::OnDraw(wxDC& dc)
frame->Draw(dc); frame->Draw(dc);
} }
void MyCanvas::OnEvent(wxMouseEvent& event) void MyCanvas::OnEvent(wxMouseEvent& WXUNUSED(event))
{ {
} }
@@ -373,7 +373,7 @@ bool MyPrintout::OnPrintPage(int page)
char buf[200]; char buf[200];
sprintf(buf, "PAGE %d", page); sprintf(buf, "PAGE %d", page);
dc->DrawText(buf, 10.0, 10.0); dc->DrawText(buf, 10, 10);
return TRUE; return TRUE;
} }
@@ -438,7 +438,7 @@ void MyPrintout::DrawPageOne(wxDC *dc)
// Set the scale and origin // Set the scale and origin
dc->SetUserScale(actualScale, actualScale); dc->SetUserScale(actualScale, actualScale);
dc->SetDeviceOrigin(posX, posY); dc->SetDeviceOrigin( (long)posX, (long)posY );
frame->Draw(*dc); frame->Draw(*dc);
} }
@@ -486,13 +486,13 @@ void MyPrintout::DrawPageTwo(wxDC *dc)
float logUnitsFactor = (float)(ppiPrinterX/(scale*25.1)); float logUnitsFactor = (float)(ppiPrinterX/(scale*25.1));
float logUnits = (float)(50*logUnitsFactor); float logUnits = (float)(50*logUnitsFactor);
dc->SetPen(wxBLACK_PEN); dc->SetPen(wxBLACK_PEN);
dc->DrawLine(50.0, 50.0, (float)(50.0 + logUnits), 50.0); dc->DrawLine(50, 50, (long)(50.0 + logUnits), 50);
dc->DrawLine(50.0, 50.0, 50.0, (float)(50.0 + logUnits)); dc->DrawLine(50, 50, 50, (long)(50.0 + logUnits));
dc->SetFont(itemFont); dc->SetFont(itemFont);
dc->SetBackgroundMode(wxTRANSPARENT); dc->SetBackgroundMode(wxTRANSPARENT);
dc->DrawText("Some test text", 200.0, 200.0); dc->DrawText("Some test text", 200, 200 );
// TESTING // TESTING
@@ -510,8 +510,10 @@ void MyPrintout::DrawPageTwo(wxDC *dc)
float rightMarginLogical = (float)(logUnitsFactor*(pageWidthMM - rightMargin)); float rightMarginLogical = (float)(logUnitsFactor*(pageWidthMM - rightMargin));
dc->SetPen(wxBLACK_PEN); dc->SetPen(wxBLACK_PEN);
dc->DrawLine(leftMarginLogical, topMarginLogical, rightMarginLogical, topMarginLogical); dc->DrawLine( (long)leftMarginLogical, (long)topMarginLogical,
dc->DrawLine(leftMarginLogical, bottomMarginLogical, rightMarginLogical, bottomMarginLogical); (long)rightMarginLogical, (long)topMarginLogical);
dc->DrawLine( (long)leftMarginLogical, (long)bottomMarginLogical,
(long)rightMarginLogical, (long)bottomMarginLogical);
WritePageHeader(this, dc, "A header", logUnitsFactor); WritePageHeader(this, dc, "A header", logUnitsFactor);
} }
@@ -541,10 +543,11 @@ bool WritePageHeader(wxPrintout *printout, wxDC *dc, char *text, float mmToLogic
long xExtent, yExtent; long xExtent, yExtent;
dc->GetTextExtent(text, &xExtent, &yExtent); dc->GetTextExtent(text, &xExtent, &yExtent);
float xPos = (float)(((((pageWidthMM - leftMargin - rightMargin)/2.0)+leftMargin)*mmToLogical) - (xExtent/2.0)); float xPos = (float)(((((pageWidthMM - leftMargin - rightMargin)/2.0)+leftMargin)*mmToLogical) - (xExtent/2.0));
dc->DrawText(text, (long)xPos, topMarginLogical); dc->DrawText(text, (long)xPos, (long)topMarginLogical);
dc->SetPen(wxBLACK_PEN); dc->SetPen(wxBLACK_PEN);
dc->DrawLine(leftMarginLogical, topMarginLogical+yExtent, rightMarginLogical, topMarginLogical+yExtent); dc->DrawLine( (long)leftMarginLogical, (long)(topMarginLogical+yExtent),
(long)rightMarginLogical, (long)topMarginLogical+yExtent );
return TRUE; return TRUE;
} }

View File

@@ -163,12 +163,12 @@ bool MyFrame::OnClose()
return TRUE; return TRUE;
} }
void MyFrame::Quit(wxCommandEvent& event) void MyFrame::Quit(wxCommandEvent& WXUNUSED(event) )
{ {
Close(TRUE); Close(TRUE);
} }
void MyFrame::SplitHorizontal(wxCommandEvent& event) void MyFrame::SplitHorizontal(wxCommandEvent& WXUNUSED(event) )
{ {
if ( splitter->IsSplit() ) if ( splitter->IsSplit() )
splitter->Unsplit(); splitter->Unsplit();
@@ -177,7 +177,7 @@ void MyFrame::SplitHorizontal(wxCommandEvent& event)
splitter->SplitHorizontally( leftCanvas, rightCanvas ); splitter->SplitHorizontally( leftCanvas, rightCanvas );
} }
void MyFrame::SplitVertical(wxCommandEvent& event) void MyFrame::SplitVertical(wxCommandEvent& WXUNUSED(event) )
{ {
if ( splitter->IsSplit() ) if ( splitter->IsSplit() )
splitter->Unsplit(); splitter->Unsplit();
@@ -186,7 +186,7 @@ void MyFrame::SplitVertical(wxCommandEvent& event)
splitter->SplitVertically( leftCanvas, rightCanvas ); splitter->SplitVertically( leftCanvas, rightCanvas );
} }
void MyFrame::Unsplit(wxCommandEvent& event) void MyFrame::Unsplit(wxCommandEvent& WXUNUSED(event) )
{ {
if ( splitter->IsSplit() ) if ( splitter->IsSplit() )
splitter->Unsplit(); splitter->Unsplit();

View File

@@ -52,12 +52,12 @@ MyDialog::MyDialog(wxWindow* parent, const wxWindowID id, const wxString& title,
Init(); Init();
} }
void MyDialog::OnOK(wxCommandEvent& event) void MyDialog::OnOK(wxCommandEvent& WXUNUSED(event) )
{ {
EndModal(wxID_OK); EndModal(wxID_OK);
} }
void MyDialog::OnCloseWindow(wxCloseEvent& event) void MyDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event) )
{ {
EndModal(wxID_CANCEL); EndModal(wxID_CANCEL);
} }
@@ -68,8 +68,8 @@ void MyDialog::Init(void)
int dialogHeight = 390; int dialogHeight = 390;
wxButton *okButton = new wxButton(this, wxID_OK, "Close", wxPoint(100, 330), wxSize(80, 25)); wxButton *okButton = new wxButton(this, wxID_OK, "Close", wxPoint(100, 330), wxSize(80, 25));
wxButton *cancelButton = new wxButton(this, wxID_CANCEL, "Cancel", wxPoint(185, 330), wxSize(80, 25)); (void)new wxButton(this, wxID_CANCEL, "Cancel", wxPoint(185, 330), wxSize(80, 25));
wxButton *HelpButton = new wxButton(this, wxID_HELP, "Help", wxPoint(270, 330), wxSize(80, 25)); (void)new wxButton(this, wxID_HELP, "Help", wxPoint(270, 330), wxSize(80, 25));
okButton->SetDefault(); okButton->SetDefault();
// Note, omit the wxTAB_STYLE_COLOUR_INTERIOR, so we will guarantee a match // Note, omit the wxTAB_STYLE_COLOUR_INTERIOR, so we will guarantee a match
@@ -136,7 +136,7 @@ void MyDialog::Init(void)
view->AddTabWindow(TEST_TAB_DOG, panel2); view->AddTabWindow(TEST_TAB_DOG, panel2);
// Don't know why this is necessary under Motif... // Don't know why this is necessary under Motif...
#ifdef wx_motif #ifndef __WXMSW__
this->SetSize(dialogWidth, dialogHeight-20); this->SetSize(dialogWidth, dialogHeight-20);
#endif #endif

View File

@@ -157,7 +157,7 @@ MyFrame::MyFrame(wxFrame *frame, char *title, int x, int y, int w, int h):
wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h)) wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h))
{} {}
void MyFrame::OnStartThread(wxCommandEvent& event) void MyFrame::OnStartThread(wxCommandEvent& WXUNUSED(event) )
{ {
MyThread *thread = new MyThread(this); MyThread *thread = new MyThread(this);
@@ -166,9 +166,9 @@ void MyFrame::OnStartThread(wxCommandEvent& event)
m_threads.Add(thread); m_threads.Add(thread);
} }
void MyFrame::OnStopThread(wxCommandEvent& event) void MyFrame::OnStopThread(wxCommandEvent& WXUNUSED(event) )
{ {
uint no_thrd = m_threads.Count()-1; int no_thrd = m_threads.Count()-1;
if (no_thrd < 0) if (no_thrd < 0)
return; return;
@@ -177,10 +177,10 @@ void MyFrame::OnStopThread(wxCommandEvent& event)
m_threads.Remove(no_thrd); m_threads.Remove(no_thrd);
} }
void MyFrame::OnPauseThread(wxCommandEvent& event) void MyFrame::OnPauseThread(wxCommandEvent& WXUNUSED(event) )
{} {}
void MyFrame::OnQuit(wxCommandEvent& event) void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event) )
{ {
uint i; uint i;
for (i=0;i<m_threads.Count();i++) for (i=0;i<m_threads.Count();i++)
@@ -188,7 +188,7 @@ void MyFrame::OnQuit(wxCommandEvent& event)
Close(TRUE); Close(TRUE);
} }
void MyFrame::OnAbout(wxCommandEvent& event) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) )
{ {
wxMessageDialog dialog(this, "wxThread sample (based on minimal)\nJulian Smart and Guilhem Lavaux", wxMessageDialog dialog(this, "wxThread sample (based on minimal)\nJulian Smart and Guilhem Lavaux",
"About wxThread sample", wxYES_NO|wxCANCEL); "About wxThread sample", wxYES_NO|wxCANCEL);

1
samples/toolbar/Makefile Normal file
View File

@@ -0,0 +1 @@
include ../../src/gtk/setup/general/makeapp

View File

@@ -0,0 +1,26 @@
# WXXT base directory
WXBASEDIR=@WXBASEDIR@
# set the OS type for compilation
OS=@OS@
# compile a library only
RULE=bin
# define library name
BIN_TARGET=test
# define library sources
BIN_SRC=\
test.cpp
#define library objects
BIN_OBJ=\
test.o
# additional things needed to link
BIN_LINK=
# additional things needed to compile
ADD_COMPILE=
# include the definitions now
include ../../../template.mak

View File

@@ -163,12 +163,12 @@ MyFrame::~MyFrame(void)
delete wxGetApp().m_imageListNormal; delete wxGetApp().m_imageListNormal;
} }
void MyFrame::OnQuit(wxCommandEvent& event) void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event) )
{ {
Close(TRUE); Close(TRUE);
} }
void MyFrame::OnAbout(wxCommandEvent& event) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) )
{ {
wxMessageDialog dialog(this, "Tree test sample\nJulian Smart (c) 1997", wxMessageDialog dialog(this, "Tree test sample\nJulian Smart (c) 1997",
"About tree test", wxOK|wxCANCEL); "About tree test", wxOK|wxCANCEL);
@@ -178,7 +178,7 @@ void MyFrame::OnAbout(wxCommandEvent& event)
// MyTreeCtrl // MyTreeCtrl
void MyTreeCtrl::OnBeginDrag(wxTreeEvent& event) void MyTreeCtrl::OnBeginDrag(wxTreeEvent& WXUNUSED(event) )
{ {
if ( !wxGetApp().GetTopWindow() ) if ( !wxGetApp().GetTopWindow() )
return; return;
@@ -195,7 +195,7 @@ void MyTreeCtrl::OnBeginDrag(wxTreeEvent& event)
#endif #endif
} }
void MyTreeCtrl::OnBeginRDrag(wxTreeEvent& event) void MyTreeCtrl::OnBeginRDrag(wxTreeEvent& WXUNUSED(event) )
{ {
if ( !wxGetApp().GetTopWindow() ) if ( !wxGetApp().GetTopWindow() )
return; return;
@@ -212,7 +212,7 @@ void MyTreeCtrl::OnBeginRDrag(wxTreeEvent& event)
#endif #endif
} }
void MyTreeCtrl::OnBeginLabelEdit(wxTreeEvent& event) void MyTreeCtrl::OnBeginLabelEdit(wxTreeEvent& WXUNUSED(event) )
{ {
if ( !wxGetApp().GetTopWindow() ) if ( !wxGetApp().GetTopWindow() )
return; return;
@@ -229,7 +229,7 @@ void MyTreeCtrl::OnBeginLabelEdit(wxTreeEvent& event)
#endif #endif
} }
void MyTreeCtrl::OnEndLabelEdit(wxTreeEvent& event) void MyTreeCtrl::OnEndLabelEdit(wxTreeEvent& WXUNUSED(event) )
{ {
if ( !wxGetApp().GetTopWindow() ) if ( !wxGetApp().GetTopWindow() )
return; return;
@@ -246,7 +246,7 @@ void MyTreeCtrl::OnEndLabelEdit(wxTreeEvent& event)
#endif #endif
} }
void MyTreeCtrl::OnDeleteItem(wxTreeEvent& event) void MyTreeCtrl::OnDeleteItem(wxTreeEvent& WXUNUSED(event) )
{ {
if ( !wxGetApp().GetTopWindow() ) if ( !wxGetApp().GetTopWindow() )
return; return;
@@ -263,7 +263,7 @@ void MyTreeCtrl::OnDeleteItem(wxTreeEvent& event)
#endif #endif
} }
void MyTreeCtrl::OnGetInfo(wxTreeEvent& event) void MyTreeCtrl::OnGetInfo(wxTreeEvent& WXUNUSED(event) )
{ {
if ( !wxGetApp().GetTopWindow() ) if ( !wxGetApp().GetTopWindow() )
return; return;
@@ -280,7 +280,7 @@ void MyTreeCtrl::OnGetInfo(wxTreeEvent& event)
#endif #endif
} }
void MyTreeCtrl::OnSetInfo(wxTreeEvent& event) void MyTreeCtrl::OnSetInfo(wxTreeEvent& WXUNUSED(event) )
{ {
if ( !wxGetApp().GetTopWindow() ) if ( !wxGetApp().GetTopWindow() )
return; return;
@@ -297,7 +297,7 @@ void MyTreeCtrl::OnSetInfo(wxTreeEvent& event)
#endif #endif
} }
void MyTreeCtrl::OnItemExpanded(wxTreeEvent& event) void MyTreeCtrl::OnItemExpanded(wxTreeEvent& WXUNUSED(event) )
{ {
if ( !wxGetApp().GetTopWindow() ) if ( !wxGetApp().GetTopWindow() )
return; return;
@@ -314,7 +314,7 @@ void MyTreeCtrl::OnItemExpanded(wxTreeEvent& event)
#endif #endif
} }
void MyTreeCtrl::OnItemExpanding(wxTreeEvent& event) void MyTreeCtrl::OnItemExpanding(wxTreeEvent& WXUNUSED(event) )
{ {
if ( !wxGetApp().GetTopWindow() ) if ( !wxGetApp().GetTopWindow() )
return; return;
@@ -331,7 +331,7 @@ void MyTreeCtrl::OnItemExpanding(wxTreeEvent& event)
#endif #endif
} }
void MyTreeCtrl::OnSelChanged(wxTreeEvent& event) void MyTreeCtrl::OnSelChanged(wxTreeEvent& WXUNUSED(event) )
{ {
if ( !wxGetApp().GetTopWindow() ) if ( !wxGetApp().GetTopWindow() )
return; return;
@@ -348,7 +348,7 @@ void MyTreeCtrl::OnSelChanged(wxTreeEvent& event)
#endif #endif
} }
void MyTreeCtrl::OnSelChanging(wxTreeEvent& event) void MyTreeCtrl::OnSelChanging(wxTreeEvent& WXUNUSED(event) )
{ {
if ( !wxGetApp().GetTopWindow() ) if ( !wxGetApp().GetTopWindow() )
return; return;
@@ -365,7 +365,7 @@ void MyTreeCtrl::OnSelChanging(wxTreeEvent& event)
#endif #endif
} }
void MyTreeCtrl::OnKeyDown(wxTreeEvent& event) void MyTreeCtrl::OnKeyDown(wxTreeEvent& WXUNUSED(event) )
{ {
if ( !wxGetApp().GetTopWindow() ) if ( !wxGetApp().GetTopWindow() )
return; return;

View File

@@ -17,7 +17,7 @@
#include <wx/stream.h> #include <wx/stream.h>
#include <wx/zstream.h> #include <wx/zstream.h>
#include <wx/utils.h> #include <wx/utils.h>
#include "zlib.h" #include "../zlib/zlib.h" // don't change this, Robert
#ifdef __BORLANDC__ #ifdef __BORLANDC__
#pragma hdrstop #pragma hdrstop

View File

@@ -485,7 +485,7 @@ void wxGenericGrid::PaintGrid(wxDC& dc)
// Erase (some of) the background. // Erase (some of) the background.
// Currently, a Windows-only optimisation. // Currently, a Windows-only optimisation.
void wxGenericGrid::OnEraseBackground(wxEraseEvent& event) void wxGenericGrid::OnEraseBackground(wxEraseEvent& WXUNUSED(event) )
{ {
wxClientDC dc(this); wxClientDC dc(this);
dc.BeginDrawing(); dc.BeginDrawing();

View File

@@ -439,7 +439,7 @@ long wxListLineData::IsHit( int x, int y )
wxListItemData *item = (wxListItemData*)node->Data(); wxListItemData *item = (wxListItemData*)node->Data();
if (item->HasImage() && IsInRect( x, y, m_bound_icon )) return wxLIST_HITTEST_ONITEMICON; if (item->HasImage() && IsInRect( x, y, m_bound_icon )) return wxLIST_HITTEST_ONITEMICON;
if (item->HasText() && IsInRect( x, y, m_bound_label )) return wxLIST_HITTEST_ONITEMLABEL; if (item->HasText() && IsInRect( x, y, m_bound_label )) return wxLIST_HITTEST_ONITEMLABEL;
if (!(item->HasImage() || item->HasText())) return 0; // if (!(item->HasImage() || item->HasText())) return 0;
}; };
// if there is no icon or text = empty // if there is no icon or text = empty
if (IsInRect( x, y, m_bound_all )) return wxLIST_HITTEST_ONITEMICON; if (IsInRect( x, y, m_bound_all )) return wxLIST_HITTEST_ONITEMICON;
@@ -806,7 +806,7 @@ wxListMainWindow::wxListMainWindow( void )
m_lastOnSame = FALSE; m_lastOnSame = FALSE;
// m_renameTimer = new wxRenameTimer( this ); // m_renameTimer = new wxRenameTimer( this );
m_isCreated = FALSE; m_isCreated = FALSE;
m_isDragging = FALSE; m_dragCount = 0;
}; };
wxListMainWindow::wxListMainWindow( wxWindow *parent, wxWindowID id, wxListMainWindow::wxListMainWindow( wxWindow *parent, wxWindowID id,
@@ -828,7 +828,7 @@ wxListMainWindow::wxListMainWindow( wxWindow *parent, wxWindowID id,
// AllowDoubleClick( TRUE ); // AllowDoubleClick( TRUE );
m_myFont = wxNORMAL_FONT; m_myFont = wxNORMAL_FONT;
m_hasFocus = FALSE; m_hasFocus = FALSE;
m_isDragging = FALSE; m_dragCount = 0;
m_isCreated = FALSE; m_isCreated = FALSE;
wxSize sz = size; wxSize sz = size;
sz.y = 25; sz.y = 25;
@@ -1032,9 +1032,10 @@ void wxListMainWindow::OnRenameAccept()
void wxListMainWindow::OnMouse( wxMouseEvent &event ) void wxListMainWindow::OnMouse( wxMouseEvent &event )
{ {
if (m_parent->ProcessEvent( event)) return;
if (!m_current) return; if (!m_current) return;
if (m_dirty) return; if (m_dirty) return;
// wxDragCanvas::OnEvent( event );
wxClientDC dc(this); wxClientDC dc(this);
PrepareDC(dc); PrepareDC(dc);
@@ -1053,11 +1054,14 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
node = node->Next(); node = node->Next();
}; };
if (!event.Dragging()) m_isDragging = FALSE; if (!event.Dragging())
m_dragCount = 0;
else
m_dragCount++;
if (event.Dragging() && (!m_isDragging)) if (event.Dragging() && (m_dragCount > 3))
{ {
m_isDragging = TRUE; m_dragCount = 0;
wxListEvent le( wxEVT_COMMAND_LIST_BEGIN_DRAG, m_parent->GetId() ); wxListEvent le( wxEVT_COMMAND_LIST_BEGIN_DRAG, m_parent->GetId() );
le.SetEventObject( this ); le.SetEventObject( this );
le.m_code = 0; le.m_code = 0;
@@ -1555,6 +1559,25 @@ void wxListMainWindow::GetItemRect( long index, wxRectangle &rect )
}; };
}; };
bool wxListMainWindow::GetItemPosition(long item, wxPoint& pos)
{
wxNode *node = m_lines.Nth( item );
if (node)
{
wxRectangle rect;
wxListLineData *line = (wxListLineData*)node->Data();
line->GetRect( rect );
pos.x = rect.x;
pos.y = rect.y;
}
else
{
pos.x = 0;
pos.y = 0;
};
return TRUE;
};
int wxListMainWindow::GetSelectedItemCount( void ) int wxListMainWindow::GetSelectedItemCount( void )
{ {
int ret = 0; int ret = 0;
@@ -2197,9 +2220,10 @@ bool wxListCtrl::GetItemRect( long item, wxRectangle &rect, int WXUNUSED(code)
return TRUE; return TRUE;
}; };
bool wxListCtrl::GetItemPosition( long WXUNUSED(item), wxPoint& WXUNUSED(pos) ) const bool wxListCtrl::GetItemPosition( long item, wxPoint& pos )
{ {
return 0; m_mainWin->GetItemPosition( item, pos );
return TRUE;
}; };
bool wxListCtrl::SetItemPosition( long WXUNUSED(item), const wxPoint& WXUNUSED(pos) ) bool wxListCtrl::SetItemPosition( long WXUNUSED(item), const wxPoint& WXUNUSED(pos) )
@@ -2403,7 +2427,7 @@ bool wxListCtrl::SortItems( wxListCtrlCompare fn, long data )
return TRUE; return TRUE;
}; };
void wxListCtrl::OnIdle( wxIdleEvent &event ) void wxListCtrl::OnIdle( wxIdleEvent &WXUNUSED(event) )
{ {
if (!m_mainWin->m_dirty) return; if (!m_mainWin->m_dirty) return;

View File

@@ -87,10 +87,21 @@ IMPLEMENT_DYNAMIC_CLASS(wxPaintDC,wxDC)
wxPaintDC::wxPaintDC(void) wxPaintDC::wxPaintDC(void)
{ {
m_penGC = NULL;
m_brushGC = NULL;
m_textGC = NULL;
m_bgGC = NULL;
m_cmap = NULL;
}; };
wxPaintDC::wxPaintDC( wxWindow *window ) wxPaintDC::wxPaintDC( wxWindow *window )
{ {
m_penGC = NULL;
m_brushGC = NULL;
m_textGC = NULL;
m_bgGC = NULL;
m_cmap = NULL;
if (!window) return; if (!window) return;
GtkWidget *widget = window->m_wxwindow; GtkWidget *widget = window->m_wxwindow;
if (!widget) return; if (!widget) return;
@@ -777,9 +788,13 @@ void wxPaintDC::SetUpDC(void)
{ {
m_ok = TRUE; m_ok = TRUE;
m_logicalFunction = wxCOPY; m_logicalFunction = wxCOPY;
if (m_penGC) gdk_gc_unref( m_penGC );
m_penGC = gdk_gc_new( m_window ); m_penGC = gdk_gc_new( m_window );
if (m_brushGC) gdk_gc_unref( m_brushGC );
m_brushGC = gdk_gc_new( m_window ); m_brushGC = gdk_gc_new( m_window );
if (m_textGC) gdk_gc_unref( m_textGC );
m_textGC = gdk_gc_new( m_window ); m_textGC = gdk_gc_new( m_window );
if (m_bgGC) gdk_gc_unref( m_bgGC );
m_bgGC = gdk_gc_new( m_window ); m_bgGC = gdk_gc_new( m_window );
SetTextForeground( m_textForegroundColour ); SetTextForeground( m_textForegroundColour );
SetTextBackground( m_textBackgroundColour ); SetTextBackground( m_textBackgroundColour );

View File

@@ -46,9 +46,41 @@ void wxDropTarget::Drop( GdkEvent *event, int x, int y )
void wxDropTarget::UnregisterWidget( GtkWidget *widget ) void wxDropTarget::UnregisterWidget( GtkWidget *widget )
{ {
if (!widget) return;
gtk_widget_dnd_drop_set( widget, FALSE, NULL, 0, FALSE ); gtk_widget_dnd_drop_set( widget, FALSE, NULL, 0, FALSE );
}; };
void wxDropTarget::RegisterWidget( GtkWidget *widget )
{
wxString formats;
int valid = 0;
for ( uint i = 0; i < GetFormatCount(); i++ )
{
wxDataFormat df = GetFormat( i );
switch (df)
{
case wxDF_TEXT:
if (i > 0) formats += ";";
formats += "text/plain";
valid++;
break;
case wxDF_FILENAME:
if (i > 0) formats += ";";
formats += "url:any";
valid++;
break;
default:
break;
};
}
char *str = WXSTRINGCAST formats;
gtk_widget_dnd_drop_set( widget, TRUE, &str, valid, FALSE );
};
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxTextDropTarget // wxTextDropTarget
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -66,27 +98,65 @@ bool wxTextDropTarget::OnDropText( long x, long y, const char *psz )
return TRUE; return TRUE;
}; };
void wxTextDropTarget::RegisterWidget( GtkWidget *widget ) size_t wxTextDropTarget::GetFormatCount() const
{ {
char *accepted_drop_types[] = { "text/plain" }; return 1;
gtk_widget_dnd_drop_set( widget, TRUE, accepted_drop_types, 1, FALSE ); }
};
wxDataFormat wxTextDropTarget::GetFormat(size_t WXUNUSED(n)) const
{
return wxDF_TEXT;
}
// ----------------------------------------------------------------------------
// wxFileDropTarget
// ----------------------------------------------------------------------------
bool wxFileDropTarget::OnDropFiles( long x, long y, size_t nFiles, const char * const WXUNUSED(aszFiles)[] )
{
printf( "Got %d dropped files.\n", (int)nFiles );
printf( "At x: %d, y: %d.\n", (int)x, (int)y );
return TRUE;
}
bool wxFileDropTarget::OnDrop(long x, long y, const void *WXUNUSED(pData) )
{
char *str = "/this/is/a/path.txt";
return OnDropFiles(x, y, 1, &str );
}
size_t wxFileDropTarget::GetFormatCount() const
{
return 1;
}
wxDataFormat wxFileDropTarget::GetFormat(size_t WXUNUSED(n)) const
{
return wxDF_FILENAME;
}
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// wxDragSource // wxDropSource
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// drag request // drag request
void gtk_drag_callback( GtkWidget *widget, GdkEvent *event, wxDragSource *drag ) void gtk_drag_callback( GtkWidget *widget, GdkEvent *event, wxDataObject *data )
{ {
printf( "OnDragRequest.\n" ); printf( "Data requested for dropping.\n" );
gtk_widget_dnd_data_set( widget, event, drag->m_data, drag->m_size ); uint size = data->GetDataSize();
char *ptr = new char[size];
data->GetDataHere( ptr );
gtk_widget_dnd_data_set( widget, event, ptr, size );
delete ptr;
}; };
wxDragSource::wxDragSource( wxWindow *win ) wxDropSource::wxDropSource( wxWindow *win )
{ {
g_blockEventsOnDrag = TRUE; g_blockEventsOnDrag = TRUE;
@@ -95,34 +165,48 @@ wxDragSource::wxDragSource( wxWindow *win )
if (win->m_wxwindow) m_widget = win->m_wxwindow; if (win->m_wxwindow) m_widget = win->m_wxwindow;
m_data = NULL; m_data = NULL;
m_size = 0;
m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY ); m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY );
m_goaheadCursor = wxCursor( wxCURSOR_HAND ); m_goaheadCursor = wxCursor( wxCURSOR_HAND );
}; };
wxDragSource::~wxDragSource(void) wxDropSource::wxDropSource( wxDataObject &data, wxWindow *win )
{ {
g_blockEventsOnDrag = TRUE;
m_window = win;
m_widget = win->m_widget;
if (win->m_wxwindow) m_widget = win->m_wxwindow;
m_data = &data;
m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY );
m_goaheadCursor = wxCursor( wxCURSOR_HAND );
};
void wxDropSource::SetData( wxDataObject &data )
{
m_data = &data;
};
wxDropSource::~wxDropSource(void)
{
// if (m_data) delete m_data;
g_blockEventsOnDrag = FALSE; g_blockEventsOnDrag = FALSE;
}; };
void wxDragSource::SetData( char *data, long size ) wxDropSource::DragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
{ {
m_size = size; if (gdk_dnd.dnd_grabbed) return None;
m_data = data; if (gdk_dnd.drag_really) return None;
};
void wxDragSource::Start( int x, int y ) if (!m_data) return None;
{ if (m_data->GetDataSize() == 0) return None;
if (gdk_dnd.dnd_grabbed) return;
if (gdk_dnd.drag_really) return;
if (m_size == 0) return;
if (!m_data) return;
GdkWindowPrivate *wp = (GdkWindowPrivate*) m_widget->window; GdkWindowPrivate *wp = (GdkWindowPrivate*) m_widget->window;
RegisterWindow(); RegisterWindow();
ConnectWindow();
gdk_dnd.drag_perhaps = TRUE; gdk_dnd.drag_perhaps = TRUE;
@@ -159,49 +243,53 @@ void wxDragSource::Start( int x, int y )
gdk_dnd.dnd_grabbed = TRUE; gdk_dnd.dnd_grabbed = TRUE;
gdk_dnd.drag_really = 1; gdk_dnd.drag_really = 1;
int x = 0;
int y = 0;
gdk_window_get_pointer( m_widget->window, &x, &y, NULL );
gdk_dnd_display_drag_cursor( x, y, FALSE, TRUE ); gdk_dnd_display_drag_cursor( x, y, FALSE, TRUE );
while (gdk_dnd.drag_really || gdk_dnd.drag_perhaps) wxYield(); while (gdk_dnd.drag_really || gdk_dnd.drag_perhaps) wxYield();
UnconnectWindow();
UnregisterWindow(); UnregisterWindow();
return Copy;
}; };
void wxDragSource::ConnectWindow(void) void wxDropSource::RegisterWindow(void)
{ {
if (!m_data) return;
wxString formats;
wxDataFormat df = m_data->GetPreferredFormat();
switch (df)
{
case wxDF_TEXT:
formats += "text/plain";
break;
case wxDF_FILENAME:
formats += "url:any";
break;
default:
break;
}
char *str = WXSTRINGCAST formats;
gtk_widget_dnd_drag_set( m_widget, TRUE, &str, 1 );
gtk_signal_connect( GTK_OBJECT(m_widget), "drag_request_event", gtk_signal_connect( GTK_OBJECT(m_widget), "drag_request_event",
GTK_SIGNAL_FUNC(gtk_drag_callback), (gpointer)this ); GTK_SIGNAL_FUNC(gtk_drag_callback), (gpointer)m_data );
}; };
void wxDragSource::UnconnectWindow(void) void wxDropSource::UnregisterWindow(void)
{
if (!m_widget) return;
gtk_signal_disconnect_by_data( GTK_OBJECT(m_widget), (gpointer)this );
};
void wxDragSource::UnregisterWindow(void)
{ {
if (!m_widget) return; if (!m_widget) return;
gtk_widget_dnd_drag_set( m_widget, FALSE, NULL, 0 ); gtk_widget_dnd_drag_set( m_widget, FALSE, NULL, 0 );
gtk_signal_disconnect_by_data( GTK_OBJECT(m_widget), (gpointer)m_data );
}; };
//-------------------------------------------------------------------------
// wxTextDragSource
//-------------------------------------------------------------------------
void wxTextDragSource::SetTextData( const wxString &text )
{
m_tmp = text;
SetData( WXSTRINGCAST(m_tmp), m_tmp.Length()+1 );
};
void wxTextDragSource::RegisterWindow(void)
{
if (!m_widget) return;
char *accepted_drop_types[] = { "text/plain" };
gtk_widget_dnd_drag_set( m_widget, TRUE, accepted_drop_types, 1 );
};

View File

@@ -293,8 +293,7 @@ void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
for(wxNode *node = GetChildren()->First(); node; node = node->Next()) for(wxNode *node = GetChildren()->First(); node; node = node->Next())
{ {
wxWindow *win = (wxWindow *)node->Data(); wxWindow *win = (wxWindow *)node->Data();
if (!win->IsKindOf(CLASSINFO(wxFrame)) && if (!IS_KIND_OF(win,wxFrame) && !IS_KIND_OF(win,wxDialog)
!win->IsKindOf(CLASSINFO(wxDialog))
#if 0 // not in m_children anyway #if 0 // not in m_children anyway
&& (win != m_frameMenuBar) && && (win != m_frameMenuBar) &&
(win != m_frameToolBar) && (win != m_frameToolBar) &&
@@ -318,6 +317,18 @@ void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
void wxFrame::AddChild( wxWindow *child ) void wxFrame::AddChild( wxWindow *child )
{ {
// 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;
}
if (m_addPrivateChild) if (m_addPrivateChild)
{ {
gtk_myfixed_put( GTK_MYFIXED(m_mainWindow), child->m_widget, child->m_x, child->m_y ); gtk_myfixed_put( GTK_MYFIXED(m_mainWindow), child->m_widget, child->m_x, child->m_y );
@@ -376,11 +387,11 @@ wxMenuBar *wxFrame::GetMenuBar(void)
return m_frameMenuBar; return m_frameMenuBar;
}; };
wxToolBar *wxFrame::CreateToolBar( int style, int WXUNUSED(orientation), int WXUNUSED(rowsOrColumns) ) wxToolBar *wxFrame::CreateToolBar( long style , wxWindowID id, const wxString& name )
{ {
m_addPrivateChild = TRUE; m_addPrivateChild = TRUE;
m_frameToolBar = new wxToolBar( this, -1, wxDefaultPosition, wxDefaultSize, style ); m_frameToolBar = new wxToolBar( this, id, wxDefaultPosition, wxDefaultSize, style, name );
m_addPrivateChild = FALSE; m_addPrivateChild = FALSE;
@@ -392,15 +403,16 @@ wxToolBar *wxFrame::GetToolBar(void)
return m_frameToolBar; return m_frameToolBar;
}; };
bool wxFrame::CreateStatusBar( int number ) wxStatusBar* wxFrame::CreateStatusBar( int number, long style, wxWindowID id, const wxString& name )
{ {
if (m_frameStatusBar) if (m_frameStatusBar)
delete m_frameStatusBar; delete m_frameStatusBar;
m_frameStatusBar = new wxStatusBar( this, -1, wxPoint(0,0), wxSize(100,20) ); m_frameStatusBar = new wxStatusBar( this, id, wxPoint(0,0), wxSize(100,20), style, name );
m_frameStatusBar->SetFieldsCount( number ); m_frameStatusBar->SetFieldsCount( number );
return TRUE;
return m_frameStatusBar;
}; };
void wxFrame::SetStatusText( const wxString &text, int number ) void wxFrame::SetStatusText( const wxString &text, int number )

View File

@@ -26,8 +26,6 @@ bool wxGauge::Create( wxWindow *parent, wxWindowID id, int range,
{ {
m_needParent = TRUE; m_needParent = TRUE;
wxSize newSize = size;
PreCreation( parent, id, pos, size, style, name ); PreCreation( parent, id, pos, size, style, name );
m_rangeMax = range; m_rangeMax = range;

View File

@@ -99,6 +99,8 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
PostCreation(); PostCreation();
gtk_widget_realize( GTK_WIDGET(m_list) );
Show( TRUE ); Show( TRUE );
return TRUE; return TRUE;
@@ -321,4 +323,10 @@ int wxListBox::GetIndex( GtkWidget *item ) const
return -1; return -1;
}; };
GtkWidget *wxListBox::GetDropTargetWidget(void)
{
return GTK_WIDGET(m_list);
};

View File

@@ -13,6 +13,7 @@
#endif #endif
#include "wx/mdi.h" #include "wx/mdi.h"
#include "wx/dialog.h"
#include "wx/gtk/win_gtk.h" #include "wx/gtk/win_gtk.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -174,6 +175,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame,wxPanel)
BEGIN_EVENT_TABLE(wxMDIChildFrame, wxPanel) BEGIN_EVENT_TABLE(wxMDIChildFrame, wxPanel)
EVT_CLOSE(wxMDIChildFrame::OnCloseWindow) EVT_CLOSE(wxMDIChildFrame::OnCloseWindow)
EVT_SIZE(wxMDIChildFrame::OnSize)
END_EVENT_TABLE() END_EVENT_TABLE()
wxMDIChildFrame::wxMDIChildFrame(void) wxMDIChildFrame::wxMDIChildFrame(void)
@@ -223,6 +225,35 @@ void wxMDIChildFrame::OnCloseWindow( wxCloseEvent &event )
} }
}; };
void wxMDIChildFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
{
if ( GetAutoLayout() )
Layout();
else {
// 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 (!IS_KIND_OF(win,wxFrame) && !IS_KIND_OF(win,wxDialog))
{
if ( child ) // it's the second one: do nothing
return;
child = win;
};
};
// yes: set it's size to fill all the frame
int client_x, client_y;
GetClientSize(&client_x, &client_y);
child->SetSize( 1, 1, client_x-2, client_y);
}
};
bool wxMDIChildFrame::Destroy(void) bool wxMDIChildFrame::Destroy(void)
{ {
if (!wxPendingDelete.Member(this)) if (!wxPendingDelete.Member(this))

View File

@@ -109,10 +109,6 @@ static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation*
// wxNotebook // wxNotebook
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
BEGIN_EVENT_TABLE(wxNotebook, wxControl)
EVT_SIZE(wxNotebook::OnSize)
END_EVENT_TABLE()
IMPLEMENT_DYNAMIC_CLASS(wxNotebook,wxControl) IMPLEMENT_DYNAMIC_CLASS(wxNotebook,wxControl)
void wxNotebook::Init() void wxNotebook::Init()
@@ -400,11 +396,6 @@ wxWindow *wxNotebook::GetPage( int page ) const
void wxNotebook::AddChild( wxWindow *win ) void wxNotebook::AddChild( wxWindow *win )
{ {
// @@@ normally done in wxWindow::AddChild but for some reason wxNotebook
// case is special there (Robert?)
// Robert: Don't you think the code below looks different from the one
// in wxWindow::AddChild :-)
m_children.Append(win); m_children.Append(win);
wxNotebookPage *page = new wxNotebookPage(); wxNotebookPage *page = new wxNotebookPage();
@@ -434,13 +425,13 @@ void wxNotebook::AddChild( wxWindow *win )
}; };
// override these 2 functions to do nothing: everything is done in OnSize // override these 2 functions to do nothing: everything is done in OnSize
void wxNotebook::SetConstraintSizes(bool /* recurse */) void wxNotebook::SetConstraintSizes( bool WXUNUSED(recurse) )
{ {
// don't set the sizes of the pages - their correct size is not yet known // don't set the sizes of the pages - their correct size is not yet known
wxControl::SetConstraintSizes(FALSE); wxControl::SetConstraintSizes(FALSE);
} }
bool wxNotebook::DoPhase(int /* nPhase */) bool wxNotebook::DoPhase( int WXUNUSED(nPhase) )
{ {
return TRUE; return TRUE;
} }

View File

@@ -179,7 +179,7 @@ void wxToolBar::ClearTools(void)
{ {
}; };
void wxToolBar::Layout(void) void wxToolBar::Realize(void)
{ {
m_x = 0; m_x = 0;
m_y = 0; m_y = 0;

View File

@@ -385,3 +385,11 @@ wxTextCtrl& wxTextCtrl::operator<<(const char c)
return *this; return *this;
} }
GtkWidget* wxTextCtrl::GetDropTargetWidget(void)
{
return GTK_WIDGET(m_text);
};

View File

@@ -349,7 +349,7 @@ typedef struct {
} wxEndProcessData; } wxEndProcessData;
static void GTK_EndProcessDetector(gpointer data, gint source, static void GTK_EndProcessDetector(gpointer data, gint source,
GdkInputCondition condition) GdkInputCondition WXUNUSED(condition) )
{ {
wxEndProcessData *proc_data = (wxEndProcessData *)data; wxEndProcessData *proc_data = (wxEndProcessData *)data;
int pid; int pid;

View File

@@ -259,8 +259,8 @@ gint gtk_window_key_press_callback( GtkWidget *WXUNUSED(widget), GdkEventKey *gd
gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win ) gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
{ {
if (widget->window != gdk_event->window) return FALSE; if (widget->window != gdk_event->window) return TRUE;
if (g_blockEventsOnDrag) return FALSE; if (g_blockEventsOnDrag) return TRUE;
if (win->m_wxwindow) if (win->m_wxwindow)
{ {
@@ -278,7 +278,7 @@ gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_ev
}; };
}; };
if (!win->HasVMT()) return FALSE; if (!win->HasVMT()) return TRUE;
/* /*
printf( "OnButtonPress from " ); printf( "OnButtonPress from " );
@@ -342,9 +342,9 @@ gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_
{ {
if (widget->window != gdk_event->window) return TRUE; if (widget->window != gdk_event->window) return TRUE;
if (g_blockEventsOnDrag) return FALSE; if (g_blockEventsOnDrag) return TRUE;
if (!win->HasVMT()) return FALSE; if (!win->HasVMT()) return TRUE;
/* /*
printf( "OnButtonRelease from " ); printf( "OnButtonRelease from " );
@@ -374,7 +374,9 @@ gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_
event.m_y = (long)gdk_event->y; event.m_y = (long)gdk_event->y;
event.SetEventObject( win ); event.SetEventObject( win );
return win->ProcessEvent( event ); win->ProcessEvent( event );
return TRUE;
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -384,9 +386,9 @@ gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_e
{ {
if (widget->window != gdk_event->window) return TRUE; if (widget->window != gdk_event->window) return TRUE;
if (g_blockEventsOnDrag) return FALSE; if (g_blockEventsOnDrag) return TRUE;
if (!win->HasVMT()) return FALSE; if (!win->HasVMT()) return TRUE;
/* /*
printf( "OnMotion from " ); printf( "OnMotion from " );
@@ -410,7 +412,7 @@ gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_e
win->ProcessEvent( event ); win->ProcessEvent( event );
return FALSE; return TRUE;
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -418,7 +420,7 @@ gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_e
gint gtk_window_focus_in_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxWindow *win ) gint gtk_window_focus_in_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxWindow *win )
{ {
if (g_blockEventsOnDrag) return FALSE; if (g_blockEventsOnDrag) return TRUE;
if (win->m_wxwindow) if (win->m_wxwindow)
{ {
if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow)) if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow))
@@ -433,7 +435,7 @@ gint gtk_window_focus_in_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUS
}; };
}; };
if (!win->HasVMT()) return FALSE; if (!win->HasVMT()) return TRUE;
/* /*
printf( "OnSetFocus from " ); printf( "OnSetFocus from " );
@@ -446,7 +448,9 @@ gint gtk_window_focus_in_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUS
wxFocusEvent event( wxEVT_SET_FOCUS, win->GetId() ); wxFocusEvent event( wxEVT_SET_FOCUS, win->GetId() );
event.SetEventObject( win ); event.SetEventObject( win );
return win->ProcessEvent( event ); win->ProcessEvent( event );
return TRUE;
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -454,14 +458,14 @@ gint gtk_window_focus_in_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUS
gint gtk_window_focus_out_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxWindow *win ) gint gtk_window_focus_out_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxWindow *win )
{ {
if (g_blockEventsOnDrag) return FALSE; if (g_blockEventsOnDrag) return TRUE;
if (win->m_wxwindow) if (win->m_wxwindow)
{ {
if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow)) if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow))
GTK_WIDGET_UNSET_FLAGS (win->m_wxwindow, GTK_HAS_FOCUS); GTK_WIDGET_UNSET_FLAGS (win->m_wxwindow, GTK_HAS_FOCUS);
}; };
if (!win->HasVMT()) return FALSE; if (!win->HasVMT()) return TRUE;
/* /*
printf( "OnKillFocus from " ); printf( "OnKillFocus from " );
@@ -472,7 +476,9 @@ gint gtk_window_focus_out_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNU
wxFocusEvent event( wxEVT_KILL_FOCUS, win->GetId() ); wxFocusEvent event( wxEVT_KILL_FOCUS, win->GetId() );
event.SetEventObject( win ); event.SetEventObject( win );
return win->ProcessEvent( event ); win->ProcessEvent( event );
return TRUE;
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -616,8 +622,6 @@ void gtk_window_hscroll_change_callback( GtkWidget *WXUNUSED(widget), wxWindow *
void gtk_window_drop_callback( GtkWidget *widget, GdkEvent *event, wxWindow *win ) void gtk_window_drop_callback( GtkWidget *widget, GdkEvent *event, wxWindow *win )
{ {
printf( "OnDrop.\n" );
if (win->GetDropTarget()) if (win->GetDropTarget())
{ {
int x = 0; int x = 0;
@@ -961,9 +965,6 @@ void wxWindow::PostCreation(void)
gtk_signal_connect( GTK_OBJECT(connect_widget), "focus_out_event", gtk_signal_connect( GTK_OBJECT(connect_widget), "focus_out_event",
GTK_SIGNAL_FUNC(gtk_window_focus_out_callback), (gpointer)this ); GTK_SIGNAL_FUNC(gtk_window_focus_out_callback), (gpointer)this );
gtk_signal_connect( GTK_OBJECT(connect_widget), "drop_data_available_event",
GTK_SIGNAL_FUNC(gtk_window_drop_callback), (gpointer)this );
// Only for cursor handling // Only for cursor handling
gtk_signal_connect( GTK_OBJECT(m_widget), "enter_notify_event", gtk_signal_connect( GTK_OBJECT(m_widget), "enter_notify_event",
@@ -1480,6 +1481,7 @@ void wxWindow::AddChild( wxWindow *child )
m_children.Append( child ); m_children.Append( child );
if (m_wxwindow) gtk_myfixed_put( GTK_MYFIXED(m_wxwindow), child->m_widget, child->m_x, child->m_y ); 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 ); gtk_widget_set_usize( child->m_widget, child->m_width, child->m_height );
}; };
@@ -1693,17 +1695,23 @@ void wxWindow::InitDialog(void)
void wxWindow::SetDropTarget( wxDropTarget *dropTarget ) void wxWindow::SetDropTarget( wxDropTarget *dropTarget )
{ {
GtkWidget *connect_widget = m_widget; GtkWidget *dnd_widget = GetDropTargetWidget();
if (m_wxwindow) connect_widget = m_wxwindow;
if (m_pDropTarget) if (m_pDropTarget)
{ {
m_pDropTarget->UnregisterWidget( connect_widget ); gtk_signal_disconnect_by_func( GTK_OBJECT(dnd_widget),
GTK_SIGNAL_FUNC(gtk_window_drop_callback), (gpointer)this );
m_pDropTarget->UnregisterWidget( dnd_widget );
delete m_pDropTarget; delete m_pDropTarget;
}; };
m_pDropTarget = dropTarget; m_pDropTarget = dropTarget;
if (m_pDropTarget) if (m_pDropTarget)
{ {
m_pDropTarget->RegisterWidget( connect_widget ); m_pDropTarget->RegisterWidget( dnd_widget );
gtk_signal_connect( GTK_OBJECT(dnd_widget), "drop_data_available_event",
GTK_SIGNAL_FUNC(gtk_window_drop_callback), (gpointer)this );
}; };
}; };
@@ -1712,6 +1720,14 @@ wxDropTarget *wxWindow::GetDropTarget() const
return m_pDropTarget; return m_pDropTarget;
}; };
GtkWidget* wxWindow::GetDropTargetWidget(void)
{
GtkWidget *connect_widget = m_widget;
if (m_wxwindow) connect_widget = m_wxwindow;
return connect_widget;
}
void wxWindow::SetFont( const wxFont &font ) void wxWindow::SetFont( const wxFont &font )
{ {
m_font = font; m_font = font;
@@ -2445,7 +2461,7 @@ bool wxWindow::AcceptsFocus() const
return IsEnabled() && IsShown(); return IsEnabled() && IsShown();
} }
void wxWindow::OnIdle(wxIdleEvent& event) void wxWindow::OnIdle(wxIdleEvent& WXUNUSED(event) )
{ {
UpdateWindowUI(); UpdateWindowUI();
} }

View File

@@ -87,10 +87,21 @@ IMPLEMENT_DYNAMIC_CLASS(wxPaintDC,wxDC)
wxPaintDC::wxPaintDC(void) wxPaintDC::wxPaintDC(void)
{ {
m_penGC = NULL;
m_brushGC = NULL;
m_textGC = NULL;
m_bgGC = NULL;
m_cmap = NULL;
}; };
wxPaintDC::wxPaintDC( wxWindow *window ) wxPaintDC::wxPaintDC( wxWindow *window )
{ {
m_penGC = NULL;
m_brushGC = NULL;
m_textGC = NULL;
m_bgGC = NULL;
m_cmap = NULL;
if (!window) return; if (!window) return;
GtkWidget *widget = window->m_wxwindow; GtkWidget *widget = window->m_wxwindow;
if (!widget) return; if (!widget) return;
@@ -777,9 +788,13 @@ void wxPaintDC::SetUpDC(void)
{ {
m_ok = TRUE; m_ok = TRUE;
m_logicalFunction = wxCOPY; m_logicalFunction = wxCOPY;
if (m_penGC) gdk_gc_unref( m_penGC );
m_penGC = gdk_gc_new( m_window ); m_penGC = gdk_gc_new( m_window );
if (m_brushGC) gdk_gc_unref( m_brushGC );
m_brushGC = gdk_gc_new( m_window ); m_brushGC = gdk_gc_new( m_window );
if (m_textGC) gdk_gc_unref( m_textGC );
m_textGC = gdk_gc_new( m_window ); m_textGC = gdk_gc_new( m_window );
if (m_bgGC) gdk_gc_unref( m_bgGC );
m_bgGC = gdk_gc_new( m_window ); m_bgGC = gdk_gc_new( m_window );
SetTextForeground( m_textForegroundColour ); SetTextForeground( m_textForegroundColour );
SetTextBackground( m_textBackgroundColour ); SetTextBackground( m_textBackgroundColour );

View File

@@ -46,9 +46,41 @@ void wxDropTarget::Drop( GdkEvent *event, int x, int y )
void wxDropTarget::UnregisterWidget( GtkWidget *widget ) void wxDropTarget::UnregisterWidget( GtkWidget *widget )
{ {
if (!widget) return;
gtk_widget_dnd_drop_set( widget, FALSE, NULL, 0, FALSE ); gtk_widget_dnd_drop_set( widget, FALSE, NULL, 0, FALSE );
}; };
void wxDropTarget::RegisterWidget( GtkWidget *widget )
{
wxString formats;
int valid = 0;
for ( uint i = 0; i < GetFormatCount(); i++ )
{
wxDataFormat df = GetFormat( i );
switch (df)
{
case wxDF_TEXT:
if (i > 0) formats += ";";
formats += "text/plain";
valid++;
break;
case wxDF_FILENAME:
if (i > 0) formats += ";";
formats += "url:any";
valid++;
break;
default:
break;
};
}
char *str = WXSTRINGCAST formats;
gtk_widget_dnd_drop_set( widget, TRUE, &str, valid, FALSE );
};
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxTextDropTarget // wxTextDropTarget
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -66,27 +98,65 @@ bool wxTextDropTarget::OnDropText( long x, long y, const char *psz )
return TRUE; return TRUE;
}; };
void wxTextDropTarget::RegisterWidget( GtkWidget *widget ) size_t wxTextDropTarget::GetFormatCount() const
{ {
char *accepted_drop_types[] = { "text/plain" }; return 1;
gtk_widget_dnd_drop_set( widget, TRUE, accepted_drop_types, 1, FALSE ); }
};
wxDataFormat wxTextDropTarget::GetFormat(size_t WXUNUSED(n)) const
{
return wxDF_TEXT;
}
// ----------------------------------------------------------------------------
// wxFileDropTarget
// ----------------------------------------------------------------------------
bool wxFileDropTarget::OnDropFiles( long x, long y, size_t nFiles, const char * const WXUNUSED(aszFiles)[] )
{
printf( "Got %d dropped files.\n", (int)nFiles );
printf( "At x: %d, y: %d.\n", (int)x, (int)y );
return TRUE;
}
bool wxFileDropTarget::OnDrop(long x, long y, const void *WXUNUSED(pData) )
{
char *str = "/this/is/a/path.txt";
return OnDropFiles(x, y, 1, &str );
}
size_t wxFileDropTarget::GetFormatCount() const
{
return 1;
}
wxDataFormat wxFileDropTarget::GetFormat(size_t WXUNUSED(n)) const
{
return wxDF_FILENAME;
}
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// wxDragSource // wxDropSource
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// drag request // drag request
void gtk_drag_callback( GtkWidget *widget, GdkEvent *event, wxDragSource *drag ) void gtk_drag_callback( GtkWidget *widget, GdkEvent *event, wxDataObject *data )
{ {
printf( "OnDragRequest.\n" ); printf( "Data requested for dropping.\n" );
gtk_widget_dnd_data_set( widget, event, drag->m_data, drag->m_size ); uint size = data->GetDataSize();
char *ptr = new char[size];
data->GetDataHere( ptr );
gtk_widget_dnd_data_set( widget, event, ptr, size );
delete ptr;
}; };
wxDragSource::wxDragSource( wxWindow *win ) wxDropSource::wxDropSource( wxWindow *win )
{ {
g_blockEventsOnDrag = TRUE; g_blockEventsOnDrag = TRUE;
@@ -95,34 +165,48 @@ wxDragSource::wxDragSource( wxWindow *win )
if (win->m_wxwindow) m_widget = win->m_wxwindow; if (win->m_wxwindow) m_widget = win->m_wxwindow;
m_data = NULL; m_data = NULL;
m_size = 0;
m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY ); m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY );
m_goaheadCursor = wxCursor( wxCURSOR_HAND ); m_goaheadCursor = wxCursor( wxCURSOR_HAND );
}; };
wxDragSource::~wxDragSource(void) wxDropSource::wxDropSource( wxDataObject &data, wxWindow *win )
{ {
g_blockEventsOnDrag = TRUE;
m_window = win;
m_widget = win->m_widget;
if (win->m_wxwindow) m_widget = win->m_wxwindow;
m_data = &data;
m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY );
m_goaheadCursor = wxCursor( wxCURSOR_HAND );
};
void wxDropSource::SetData( wxDataObject &data )
{
m_data = &data;
};
wxDropSource::~wxDropSource(void)
{
// if (m_data) delete m_data;
g_blockEventsOnDrag = FALSE; g_blockEventsOnDrag = FALSE;
}; };
void wxDragSource::SetData( char *data, long size ) wxDropSource::DragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
{ {
m_size = size; if (gdk_dnd.dnd_grabbed) return None;
m_data = data; if (gdk_dnd.drag_really) return None;
};
void wxDragSource::Start( int x, int y ) if (!m_data) return None;
{ if (m_data->GetDataSize() == 0) return None;
if (gdk_dnd.dnd_grabbed) return;
if (gdk_dnd.drag_really) return;
if (m_size == 0) return;
if (!m_data) return;
GdkWindowPrivate *wp = (GdkWindowPrivate*) m_widget->window; GdkWindowPrivate *wp = (GdkWindowPrivate*) m_widget->window;
RegisterWindow(); RegisterWindow();
ConnectWindow();
gdk_dnd.drag_perhaps = TRUE; gdk_dnd.drag_perhaps = TRUE;
@@ -159,49 +243,53 @@ void wxDragSource::Start( int x, int y )
gdk_dnd.dnd_grabbed = TRUE; gdk_dnd.dnd_grabbed = TRUE;
gdk_dnd.drag_really = 1; gdk_dnd.drag_really = 1;
int x = 0;
int y = 0;
gdk_window_get_pointer( m_widget->window, &x, &y, NULL );
gdk_dnd_display_drag_cursor( x, y, FALSE, TRUE ); gdk_dnd_display_drag_cursor( x, y, FALSE, TRUE );
while (gdk_dnd.drag_really || gdk_dnd.drag_perhaps) wxYield(); while (gdk_dnd.drag_really || gdk_dnd.drag_perhaps) wxYield();
UnconnectWindow();
UnregisterWindow(); UnregisterWindow();
return Copy;
}; };
void wxDragSource::ConnectWindow(void) void wxDropSource::RegisterWindow(void)
{ {
if (!m_data) return;
wxString formats;
wxDataFormat df = m_data->GetPreferredFormat();
switch (df)
{
case wxDF_TEXT:
formats += "text/plain";
break;
case wxDF_FILENAME:
formats += "url:any";
break;
default:
break;
}
char *str = WXSTRINGCAST formats;
gtk_widget_dnd_drag_set( m_widget, TRUE, &str, 1 );
gtk_signal_connect( GTK_OBJECT(m_widget), "drag_request_event", gtk_signal_connect( GTK_OBJECT(m_widget), "drag_request_event",
GTK_SIGNAL_FUNC(gtk_drag_callback), (gpointer)this ); GTK_SIGNAL_FUNC(gtk_drag_callback), (gpointer)m_data );
}; };
void wxDragSource::UnconnectWindow(void) void wxDropSource::UnregisterWindow(void)
{
if (!m_widget) return;
gtk_signal_disconnect_by_data( GTK_OBJECT(m_widget), (gpointer)this );
};
void wxDragSource::UnregisterWindow(void)
{ {
if (!m_widget) return; if (!m_widget) return;
gtk_widget_dnd_drag_set( m_widget, FALSE, NULL, 0 ); gtk_widget_dnd_drag_set( m_widget, FALSE, NULL, 0 );
gtk_signal_disconnect_by_data( GTK_OBJECT(m_widget), (gpointer)m_data );
}; };
//-------------------------------------------------------------------------
// wxTextDragSource
//-------------------------------------------------------------------------
void wxTextDragSource::SetTextData( const wxString &text )
{
m_tmp = text;
SetData( WXSTRINGCAST(m_tmp), m_tmp.Length()+1 );
};
void wxTextDragSource::RegisterWindow(void)
{
if (!m_widget) return;
char *accepted_drop_types[] = { "text/plain" };
gtk_widget_dnd_drag_set( m_widget, TRUE, accepted_drop_types, 1 );
};

View File

@@ -293,8 +293,7 @@ void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
for(wxNode *node = GetChildren()->First(); node; node = node->Next()) for(wxNode *node = GetChildren()->First(); node; node = node->Next())
{ {
wxWindow *win = (wxWindow *)node->Data(); wxWindow *win = (wxWindow *)node->Data();
if (!win->IsKindOf(CLASSINFO(wxFrame)) && if (!IS_KIND_OF(win,wxFrame) && !IS_KIND_OF(win,wxDialog)
!win->IsKindOf(CLASSINFO(wxDialog))
#if 0 // not in m_children anyway #if 0 // not in m_children anyway
&& (win != m_frameMenuBar) && && (win != m_frameMenuBar) &&
(win != m_frameToolBar) && (win != m_frameToolBar) &&
@@ -318,6 +317,18 @@ void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
void wxFrame::AddChild( wxWindow *child ) void wxFrame::AddChild( wxWindow *child )
{ {
// 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;
}
if (m_addPrivateChild) if (m_addPrivateChild)
{ {
gtk_myfixed_put( GTK_MYFIXED(m_mainWindow), child->m_widget, child->m_x, child->m_y ); gtk_myfixed_put( GTK_MYFIXED(m_mainWindow), child->m_widget, child->m_x, child->m_y );
@@ -376,11 +387,11 @@ wxMenuBar *wxFrame::GetMenuBar(void)
return m_frameMenuBar; return m_frameMenuBar;
}; };
wxToolBar *wxFrame::CreateToolBar( int style, int WXUNUSED(orientation), int WXUNUSED(rowsOrColumns) ) wxToolBar *wxFrame::CreateToolBar( long style , wxWindowID id, const wxString& name )
{ {
m_addPrivateChild = TRUE; m_addPrivateChild = TRUE;
m_frameToolBar = new wxToolBar( this, -1, wxDefaultPosition, wxDefaultSize, style ); m_frameToolBar = new wxToolBar( this, id, wxDefaultPosition, wxDefaultSize, style, name );
m_addPrivateChild = FALSE; m_addPrivateChild = FALSE;
@@ -392,15 +403,16 @@ wxToolBar *wxFrame::GetToolBar(void)
return m_frameToolBar; return m_frameToolBar;
}; };
bool wxFrame::CreateStatusBar( int number ) wxStatusBar* wxFrame::CreateStatusBar( int number, long style, wxWindowID id, const wxString& name )
{ {
if (m_frameStatusBar) if (m_frameStatusBar)
delete m_frameStatusBar; delete m_frameStatusBar;
m_frameStatusBar = new wxStatusBar( this, -1, wxPoint(0,0), wxSize(100,20) ); m_frameStatusBar = new wxStatusBar( this, id, wxPoint(0,0), wxSize(100,20), style, name );
m_frameStatusBar->SetFieldsCount( number ); m_frameStatusBar->SetFieldsCount( number );
return TRUE;
return m_frameStatusBar;
}; };
void wxFrame::SetStatusText( const wxString &text, int number ) void wxFrame::SetStatusText( const wxString &text, int number )

View File

@@ -26,8 +26,6 @@ bool wxGauge::Create( wxWindow *parent, wxWindowID id, int range,
{ {
m_needParent = TRUE; m_needParent = TRUE;
wxSize newSize = size;
PreCreation( parent, id, pos, size, style, name ); PreCreation( parent, id, pos, size, style, name );
m_rangeMax = range; m_rangeMax = range;

View File

@@ -99,6 +99,8 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
PostCreation(); PostCreation();
gtk_widget_realize( GTK_WIDGET(m_list) );
Show( TRUE ); Show( TRUE );
return TRUE; return TRUE;
@@ -321,4 +323,10 @@ int wxListBox::GetIndex( GtkWidget *item ) const
return -1; return -1;
}; };
GtkWidget *wxListBox::GetDropTargetWidget(void)
{
return GTK_WIDGET(m_list);
};

View File

@@ -13,6 +13,7 @@
#endif #endif
#include "wx/mdi.h" #include "wx/mdi.h"
#include "wx/dialog.h"
#include "wx/gtk/win_gtk.h" #include "wx/gtk/win_gtk.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -174,6 +175,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame,wxPanel)
BEGIN_EVENT_TABLE(wxMDIChildFrame, wxPanel) BEGIN_EVENT_TABLE(wxMDIChildFrame, wxPanel)
EVT_CLOSE(wxMDIChildFrame::OnCloseWindow) EVT_CLOSE(wxMDIChildFrame::OnCloseWindow)
EVT_SIZE(wxMDIChildFrame::OnSize)
END_EVENT_TABLE() END_EVENT_TABLE()
wxMDIChildFrame::wxMDIChildFrame(void) wxMDIChildFrame::wxMDIChildFrame(void)
@@ -223,6 +225,35 @@ void wxMDIChildFrame::OnCloseWindow( wxCloseEvent &event )
} }
}; };
void wxMDIChildFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
{
if ( GetAutoLayout() )
Layout();
else {
// 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 (!IS_KIND_OF(win,wxFrame) && !IS_KIND_OF(win,wxDialog))
{
if ( child ) // it's the second one: do nothing
return;
child = win;
};
};
// yes: set it's size to fill all the frame
int client_x, client_y;
GetClientSize(&client_x, &client_y);
child->SetSize( 1, 1, client_x-2, client_y);
}
};
bool wxMDIChildFrame::Destroy(void) bool wxMDIChildFrame::Destroy(void)
{ {
if (!wxPendingDelete.Member(this)) if (!wxPendingDelete.Member(this))

View File

@@ -109,10 +109,6 @@ static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation*
// wxNotebook // wxNotebook
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
BEGIN_EVENT_TABLE(wxNotebook, wxControl)
EVT_SIZE(wxNotebook::OnSize)
END_EVENT_TABLE()
IMPLEMENT_DYNAMIC_CLASS(wxNotebook,wxControl) IMPLEMENT_DYNAMIC_CLASS(wxNotebook,wxControl)
void wxNotebook::Init() void wxNotebook::Init()
@@ -400,11 +396,6 @@ wxWindow *wxNotebook::GetPage( int page ) const
void wxNotebook::AddChild( wxWindow *win ) void wxNotebook::AddChild( wxWindow *win )
{ {
// @@@ normally done in wxWindow::AddChild but for some reason wxNotebook
// case is special there (Robert?)
// Robert: Don't you think the code below looks different from the one
// in wxWindow::AddChild :-)
m_children.Append(win); m_children.Append(win);
wxNotebookPage *page = new wxNotebookPage(); wxNotebookPage *page = new wxNotebookPage();
@@ -434,13 +425,13 @@ void wxNotebook::AddChild( wxWindow *win )
}; };
// override these 2 functions to do nothing: everything is done in OnSize // override these 2 functions to do nothing: everything is done in OnSize
void wxNotebook::SetConstraintSizes(bool /* recurse */) void wxNotebook::SetConstraintSizes( bool WXUNUSED(recurse) )
{ {
// don't set the sizes of the pages - their correct size is not yet known // don't set the sizes of the pages - their correct size is not yet known
wxControl::SetConstraintSizes(FALSE); wxControl::SetConstraintSizes(FALSE);
} }
bool wxNotebook::DoPhase(int /* nPhase */) bool wxNotebook::DoPhase( int WXUNUSED(nPhase) )
{ {
return TRUE; return TRUE;
} }

View File

@@ -179,7 +179,7 @@ void wxToolBar::ClearTools(void)
{ {
}; };
void wxToolBar::Layout(void) void wxToolBar::Realize(void)
{ {
m_x = 0; m_x = 0;
m_y = 0; m_y = 0;

View File

@@ -385,3 +385,11 @@ wxTextCtrl& wxTextCtrl::operator<<(const char c)
return *this; return *this;
} }
GtkWidget* wxTextCtrl::GetDropTargetWidget(void)
{
return GTK_WIDGET(m_text);
};

View File

@@ -349,7 +349,7 @@ typedef struct {
} wxEndProcessData; } wxEndProcessData;
static void GTK_EndProcessDetector(gpointer data, gint source, static void GTK_EndProcessDetector(gpointer data, gint source,
GdkInputCondition condition) GdkInputCondition WXUNUSED(condition) )
{ {
wxEndProcessData *proc_data = (wxEndProcessData *)data; wxEndProcessData *proc_data = (wxEndProcessData *)data;
int pid; int pid;

View File

@@ -259,8 +259,8 @@ gint gtk_window_key_press_callback( GtkWidget *WXUNUSED(widget), GdkEventKey *gd
gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win ) gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
{ {
if (widget->window != gdk_event->window) return FALSE; if (widget->window != gdk_event->window) return TRUE;
if (g_blockEventsOnDrag) return FALSE; if (g_blockEventsOnDrag) return TRUE;
if (win->m_wxwindow) if (win->m_wxwindow)
{ {
@@ -278,7 +278,7 @@ gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_ev
}; };
}; };
if (!win->HasVMT()) return FALSE; if (!win->HasVMT()) return TRUE;
/* /*
printf( "OnButtonPress from " ); printf( "OnButtonPress from " );
@@ -342,9 +342,9 @@ gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_
{ {
if (widget->window != gdk_event->window) return TRUE; if (widget->window != gdk_event->window) return TRUE;
if (g_blockEventsOnDrag) return FALSE; if (g_blockEventsOnDrag) return TRUE;
if (!win->HasVMT()) return FALSE; if (!win->HasVMT()) return TRUE;
/* /*
printf( "OnButtonRelease from " ); printf( "OnButtonRelease from " );
@@ -374,7 +374,9 @@ gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_
event.m_y = (long)gdk_event->y; event.m_y = (long)gdk_event->y;
event.SetEventObject( win ); event.SetEventObject( win );
return win->ProcessEvent( event ); win->ProcessEvent( event );
return TRUE;
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -384,9 +386,9 @@ gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_e
{ {
if (widget->window != gdk_event->window) return TRUE; if (widget->window != gdk_event->window) return TRUE;
if (g_blockEventsOnDrag) return FALSE; if (g_blockEventsOnDrag) return TRUE;
if (!win->HasVMT()) return FALSE; if (!win->HasVMT()) return TRUE;
/* /*
printf( "OnMotion from " ); printf( "OnMotion from " );
@@ -410,7 +412,7 @@ gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_e
win->ProcessEvent( event ); win->ProcessEvent( event );
return FALSE; return TRUE;
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -418,7 +420,7 @@ gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_e
gint gtk_window_focus_in_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxWindow *win ) gint gtk_window_focus_in_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxWindow *win )
{ {
if (g_blockEventsOnDrag) return FALSE; if (g_blockEventsOnDrag) return TRUE;
if (win->m_wxwindow) if (win->m_wxwindow)
{ {
if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow)) if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow))
@@ -433,7 +435,7 @@ gint gtk_window_focus_in_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUS
}; };
}; };
if (!win->HasVMT()) return FALSE; if (!win->HasVMT()) return TRUE;
/* /*
printf( "OnSetFocus from " ); printf( "OnSetFocus from " );
@@ -446,7 +448,9 @@ gint gtk_window_focus_in_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUS
wxFocusEvent event( wxEVT_SET_FOCUS, win->GetId() ); wxFocusEvent event( wxEVT_SET_FOCUS, win->GetId() );
event.SetEventObject( win ); event.SetEventObject( win );
return win->ProcessEvent( event ); win->ProcessEvent( event );
return TRUE;
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -454,14 +458,14 @@ gint gtk_window_focus_in_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUS
gint gtk_window_focus_out_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxWindow *win ) gint gtk_window_focus_out_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxWindow *win )
{ {
if (g_blockEventsOnDrag) return FALSE; if (g_blockEventsOnDrag) return TRUE;
if (win->m_wxwindow) if (win->m_wxwindow)
{ {
if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow)) if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow))
GTK_WIDGET_UNSET_FLAGS (win->m_wxwindow, GTK_HAS_FOCUS); GTK_WIDGET_UNSET_FLAGS (win->m_wxwindow, GTK_HAS_FOCUS);
}; };
if (!win->HasVMT()) return FALSE; if (!win->HasVMT()) return TRUE;
/* /*
printf( "OnKillFocus from " ); printf( "OnKillFocus from " );
@@ -472,7 +476,9 @@ gint gtk_window_focus_out_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNU
wxFocusEvent event( wxEVT_KILL_FOCUS, win->GetId() ); wxFocusEvent event( wxEVT_KILL_FOCUS, win->GetId() );
event.SetEventObject( win ); event.SetEventObject( win );
return win->ProcessEvent( event ); win->ProcessEvent( event );
return TRUE;
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -616,8 +622,6 @@ void gtk_window_hscroll_change_callback( GtkWidget *WXUNUSED(widget), wxWindow *
void gtk_window_drop_callback( GtkWidget *widget, GdkEvent *event, wxWindow *win ) void gtk_window_drop_callback( GtkWidget *widget, GdkEvent *event, wxWindow *win )
{ {
printf( "OnDrop.\n" );
if (win->GetDropTarget()) if (win->GetDropTarget())
{ {
int x = 0; int x = 0;
@@ -961,9 +965,6 @@ void wxWindow::PostCreation(void)
gtk_signal_connect( GTK_OBJECT(connect_widget), "focus_out_event", gtk_signal_connect( GTK_OBJECT(connect_widget), "focus_out_event",
GTK_SIGNAL_FUNC(gtk_window_focus_out_callback), (gpointer)this ); GTK_SIGNAL_FUNC(gtk_window_focus_out_callback), (gpointer)this );
gtk_signal_connect( GTK_OBJECT(connect_widget), "drop_data_available_event",
GTK_SIGNAL_FUNC(gtk_window_drop_callback), (gpointer)this );
// Only for cursor handling // Only for cursor handling
gtk_signal_connect( GTK_OBJECT(m_widget), "enter_notify_event", gtk_signal_connect( GTK_OBJECT(m_widget), "enter_notify_event",
@@ -1480,6 +1481,7 @@ void wxWindow::AddChild( wxWindow *child )
m_children.Append( child ); m_children.Append( child );
if (m_wxwindow) gtk_myfixed_put( GTK_MYFIXED(m_wxwindow), child->m_widget, child->m_x, child->m_y ); 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 ); gtk_widget_set_usize( child->m_widget, child->m_width, child->m_height );
}; };
@@ -1693,17 +1695,23 @@ void wxWindow::InitDialog(void)
void wxWindow::SetDropTarget( wxDropTarget *dropTarget ) void wxWindow::SetDropTarget( wxDropTarget *dropTarget )
{ {
GtkWidget *connect_widget = m_widget; GtkWidget *dnd_widget = GetDropTargetWidget();
if (m_wxwindow) connect_widget = m_wxwindow;
if (m_pDropTarget) if (m_pDropTarget)
{ {
m_pDropTarget->UnregisterWidget( connect_widget ); gtk_signal_disconnect_by_func( GTK_OBJECT(dnd_widget),
GTK_SIGNAL_FUNC(gtk_window_drop_callback), (gpointer)this );
m_pDropTarget->UnregisterWidget( dnd_widget );
delete m_pDropTarget; delete m_pDropTarget;
}; };
m_pDropTarget = dropTarget; m_pDropTarget = dropTarget;
if (m_pDropTarget) if (m_pDropTarget)
{ {
m_pDropTarget->RegisterWidget( connect_widget ); m_pDropTarget->RegisterWidget( dnd_widget );
gtk_signal_connect( GTK_OBJECT(dnd_widget), "drop_data_available_event",
GTK_SIGNAL_FUNC(gtk_window_drop_callback), (gpointer)this );
}; };
}; };
@@ -1712,6 +1720,14 @@ wxDropTarget *wxWindow::GetDropTarget() const
return m_pDropTarget; return m_pDropTarget;
}; };
GtkWidget* wxWindow::GetDropTargetWidget(void)
{
GtkWidget *connect_widget = m_widget;
if (m_wxwindow) connect_widget = m_wxwindow;
return connect_widget;
}
void wxWindow::SetFont( const wxFont &font ) void wxWindow::SetFont( const wxFont &font )
{ {
m_font = font; m_font = font;
@@ -2445,7 +2461,7 @@ bool wxWindow::AcceptsFocus() const
return IsEnabled() && IsShown(); return IsEnabled() && IsShown();
} }
void wxWindow::OnIdle(wxIdleEvent& event) void wxWindow::OnIdle(wxIdleEvent& WXUNUSED(event) )
{ {
UpdateWindowUI(); UpdateWindowUI();
} }

View File

@@ -28,6 +28,8 @@
#include <../iodbc/itrace.h> #include <../iodbc/itrace.h>
#include <stdio.h> #include <stdio.h>
extern RETCODE _iodbcdm_driverunload();
RETCODE SQL_API SQLAllocConnect( RETCODE SQL_API SQLAllocConnect(
HENV henv, HENV henv,
HDBC FAR* phdbc ) HDBC FAR* phdbc )
@@ -156,7 +158,7 @@ RETCODE SQL_API SQLSetConnectOption(
UWORD fOption, UWORD fOption,
UDWORD vParam ) UDWORD vParam )
{ {
GENV_t FAR* genv; /* GENV_t FAR* genv; */
DBC_t FAR* pdbc = (DBC_t FAR*)hdbc; DBC_t FAR* pdbc = (DBC_t FAR*)hdbc;
STMT_t FAR* pstmt; STMT_t FAR* pstmt;
HPROC hproc = SQL_NULL_HPROC; HPROC hproc = SQL_NULL_HPROC;
@@ -496,7 +498,7 @@ RETCODE SQL_API SQLGetConnectOption(
UWORD fOption, UWORD fOption,
PTR pvParam ) PTR pvParam )
{ {
GENV_t FAR* genv; /* GENV_t FAR* genv; */
DBC_t FAR* pdbc = (DBC_t FAR*)hdbc; DBC_t FAR* pdbc = (DBC_t FAR*)hdbc;
int sqlstat = en_00000; int sqlstat = en_00000;
HPROC hproc = SQL_NULL_HPROC; HPROC hproc = SQL_NULL_HPROC;
@@ -755,7 +757,7 @@ RETCODE SQL_API SQLTransact(
GENV_t FAR* genv = (GENV_t FAR*)henv; GENV_t FAR* genv = (GENV_t FAR*)henv;
DBC_t FAR* pdbc = (DBC_t FAR*)hdbc; DBC_t FAR* pdbc = (DBC_t FAR*)hdbc;
HERR herr; HERR herr;
RETCODE retcode; RETCODE retcode = 0;
if( hdbc != SQL_NULL_HDBC ) if( hdbc != SQL_NULL_HDBC )
{ {

View File

@@ -189,7 +189,7 @@ RETCODE SQL_API SQLFreeStmt (
UWORD fOption ) UWORD fOption )
{ {
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt; STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
STMT_t FAR* tpstmt; /* STMT_t FAR* tpstmt; */
DBC_t FAR* pdbc; DBC_t FAR* pdbc;
HPROC hproc = SQL_NULL_HPROC; HPROC hproc = SQL_NULL_HPROC;

326
user/wxFile/FMJobs.cpp Normal file
View File

@@ -0,0 +1,326 @@
/*
* Program: FMJobs.cpp
*
* Author: Robert Roebling
*
* Copyright: (C) 1997, GNU (Robert Roebling)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifdef __GNUG__
#pragma implementation "FMJobs.h"
#endif
#include "FMJobs.h"
#include "wx/utils.h"
#include "wx/filefn.h"
#include "wx/msgdlg.h"
//-----------------------------------------------------------------------------
// wxCopyStatusDia
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxCopyStatusDia,wxDialog);
const ID_CANCEL_COPY = 1000;
BEGIN_EVENT_TABLE(wxCopyStatusDia,wxDialog)
EVT_BUTTON (ID_CANCEL_COPY, wxCopyStatusDia::OnCommand)
END_EVENT_TABLE()
wxCopyStatusDia::wxCopyStatusDia( wxFrame *parent, const wxString &dest, wxArrayString *files ) :
wxDialog( parent, -1, "FileMaker copy job control", wxPoint(180,180), wxSize(500,200) )
{
int w = 0;
int h = 0;
GetSize( &w, &h );
m_dest = dest;
m_files = files;
m_stop = FALSE;
(void)new wxStaticText( this, -1, "Copying files", wxPoint(10,10) );
(void)new wxStaticText( this, -1, "from:", wxPoint(30,40) );
m_sourceMsg = new wxStaticText( this, -1, "", wxPoint(80,40), wxSize(200,-1) );
(void)new wxStaticText( this, -1, " to:", wxPoint(30,70) );
m_destMsg = new wxStaticText( this, -1, "", wxPoint(80,70), wxSize(200,-1) );
(void)new wxStaticText( this, -1, " Kb copied:", wxPoint(30,100) );
m_statusMsg = new wxStaticText( this, -1, "0", wxPoint(120,100), wxSize(100,-1) );
m_cancelButton = new wxButton( this, ID_CANCEL_COPY, "Return", wxPoint(w-130,h-50), wxSize(85,30) );
Centre( wxVERTICAL | wxHORIZONTAL );
m_timer = new wxCopyTimer( this );
m_timer->Start( 300, TRUE );
Show( TRUE );
};
wxCopyStatusDia::~wxCopyStatusDia()
{
delete m_timer;
};
void wxCopyStatusDia::OnCommand( wxCommandEvent &WXUNUSED(event) )
{
if (m_stop) EndModal(wxID_CANCEL);
m_stop = TRUE;
};
void wxCopyStatusDia::DoCopy(void)
{
wxYield();
if (!wxDirExists(m_dest))
{
wxMessageBox( "Target is not a directory or it doesn`t exist. Can`t copy.", "FileMaker" );
return;
};
for (uint i = 0; i < m_files->Count(); i++)
{
wxString src = (*m_files)[i];
if (wxDirExists( src ))
CopyDir( src, m_dest );
else
CopyFile( src, m_dest );
if (m_stop) return;
};
m_stop = TRUE;
};
void wxCopyStatusDia::CopyDir( wxString &srcDir, wxString &destDir )
{
wxString src = srcDir;
wxString dest = destDir;
dest += "/";
dest += wxFileNameFromPath( src );
if (!wxMkdir( dest ))
{
wxMessageBox( "Could not create target directory.", "FileMaker" );
return;
};
wxArrayString list;
src += "/*";
char *f = wxFindFirstFile( src, wxDIR );
while (f)
{
list.Add( f );
f = wxFindNextFile();
};
for (uint i = 0; i < list.Count(); i++)
{
wxString filename = list[i];
if (wxDirExists( filename ))
CopyDir( filename, dest );
else
CopyFile( filename, dest );
if (m_stop) return;
};
};
void wxCopyStatusDia::CopyFile( wxString &src, wxString &destDir )
{
m_sourceMsg->SetLabel( src );
wxString dest = destDir;
dest += "/";
dest += wxFileNameFromPath( src );
m_destMsg->SetLabel( dest );
wxYield();
if (wxFileExists(dest))
{
wxString s = "Target file ";
s += dest;
s += " exists already. Overwrite?";
int ret = wxMessageBox( s, "FileMaker", wxYES_NO );
if (ret == wxNO) return;
};
FILE *fs = NULL, *fd = NULL;
if (!(fs = fopen(src, "rb")))
{
wxString s = "Cannot open source file ";
s += src;
s += ".";
wxMessageBox( s, "FileMaker" );
return;
}
else
if (!(fd = fopen(dest, "wb")))
{
fclose(fs);
wxString s = "Cannot open target file ";
s += dest;
s += ".";
wxMessageBox( s, "FileMaker" );
return;
};
int ch;
long kcounter = 0;
while (!m_stop)
{
int counter = 0;
while ((ch = getc( fs )) != EOF)
{
putc( ch, fd );
counter++;
if (counter == 1000) break;
};
kcounter++;
m_statusMsg->SetLabel( IntToString( kcounter) );
wxYield();
if (ch == EOF) break;
};
fclose( fs );
fclose( fd );
};
//-----------------------------------------------------------------------------
// wxDeleteStatusDia
//-----------------------------------------------------------------------------
/*
IMPLEMENT_DYNAMIC_CLASS(wxDeleteStatusDia,wxDialogBox);
wxDeleteStatusDia::wxDeleteStatusDia( wxFrame *parent, wxStringList *files ) :
wxDialogBox( parent, "FileMaker delete job control", TRUE,
180, 180, 500, 200, wxCAPTION | wxTRANSIENT )
{
int w = 0;
int h = 0;
GetSize( &w, &h );
m_files = files;
m_stop = FALSE;
m_countFiles = 0;
m_countDirs = 0;
wxFont *myFont = wxTheFontList->FindOrCreateFont( 12, wxROMAN, wxNORMAL, wxNORMAL );
SetLabelFont( myFont );
SetButtonFont( myFont );
wxStaticText *msg = new wxStaticText( this, "Deleting file or directory:", 10, 10 );
m_targetMsg = new wxStaticText( this, "", 80, 40, 300 );
msg = new wxStaticText( this, " Directories deleted:", 10, 80 );
m_dirsMsg = new wxStaticText( this, "0", 120, 80, 80 );
msg = new wxStaticText( this, " Files deleted:", 10, 110 );
m_filesMsg = new wxStaticText( this, "0", 120, 110, 100 );
m_cancelButton = new wxButton( this, NULL, "Return", w-130, h-50, 85, 30 );
Centre( wxVERTICAL | wxHORIZONTAL );
m_timer = new wxDeleteTimer( this );
m_timer->Start( 300, TRUE );
Show( TRUE );
};
wxDeleteStatusDia::~wxDeleteStatusDia()
{
delete m_timer;
};
void wxDeleteStatusDia::OnCommand( wxWindow &win, wxCommandEvent &WXUNUSED(event) )
{
if (&win == m_cancelButton)
{
if (m_stop) Show( FALSE );
m_stop = TRUE;
return;
};
};
void wxDeleteStatusDia::DoDelete(void)
{
while (wxTheApp->Pending()) wxTheApp->Dispatch();
wxNode *node = m_files->First();
while (node)
{
char *target = (char*)node->Data();
if (wxDirExists( target ))
DeleteDir( target );
else
DeleteFile( target );
if (m_stop) return;
node = node->Next();
};
m_stop = TRUE;
};
void wxDeleteStatusDia::DeleteDir( char *target )
{
wxString s = target;
s += "// *";
wxStringList list;
char *f = wxFindFirstFile( s );
while (f)
{
list.Add( f );
f = wxFindNextFile();
};
wxNode *node = list.First();
while (node)
{
f = (char*)node->Data();
if (wxDirExists( f ))
DeleteDir( f );
else
DeleteFile( f );
if (m_stop) return;
node = node->Next();
};
if (!wxRmdir( target ))
{
s = "Could not remove directory ";
s += target;
s += ".";
wxMessageBox( s, "FileMaker" );
return;
}
else
{
m_countDirs++;
m_dirsMsg->SetLabel( wxIntToString( m_countDirs) );
};
};
void wxDeleteStatusDia::DeleteFile( char *target )
{
m_targetMsg->SetLabel( target );
while (wxTheApp->Pending()) wxTheApp->Dispatch();
if (!wxRemoveFile( target ))
{
wxString s = "Could not delete file ";
s += target;
s += ".";
wxMessageBox( s, "FileMaker" );
}
else
{
m_countFiles++;
m_filesMsg->SetLabel( wxIntToString( m_countFiles) );
};
};
*/

143
user/wxFile/FMJobs.h Normal file
View File

@@ -0,0 +1,143 @@
/*
* File: FMJobs.h
*
* Author: Robert Roebling
*
* Copyright: (C) 1997, GNU (Robert Roebling)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef FMJobs_h
#define FMJobs_h
#ifdef __GNUG__
#pragma interface
#endif
#include "wx/defs.h"
#include "wx/dialog.h"
#include "wx/frame.h"
#include "wx/button.h"
#include "wx/stattext.h"
#include "wx/timer.h"
//-----------------------------------------------------------------------------
// derived classes
//-----------------------------------------------------------------------------
class wxCopyStatusDia;
class wxDeleteStatusDia;
class wxCopyTimer;
class wxDeleteTimer;
//-----------------------------------------------------------------------------
// wxCopyStatusDia
//-----------------------------------------------------------------------------
class wxCopyStatusDia: public wxDialog
{
DECLARE_DYNAMIC_CLASS( wxCopyStatusDia );
private:
wxString m_dest;
wxArrayString *m_files;
wxButton *m_cancelButton;
wxStaticText *m_sourceMsg;
wxStaticText *m_destMsg;
wxStaticText *m_statusMsg;
bool m_stop;
wxTimer *m_timer;
public:
wxCopyStatusDia(void) : wxDialog() {};
wxCopyStatusDia( wxFrame *parent, const wxString &dest, wxArrayString *files );
~wxCopyStatusDia();
void OnCommand( wxCommandEvent &event );
void DoCopy(void);
private:
void CopyDir( wxString &srcDir, wxString &destDir );
void CopyFile( wxString &src, wxString &destDir );
DECLARE_EVENT_TABLE();
};
//-----------------------------------------------------------------------------
// wxDeleteStatusDia
//-----------------------------------------------------------------------------
/*
class wxDeleteStatusDia: public wxDialog
{
DECLARE_DYNAMIC_CLASS( wxDeleteStatusDia );
private:
wxArrayString *m_files;
wxButton *m_cancelButton;
wxStaticText *m_targetMsg;
wxStaticText *m_filesMsg,*m_dirsMsg;
bool m_stop;
wxTimer *m_timer;
int m_countFiles,m_countDirs;
public:
wxDeleteStatusDia(void) : wxDialog() {};
wxDeleteStatusDia( wxFrame *parent, wxArrayString *files );
~wxDeleteStatusDia();
void OnCommand( wxCommandEvent &event );
void DoDelete(void);
private:
void DeleteDir( wxString &target );
void DeleteFile( wxString &target );
DECLARE_EVENT_TABLE();
};
*/
//-----------------------------------------------------------------------------
// wxTimer
//-----------------------------------------------------------------------------
class wxCopyTimer: public wxTimer
{
private:
wxCopyStatusDia *m_owner;
public:
wxCopyTimer( wxCopyStatusDia *owner ) { m_owner = owner; };
void Notify() { m_owner->DoCopy(); };
};
/*
class wxDeleteTimer: public wxTimer
{
private:
wxDeleteStatusDia *m_owner;
public:
wxDeleteTimer( wxDeleteStatusDia *owner ) { m_owner = owner; };
void Notify() { m_owner->DoDelete(); };
};
*/
#endif // FMJobs_h

View File

@@ -10,11 +10,11 @@ RULE=bin
BIN_TARGET=wxFile BIN_TARGET=wxFile
# define library sources # define library sources
BIN_SRC=\ BIN_SRC=\
wxFile.cpp filectrl.cpp dirctrl.cpp wxFile.cpp filectrl.cpp dirctrl.cpp FMJobs.cpp
#define library objects #define library objects
BIN_OBJ=\ BIN_OBJ=\
wxFile.o filectrl.o dirctrl.o wxFile.o filectrl.o dirctrl.o FMJobs.o
# additional things needed to link # additional things needed to link
BIN_LINK= BIN_LINK=

View File

@@ -16,6 +16,7 @@
#include "dirctrl.h" #include "dirctrl.h"
#include "wx/gdicmn.h" #include "wx/gdicmn.h"
#include "wx/utils.h" #include "wx/utils.h"
#include "wx/dnd.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxDirInfo // wxDirInfo
@@ -75,7 +76,6 @@ BEGIN_EVENT_TABLE(wxDirCtrl,wxTreeCtrl)
EVT_TREE_ITEM_EXPANDED (-1, wxDirCtrl::OnExpandItem) EVT_TREE_ITEM_EXPANDED (-1, wxDirCtrl::OnExpandItem)
EVT_TREE_ITEM_COLLAPSED (-1, wxDirCtrl::OnCollapseItem) EVT_TREE_ITEM_COLLAPSED (-1, wxDirCtrl::OnCollapseItem)
EVT_TREE_DELETE_ITEM (-1, wxDirCtrl::OnDeleteItem) EVT_TREE_DELETE_ITEM (-1, wxDirCtrl::OnDeleteItem)
EVT_MOUSE_EVENTS (wxDirCtrl::OnMouse)
END_EVENT_TABLE() END_EVENT_TABLE()
wxDirCtrl::wxDirCtrl(void) wxDirCtrl::wxDirCtrl(void)
@@ -95,11 +95,9 @@ wxDirCtrl::wxDirCtrl(wxWindow *parent, const wxWindowID id, const wxString &WXUN
item.m_mask = wxTREE_MASK_TEXT | wxTREE_MASK_CHILDREN | wxTREE_MASK_DATA; item.m_mask = wxTREE_MASK_TEXT | wxTREE_MASK_CHILDREN | wxTREE_MASK_DATA;
item.m_text = "Sections"; item.m_text = "Sections";
item.m_children = 1; item.m_children = 1;
/*
wxDirInfo *info = new wxDirInfo( dir );
item.m_data = (long)info;
*/
m_rootId = InsertItem( 0, item ); m_rootId = InsertItem( 0, item );
SetDropTarget( new wxFileDropTarget() );
}; };
void wxDirCtrl::OnExpandItem( const wxTreeEvent &event ) void wxDirCtrl::OnExpandItem( const wxTreeEvent &event )
@@ -180,6 +178,7 @@ void wxDirCtrl::OnExpandItem( const wxTreeEvent &event )
(path != "/proc") && (path != "/proc") &&
(path != "/mnt") (path != "/mnt")
) )
slist.Add( path ); // ref counting in action ! slist.Add( path ); // ref counting in action !
}; };
path = wxFindNextFile(); path = wxFindNextFile();
@@ -212,26 +211,3 @@ void wxDirCtrl::OnDeleteItem( const wxTreeEvent &event )
wxDirInfo *info = (wxDirInfo *)event.m_item.m_data; wxDirInfo *info = (wxDirInfo *)event.m_item.m_data;
if (info) delete info; if (info) delete info;
}; };
void wxDirCtrl::OnMouse( wxMouseEvent &event )
{
event.Skip(TRUE);
if (event.LeftDown())
{
m_dragX = event.GetX();
m_dragY = event.GetY();
return;
};
if (event.Dragging())
{
if ((abs(m_dragX-event.GetX()) < 2) &&
(abs(m_dragY-event.GetY()) < 2)) return;
wxTextDragSource drag( this );
drag.SetTextData( "Oh, what a drag." );
drag.Start( event.GetX(), event.GetY() );
};
};

View File

@@ -67,7 +67,6 @@ class wxDirCtrl: public wxTreeCtrl
void OnExpandItem( const wxTreeEvent &event ); void OnExpandItem( const wxTreeEvent &event );
void OnCollapseItem( const wxTreeEvent &event ); void OnCollapseItem( const wxTreeEvent &event );
void OnDeleteItem( const wxTreeEvent &event ); void OnDeleteItem( const wxTreeEvent &event );
void OnMouse( wxMouseEvent &event );
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };

View File

@@ -222,8 +222,8 @@ wxFileCtrl::wxFileCtrl( wxWindow *win, const wxWindowID id, const wxString &dirN
const long style, const wxString &name ) : const long style, const wxString &name ) :
wxListCtrl( win, id, pos, size, style, name ) wxListCtrl( win, id, pos, size, style, name )
{ {
SetItemSpacing( 20 ); SetItemSpacing( 40 );
wxImageList *imageList = new wxImageList( 18, 18 ); wxImageList *imageList = new wxImageList( 30, 30 );
imageList->Add( wxBitmap( folder_xpm ) ); imageList->Add( wxBitmap( folder_xpm ) );
imageList->Add( wxBitmap( txt_xpm ) ); imageList->Add( wxBitmap( txt_xpm ) );
imageList->Add( wxBitmap( list_xpm ) ); imageList->Add( wxBitmap( list_xpm ) );
@@ -237,7 +237,11 @@ wxFileCtrl::wxFileCtrl( wxWindow *win, const wxWindowID id, const wxString &dirN
m_lastFocus = this; m_lastFocus = this;
SetDropTarget( new wxTextDropTarget() ); m_dragStartX = 0;
m_dragStartY = 0;
m_dragCount = 0;
SetDropTarget( new wxFileDropTarget() );
}; };
void wxFileCtrl::ChangeToListMode() void wxFileCtrl::ChangeToListMode()
@@ -538,4 +542,3 @@ void wxFileCtrl::OnSetFocus( wxFocusEvent &event )
event.Skip(); event.Skip();
}; };

View File

@@ -79,6 +79,9 @@ class wxFileCtrl : public wxListCtrl
private: private:
wxString m_dirName; wxString m_dirName;
bool m_showHidden; bool m_showHidden;
int m_dragStartX;
int m_dragStartY;
int m_dragCount;
public: public:
wxFileCtrl( void ); wxFileCtrl( void );

View File

@@ -312,8 +312,11 @@ void MyFrame::OnListEndLabelEdit( wxListEvent &event )
void MyFrame::OnListDrag( wxListEvent &event ) void MyFrame::OnListDrag( wxListEvent &event )
{ {
printf( "OnDrag.\n" ); wxFileDataObject data;
return; data.AddFile( "/home/karl/test.txt" );
wxDropSource drag( data, m_leftFile->m_lastFocus );
drag.DoDragDrop();
}; };
void MyFrame::OnTreeSelected( wxTreeEvent &event ) void MyFrame::OnTreeSelected( wxTreeEvent &event )