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:
@@ -17,7 +17,7 @@
|
||||
#include <wx/stream.h>
|
||||
#include <wx/zstream.h>
|
||||
#include <wx/utils.h>
|
||||
#include "zlib.h"
|
||||
#include "../zlib/zlib.h" // don't change this, Robert
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
|
@@ -485,7 +485,7 @@ void wxGenericGrid::PaintGrid(wxDC& dc)
|
||||
|
||||
// Erase (some of) the background.
|
||||
// Currently, a Windows-only optimisation.
|
||||
void wxGenericGrid::OnEraseBackground(wxEraseEvent& event)
|
||||
void wxGenericGrid::OnEraseBackground(wxEraseEvent& WXUNUSED(event) )
|
||||
{
|
||||
wxClientDC dc(this);
|
||||
dc.BeginDrawing();
|
||||
|
@@ -439,7 +439,7 @@ long wxListLineData::IsHit( int x, int y )
|
||||
wxListItemData *item = (wxListItemData*)node->Data();
|
||||
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->HasImage() || item->HasText())) return 0;
|
||||
// if (!(item->HasImage() || item->HasText())) return 0;
|
||||
};
|
||||
// if there is no icon or text = empty
|
||||
if (IsInRect( x, y, m_bound_all )) return wxLIST_HITTEST_ONITEMICON;
|
||||
@@ -806,7 +806,7 @@ wxListMainWindow::wxListMainWindow( void )
|
||||
m_lastOnSame = FALSE;
|
||||
// m_renameTimer = new wxRenameTimer( this );
|
||||
m_isCreated = FALSE;
|
||||
m_isDragging = FALSE;
|
||||
m_dragCount = 0;
|
||||
};
|
||||
|
||||
wxListMainWindow::wxListMainWindow( wxWindow *parent, wxWindowID id,
|
||||
@@ -828,7 +828,7 @@ wxListMainWindow::wxListMainWindow( wxWindow *parent, wxWindowID id,
|
||||
// AllowDoubleClick( TRUE );
|
||||
m_myFont = wxNORMAL_FONT;
|
||||
m_hasFocus = FALSE;
|
||||
m_isDragging = FALSE;
|
||||
m_dragCount = 0;
|
||||
m_isCreated = FALSE;
|
||||
wxSize sz = size;
|
||||
sz.y = 25;
|
||||
@@ -1032,9 +1032,10 @@ void wxListMainWindow::OnRenameAccept()
|
||||
|
||||
void wxListMainWindow::OnMouse( wxMouseEvent &event )
|
||||
{
|
||||
if (m_parent->ProcessEvent( event)) return;
|
||||
|
||||
if (!m_current) return;
|
||||
if (m_dirty) return;
|
||||
// wxDragCanvas::OnEvent( event );
|
||||
|
||||
wxClientDC dc(this);
|
||||
PrepareDC(dc);
|
||||
@@ -1053,11 +1054,14 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
|
||||
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() );
|
||||
le.SetEventObject( this );
|
||||
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 ret = 0;
|
||||
@@ -2197,9 +2220,10 @@ bool wxListCtrl::GetItemRect( long item, wxRectangle &rect, int WXUNUSED(code)
|
||||
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) )
|
||||
@@ -2403,7 +2427,7 @@ bool wxListCtrl::SortItems( wxListCtrlCompare fn, long data )
|
||||
return TRUE;
|
||||
};
|
||||
|
||||
void wxListCtrl::OnIdle( wxIdleEvent &event )
|
||||
void wxListCtrl::OnIdle( wxIdleEvent &WXUNUSED(event) )
|
||||
{
|
||||
if (!m_mainWin->m_dirty) return;
|
||||
|
||||
|
@@ -87,10 +87,21 @@ IMPLEMENT_DYNAMIC_CLASS(wxPaintDC,wxDC)
|
||||
|
||||
wxPaintDC::wxPaintDC(void)
|
||||
{
|
||||
m_penGC = NULL;
|
||||
m_brushGC = NULL;
|
||||
m_textGC = NULL;
|
||||
m_bgGC = NULL;
|
||||
m_cmap = NULL;
|
||||
};
|
||||
|
||||
wxPaintDC::wxPaintDC( wxWindow *window )
|
||||
{
|
||||
m_penGC = NULL;
|
||||
m_brushGC = NULL;
|
||||
m_textGC = NULL;
|
||||
m_bgGC = NULL;
|
||||
m_cmap = NULL;
|
||||
|
||||
if (!window) return;
|
||||
GtkWidget *widget = window->m_wxwindow;
|
||||
if (!widget) return;
|
||||
@@ -777,9 +788,13 @@ void wxPaintDC::SetUpDC(void)
|
||||
{
|
||||
m_ok = TRUE;
|
||||
m_logicalFunction = wxCOPY;
|
||||
if (m_penGC) gdk_gc_unref( m_penGC );
|
||||
m_penGC = gdk_gc_new( m_window );
|
||||
if (m_brushGC) gdk_gc_unref( m_brushGC );
|
||||
m_brushGC = gdk_gc_new( m_window );
|
||||
if (m_textGC) gdk_gc_unref( m_textGC );
|
||||
m_textGC = gdk_gc_new( m_window );
|
||||
if (m_bgGC) gdk_gc_unref( m_bgGC );
|
||||
m_bgGC = gdk_gc_new( m_window );
|
||||
SetTextForeground( m_textForegroundColour );
|
||||
SetTextBackground( m_textBackgroundColour );
|
||||
|
204
src/gtk/dnd.cpp
204
src/gtk/dnd.cpp
@@ -46,9 +46,41 @@ void wxDropTarget::Drop( GdkEvent *event, int x, int y )
|
||||
|
||||
void wxDropTarget::UnregisterWidget( GtkWidget *widget )
|
||||
{
|
||||
if (!widget) return;
|
||||
|
||||
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
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -66,63 +98,115 @@ bool wxTextDropTarget::OnDropText( long x, long y, const char *psz )
|
||||
return TRUE;
|
||||
};
|
||||
|
||||
void wxTextDropTarget::RegisterWidget( GtkWidget *widget )
|
||||
size_t wxTextDropTarget::GetFormatCount() const
|
||||
{
|
||||
char *accepted_drop_types[] = { "text/plain" };
|
||||
gtk_widget_dnd_drop_set( widget, TRUE, accepted_drop_types, 1, FALSE );
|
||||
};
|
||||
return 1;
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
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;
|
||||
|
||||
|
||||
m_window = win;
|
||||
m_widget = win->m_widget;
|
||||
if (win->m_wxwindow) m_widget = win->m_wxwindow;
|
||||
|
||||
m_data = NULL;
|
||||
m_size = 0;
|
||||
|
||||
m_data = NULL;
|
||||
|
||||
m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY );
|
||||
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;
|
||||
};
|
||||
|
||||
void wxDragSource::SetData( char *data, long size )
|
||||
wxDropSource::DragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
|
||||
{
|
||||
m_size = size;
|
||||
m_data = data;
|
||||
};
|
||||
|
||||
void wxDragSource::Start( int x, int y )
|
||||
{
|
||||
if (gdk_dnd.dnd_grabbed) return;
|
||||
if (gdk_dnd.drag_really) return;
|
||||
if (m_size == 0) return;
|
||||
if (!m_data) return;
|
||||
if (gdk_dnd.dnd_grabbed) return None;
|
||||
if (gdk_dnd.drag_really) return None;
|
||||
|
||||
if (!m_data) return None;
|
||||
if (m_data->GetDataSize() == 0) return None;
|
||||
|
||||
GdkWindowPrivate *wp = (GdkWindowPrivate*) m_widget->window;
|
||||
|
||||
RegisterWindow();
|
||||
ConnectWindow();
|
||||
|
||||
gdk_dnd.drag_perhaps = TRUE;
|
||||
|
||||
@@ -159,49 +243,53 @@ void wxDragSource::Start( int x, int y )
|
||||
|
||||
gdk_dnd.dnd_grabbed = TRUE;
|
||||
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 );
|
||||
|
||||
while (gdk_dnd.drag_really || gdk_dnd.drag_perhaps) wxYield();
|
||||
|
||||
UnconnectWindow();
|
||||
UnregisterWindow();
|
||||
};
|
||||
|
||||
void wxDragSource::ConnectWindow(void)
|
||||
{
|
||||
gtk_signal_connect( GTK_OBJECT(m_widget), "drag_request_event",
|
||||
GTK_SIGNAL_FUNC(gtk_drag_callback), (gpointer)this );
|
||||
};
|
||||
|
||||
void wxDragSource::UnconnectWindow(void)
|
||||
{
|
||||
if (!m_widget) return;
|
||||
|
||||
gtk_signal_disconnect_by_data( GTK_OBJECT(m_widget), (gpointer)this );
|
||||
return Copy;
|
||||
};
|
||||
|
||||
void wxDragSource::UnregisterWindow(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_FUNC(gtk_drag_callback), (gpointer)m_data );
|
||||
};
|
||||
|
||||
void wxDropSource::UnregisterWindow(void)
|
||||
{
|
||||
if (!m_widget) return;
|
||||
|
||||
gtk_widget_dnd_drag_set( m_widget, FALSE, NULL, 0 );
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// wxTextDragSource
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
void wxTextDragSource::SetTextData( const wxString &text )
|
||||
{
|
||||
m_tmp = text;
|
||||
SetData( WXSTRINGCAST(m_tmp), m_tmp.Length()+1 );
|
||||
gtk_signal_disconnect_by_data( GTK_OBJECT(m_widget), (gpointer)m_data );
|
||||
};
|
||||
|
||||
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 );
|
||||
};
|
||||
|
||||
|
@@ -293,8 +293,7 @@ void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
|
||||
for(wxNode *node = GetChildren()->First(); node; node = node->Next())
|
||||
{
|
||||
wxWindow *win = (wxWindow *)node->Data();
|
||||
if (!win->IsKindOf(CLASSINFO(wxFrame)) &&
|
||||
!win->IsKindOf(CLASSINFO(wxDialog))
|
||||
if (!IS_KIND_OF(win,wxFrame) && !IS_KIND_OF(win,wxDialog)
|
||||
#if 0 // not in m_children anyway
|
||||
&& (win != m_frameMenuBar) &&
|
||||
(win != m_frameToolBar) &&
|
||||
@@ -318,6 +317,18 @@ void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
|
||||
|
||||
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)
|
||||
{
|
||||
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;
|
||||
};
|
||||
|
||||
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_frameToolBar = new wxToolBar( this, -1, wxDefaultPosition, wxDefaultSize, style );
|
||||
m_frameToolBar = new wxToolBar( this, id, wxDefaultPosition, wxDefaultSize, style, name );
|
||||
|
||||
m_addPrivateChild = FALSE;
|
||||
|
||||
@@ -392,15 +403,16 @@ wxToolBar *wxFrame::GetToolBar(void)
|
||||
return m_frameToolBar;
|
||||
};
|
||||
|
||||
bool wxFrame::CreateStatusBar( int number )
|
||||
wxStatusBar* wxFrame::CreateStatusBar( int number, long style, wxWindowID id, const wxString& name )
|
||||
{
|
||||
if (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 );
|
||||
return TRUE;
|
||||
|
||||
return m_frameStatusBar;
|
||||
};
|
||||
|
||||
void wxFrame::SetStatusText( const wxString &text, int number )
|
||||
|
@@ -26,8 +26,6 @@ bool wxGauge::Create( wxWindow *parent, wxWindowID id, int range,
|
||||
{
|
||||
m_needParent = TRUE;
|
||||
|
||||
wxSize newSize = size;
|
||||
|
||||
PreCreation( parent, id, pos, size, style, name );
|
||||
|
||||
m_rangeMax = range;
|
||||
|
@@ -99,6 +99,8 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
|
||||
|
||||
PostCreation();
|
||||
|
||||
gtk_widget_realize( GTK_WIDGET(m_list) );
|
||||
|
||||
Show( TRUE );
|
||||
|
||||
return TRUE;
|
||||
@@ -321,4 +323,10 @@ int wxListBox::GetIndex( GtkWidget *item ) const
|
||||
return -1;
|
||||
};
|
||||
|
||||
GtkWidget *wxListBox::GetDropTargetWidget(void)
|
||||
{
|
||||
return GTK_WIDGET(m_list);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
@@ -13,6 +13,7 @@
|
||||
#endif
|
||||
|
||||
#include "wx/mdi.h"
|
||||
#include "wx/dialog.h"
|
||||
#include "wx/gtk/win_gtk.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -174,6 +175,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame,wxPanel)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxMDIChildFrame, wxPanel)
|
||||
EVT_CLOSE(wxMDIChildFrame::OnCloseWindow)
|
||||
EVT_SIZE(wxMDIChildFrame::OnSize)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
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)
|
||||
{
|
||||
if (!wxPendingDelete.Member(this))
|
||||
|
@@ -109,10 +109,6 @@ static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation*
|
||||
// wxNotebook
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
BEGIN_EVENT_TABLE(wxNotebook, wxControl)
|
||||
EVT_SIZE(wxNotebook::OnSize)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxNotebook,wxControl)
|
||||
|
||||
void wxNotebook::Init()
|
||||
@@ -400,11 +396,6 @@ wxWindow *wxNotebook::GetPage( int page ) const
|
||||
|
||||
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);
|
||||
|
||||
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
|
||||
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
|
||||
wxControl::SetConstraintSizes(FALSE);
|
||||
}
|
||||
|
||||
bool wxNotebook::DoPhase(int /* nPhase */)
|
||||
bool wxNotebook::DoPhase( int WXUNUSED(nPhase) )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
@@ -179,7 +179,7 @@ void wxToolBar::ClearTools(void)
|
||||
{
|
||||
};
|
||||
|
||||
void wxToolBar::Layout(void)
|
||||
void wxToolBar::Realize(void)
|
||||
{
|
||||
m_x = 0;
|
||||
m_y = 0;
|
||||
|
@@ -385,3 +385,11 @@ wxTextCtrl& wxTextCtrl::operator<<(const char c)
|
||||
return *this;
|
||||
}
|
||||
|
||||
GtkWidget* wxTextCtrl::GetDropTargetWidget(void)
|
||||
{
|
||||
return GTK_WIDGET(m_text);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -349,7 +349,7 @@ typedef struct {
|
||||
} wxEndProcessData;
|
||||
|
||||
static void GTK_EndProcessDetector(gpointer data, gint source,
|
||||
GdkInputCondition condition)
|
||||
GdkInputCondition WXUNUSED(condition) )
|
||||
{
|
||||
wxEndProcessData *proc_data = (wxEndProcessData *)data;
|
||||
int pid;
|
||||
|
@@ -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 )
|
||||
{
|
||||
if (widget->window != gdk_event->window) return FALSE;
|
||||
if (g_blockEventsOnDrag) return FALSE;
|
||||
if (widget->window != gdk_event->window) return TRUE;
|
||||
if (g_blockEventsOnDrag) return TRUE;
|
||||
|
||||
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 " );
|
||||
@@ -342,9 +342,9 @@ gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_
|
||||
{
|
||||
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 " );
|
||||
@@ -374,7 +374,9 @@ gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_
|
||||
event.m_y = (long)gdk_event->y;
|
||||
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 (g_blockEventsOnDrag) return FALSE;
|
||||
if (g_blockEventsOnDrag) return TRUE;
|
||||
|
||||
if (!win->HasVMT()) return FALSE;
|
||||
if (!win->HasVMT()) return TRUE;
|
||||
|
||||
/*
|
||||
printf( "OnMotion from " );
|
||||
@@ -410,7 +412,7 @@ gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_e
|
||||
|
||||
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 )
|
||||
{
|
||||
if (g_blockEventsOnDrag) return FALSE;
|
||||
if (g_blockEventsOnDrag) return TRUE;
|
||||
if (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 " );
|
||||
@@ -446,7 +448,9 @@ gint gtk_window_focus_in_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUS
|
||||
|
||||
wxFocusEvent event( wxEVT_SET_FOCUS, win->GetId() );
|
||||
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 )
|
||||
{
|
||||
if (g_blockEventsOnDrag) return FALSE;
|
||||
if (g_blockEventsOnDrag) return TRUE;
|
||||
if (win->m_wxwindow)
|
||||
{
|
||||
if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow))
|
||||
GTK_WIDGET_UNSET_FLAGS (win->m_wxwindow, GTK_HAS_FOCUS);
|
||||
};
|
||||
|
||||
if (!win->HasVMT()) return FALSE;
|
||||
if (!win->HasVMT()) return TRUE;
|
||||
|
||||
/*
|
||||
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() );
|
||||
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 )
|
||||
{
|
||||
printf( "OnDrop.\n" );
|
||||
|
||||
if (win->GetDropTarget())
|
||||
{
|
||||
int x = 0;
|
||||
@@ -961,9 +965,6 @@ void wxWindow::PostCreation(void)
|
||||
gtk_signal_connect( GTK_OBJECT(connect_widget), "focus_out_event",
|
||||
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
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(m_widget), "enter_notify_event",
|
||||
@@ -1480,6 +1481,7 @@ void wxWindow::AddChild( wxWindow *child )
|
||||
|
||||
m_children.Append( child );
|
||||
if (m_wxwindow) gtk_myfixed_put( GTK_MYFIXED(m_wxwindow), child->m_widget, child->m_x, child->m_y );
|
||||
|
||||
gtk_widget_set_usize( child->m_widget, child->m_width, child->m_height );
|
||||
};
|
||||
|
||||
@@ -1693,17 +1695,23 @@ void wxWindow::InitDialog(void)
|
||||
|
||||
void wxWindow::SetDropTarget( wxDropTarget *dropTarget )
|
||||
{
|
||||
GtkWidget *connect_widget = m_widget;
|
||||
if (m_wxwindow) connect_widget = m_wxwindow;
|
||||
GtkWidget *dnd_widget = GetDropTargetWidget();
|
||||
|
||||
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;
|
||||
};
|
||||
m_pDropTarget = dropTarget;
|
||||
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;
|
||||
};
|
||||
|
||||
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 )
|
||||
{
|
||||
m_font = font;
|
||||
@@ -2445,7 +2461,7 @@ bool wxWindow::AcceptsFocus() const
|
||||
return IsEnabled() && IsShown();
|
||||
}
|
||||
|
||||
void wxWindow::OnIdle(wxIdleEvent& event)
|
||||
void wxWindow::OnIdle(wxIdleEvent& WXUNUSED(event) )
|
||||
{
|
||||
UpdateWindowUI();
|
||||
}
|
||||
|
@@ -87,10 +87,21 @@ IMPLEMENT_DYNAMIC_CLASS(wxPaintDC,wxDC)
|
||||
|
||||
wxPaintDC::wxPaintDC(void)
|
||||
{
|
||||
m_penGC = NULL;
|
||||
m_brushGC = NULL;
|
||||
m_textGC = NULL;
|
||||
m_bgGC = NULL;
|
||||
m_cmap = NULL;
|
||||
};
|
||||
|
||||
wxPaintDC::wxPaintDC( wxWindow *window )
|
||||
{
|
||||
m_penGC = NULL;
|
||||
m_brushGC = NULL;
|
||||
m_textGC = NULL;
|
||||
m_bgGC = NULL;
|
||||
m_cmap = NULL;
|
||||
|
||||
if (!window) return;
|
||||
GtkWidget *widget = window->m_wxwindow;
|
||||
if (!widget) return;
|
||||
@@ -777,9 +788,13 @@ void wxPaintDC::SetUpDC(void)
|
||||
{
|
||||
m_ok = TRUE;
|
||||
m_logicalFunction = wxCOPY;
|
||||
if (m_penGC) gdk_gc_unref( m_penGC );
|
||||
m_penGC = gdk_gc_new( m_window );
|
||||
if (m_brushGC) gdk_gc_unref( m_brushGC );
|
||||
m_brushGC = gdk_gc_new( m_window );
|
||||
if (m_textGC) gdk_gc_unref( m_textGC );
|
||||
m_textGC = gdk_gc_new( m_window );
|
||||
if (m_bgGC) gdk_gc_unref( m_bgGC );
|
||||
m_bgGC = gdk_gc_new( m_window );
|
||||
SetTextForeground( m_textForegroundColour );
|
||||
SetTextBackground( m_textBackgroundColour );
|
||||
|
204
src/gtk1/dnd.cpp
204
src/gtk1/dnd.cpp
@@ -46,9 +46,41 @@ void wxDropTarget::Drop( GdkEvent *event, int x, int y )
|
||||
|
||||
void wxDropTarget::UnregisterWidget( GtkWidget *widget )
|
||||
{
|
||||
if (!widget) return;
|
||||
|
||||
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
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -66,63 +98,115 @@ bool wxTextDropTarget::OnDropText( long x, long y, const char *psz )
|
||||
return TRUE;
|
||||
};
|
||||
|
||||
void wxTextDropTarget::RegisterWidget( GtkWidget *widget )
|
||||
size_t wxTextDropTarget::GetFormatCount() const
|
||||
{
|
||||
char *accepted_drop_types[] = { "text/plain" };
|
||||
gtk_widget_dnd_drop_set( widget, TRUE, accepted_drop_types, 1, FALSE );
|
||||
};
|
||||
return 1;
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
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;
|
||||
|
||||
|
||||
m_window = win;
|
||||
m_widget = win->m_widget;
|
||||
if (win->m_wxwindow) m_widget = win->m_wxwindow;
|
||||
|
||||
m_data = NULL;
|
||||
m_size = 0;
|
||||
|
||||
m_data = NULL;
|
||||
|
||||
m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY );
|
||||
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;
|
||||
};
|
||||
|
||||
void wxDragSource::SetData( char *data, long size )
|
||||
wxDropSource::DragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
|
||||
{
|
||||
m_size = size;
|
||||
m_data = data;
|
||||
};
|
||||
|
||||
void wxDragSource::Start( int x, int y )
|
||||
{
|
||||
if (gdk_dnd.dnd_grabbed) return;
|
||||
if (gdk_dnd.drag_really) return;
|
||||
if (m_size == 0) return;
|
||||
if (!m_data) return;
|
||||
if (gdk_dnd.dnd_grabbed) return None;
|
||||
if (gdk_dnd.drag_really) return None;
|
||||
|
||||
if (!m_data) return None;
|
||||
if (m_data->GetDataSize() == 0) return None;
|
||||
|
||||
GdkWindowPrivate *wp = (GdkWindowPrivate*) m_widget->window;
|
||||
|
||||
RegisterWindow();
|
||||
ConnectWindow();
|
||||
|
||||
gdk_dnd.drag_perhaps = TRUE;
|
||||
|
||||
@@ -159,49 +243,53 @@ void wxDragSource::Start( int x, int y )
|
||||
|
||||
gdk_dnd.dnd_grabbed = TRUE;
|
||||
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 );
|
||||
|
||||
while (gdk_dnd.drag_really || gdk_dnd.drag_perhaps) wxYield();
|
||||
|
||||
UnconnectWindow();
|
||||
UnregisterWindow();
|
||||
};
|
||||
|
||||
void wxDragSource::ConnectWindow(void)
|
||||
{
|
||||
gtk_signal_connect( GTK_OBJECT(m_widget), "drag_request_event",
|
||||
GTK_SIGNAL_FUNC(gtk_drag_callback), (gpointer)this );
|
||||
};
|
||||
|
||||
void wxDragSource::UnconnectWindow(void)
|
||||
{
|
||||
if (!m_widget) return;
|
||||
|
||||
gtk_signal_disconnect_by_data( GTK_OBJECT(m_widget), (gpointer)this );
|
||||
return Copy;
|
||||
};
|
||||
|
||||
void wxDragSource::UnregisterWindow(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_FUNC(gtk_drag_callback), (gpointer)m_data );
|
||||
};
|
||||
|
||||
void wxDropSource::UnregisterWindow(void)
|
||||
{
|
||||
if (!m_widget) return;
|
||||
|
||||
gtk_widget_dnd_drag_set( m_widget, FALSE, NULL, 0 );
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// wxTextDragSource
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
void wxTextDragSource::SetTextData( const wxString &text )
|
||||
{
|
||||
m_tmp = text;
|
||||
SetData( WXSTRINGCAST(m_tmp), m_tmp.Length()+1 );
|
||||
gtk_signal_disconnect_by_data( GTK_OBJECT(m_widget), (gpointer)m_data );
|
||||
};
|
||||
|
||||
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 );
|
||||
};
|
||||
|
||||
|
@@ -293,8 +293,7 @@ void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
|
||||
for(wxNode *node = GetChildren()->First(); node; node = node->Next())
|
||||
{
|
||||
wxWindow *win = (wxWindow *)node->Data();
|
||||
if (!win->IsKindOf(CLASSINFO(wxFrame)) &&
|
||||
!win->IsKindOf(CLASSINFO(wxDialog))
|
||||
if (!IS_KIND_OF(win,wxFrame) && !IS_KIND_OF(win,wxDialog)
|
||||
#if 0 // not in m_children anyway
|
||||
&& (win != m_frameMenuBar) &&
|
||||
(win != m_frameToolBar) &&
|
||||
@@ -318,6 +317,18 @@ void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
|
||||
|
||||
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)
|
||||
{
|
||||
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;
|
||||
};
|
||||
|
||||
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_frameToolBar = new wxToolBar( this, -1, wxDefaultPosition, wxDefaultSize, style );
|
||||
m_frameToolBar = new wxToolBar( this, id, wxDefaultPosition, wxDefaultSize, style, name );
|
||||
|
||||
m_addPrivateChild = FALSE;
|
||||
|
||||
@@ -392,15 +403,16 @@ wxToolBar *wxFrame::GetToolBar(void)
|
||||
return m_frameToolBar;
|
||||
};
|
||||
|
||||
bool wxFrame::CreateStatusBar( int number )
|
||||
wxStatusBar* wxFrame::CreateStatusBar( int number, long style, wxWindowID id, const wxString& name )
|
||||
{
|
||||
if (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 );
|
||||
return TRUE;
|
||||
|
||||
return m_frameStatusBar;
|
||||
};
|
||||
|
||||
void wxFrame::SetStatusText( const wxString &text, int number )
|
||||
|
@@ -26,8 +26,6 @@ bool wxGauge::Create( wxWindow *parent, wxWindowID id, int range,
|
||||
{
|
||||
m_needParent = TRUE;
|
||||
|
||||
wxSize newSize = size;
|
||||
|
||||
PreCreation( parent, id, pos, size, style, name );
|
||||
|
||||
m_rangeMax = range;
|
||||
|
@@ -99,6 +99,8 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
|
||||
|
||||
PostCreation();
|
||||
|
||||
gtk_widget_realize( GTK_WIDGET(m_list) );
|
||||
|
||||
Show( TRUE );
|
||||
|
||||
return TRUE;
|
||||
@@ -321,4 +323,10 @@ int wxListBox::GetIndex( GtkWidget *item ) const
|
||||
return -1;
|
||||
};
|
||||
|
||||
GtkWidget *wxListBox::GetDropTargetWidget(void)
|
||||
{
|
||||
return GTK_WIDGET(m_list);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
@@ -13,6 +13,7 @@
|
||||
#endif
|
||||
|
||||
#include "wx/mdi.h"
|
||||
#include "wx/dialog.h"
|
||||
#include "wx/gtk/win_gtk.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -174,6 +175,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame,wxPanel)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxMDIChildFrame, wxPanel)
|
||||
EVT_CLOSE(wxMDIChildFrame::OnCloseWindow)
|
||||
EVT_SIZE(wxMDIChildFrame::OnSize)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
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)
|
||||
{
|
||||
if (!wxPendingDelete.Member(this))
|
||||
|
@@ -109,10 +109,6 @@ static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation*
|
||||
// wxNotebook
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
BEGIN_EVENT_TABLE(wxNotebook, wxControl)
|
||||
EVT_SIZE(wxNotebook::OnSize)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxNotebook,wxControl)
|
||||
|
||||
void wxNotebook::Init()
|
||||
@@ -400,11 +396,6 @@ wxWindow *wxNotebook::GetPage( int page ) const
|
||||
|
||||
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);
|
||||
|
||||
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
|
||||
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
|
||||
wxControl::SetConstraintSizes(FALSE);
|
||||
}
|
||||
|
||||
bool wxNotebook::DoPhase(int /* nPhase */)
|
||||
bool wxNotebook::DoPhase( int WXUNUSED(nPhase) )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
@@ -179,7 +179,7 @@ void wxToolBar::ClearTools(void)
|
||||
{
|
||||
};
|
||||
|
||||
void wxToolBar::Layout(void)
|
||||
void wxToolBar::Realize(void)
|
||||
{
|
||||
m_x = 0;
|
||||
m_y = 0;
|
||||
|
@@ -385,3 +385,11 @@ wxTextCtrl& wxTextCtrl::operator<<(const char c)
|
||||
return *this;
|
||||
}
|
||||
|
||||
GtkWidget* wxTextCtrl::GetDropTargetWidget(void)
|
||||
{
|
||||
return GTK_WIDGET(m_text);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -349,7 +349,7 @@ typedef struct {
|
||||
} wxEndProcessData;
|
||||
|
||||
static void GTK_EndProcessDetector(gpointer data, gint source,
|
||||
GdkInputCondition condition)
|
||||
GdkInputCondition WXUNUSED(condition) )
|
||||
{
|
||||
wxEndProcessData *proc_data = (wxEndProcessData *)data;
|
||||
int pid;
|
||||
|
@@ -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 )
|
||||
{
|
||||
if (widget->window != gdk_event->window) return FALSE;
|
||||
if (g_blockEventsOnDrag) return FALSE;
|
||||
if (widget->window != gdk_event->window) return TRUE;
|
||||
if (g_blockEventsOnDrag) return TRUE;
|
||||
|
||||
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 " );
|
||||
@@ -342,9 +342,9 @@ gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_
|
||||
{
|
||||
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 " );
|
||||
@@ -374,7 +374,9 @@ gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_
|
||||
event.m_y = (long)gdk_event->y;
|
||||
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 (g_blockEventsOnDrag) return FALSE;
|
||||
if (g_blockEventsOnDrag) return TRUE;
|
||||
|
||||
if (!win->HasVMT()) return FALSE;
|
||||
if (!win->HasVMT()) return TRUE;
|
||||
|
||||
/*
|
||||
printf( "OnMotion from " );
|
||||
@@ -410,7 +412,7 @@ gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_e
|
||||
|
||||
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 )
|
||||
{
|
||||
if (g_blockEventsOnDrag) return FALSE;
|
||||
if (g_blockEventsOnDrag) return TRUE;
|
||||
if (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 " );
|
||||
@@ -446,7 +448,9 @@ gint gtk_window_focus_in_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUS
|
||||
|
||||
wxFocusEvent event( wxEVT_SET_FOCUS, win->GetId() );
|
||||
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 )
|
||||
{
|
||||
if (g_blockEventsOnDrag) return FALSE;
|
||||
if (g_blockEventsOnDrag) return TRUE;
|
||||
if (win->m_wxwindow)
|
||||
{
|
||||
if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow))
|
||||
GTK_WIDGET_UNSET_FLAGS (win->m_wxwindow, GTK_HAS_FOCUS);
|
||||
};
|
||||
|
||||
if (!win->HasVMT()) return FALSE;
|
||||
if (!win->HasVMT()) return TRUE;
|
||||
|
||||
/*
|
||||
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() );
|
||||
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 )
|
||||
{
|
||||
printf( "OnDrop.\n" );
|
||||
|
||||
if (win->GetDropTarget())
|
||||
{
|
||||
int x = 0;
|
||||
@@ -961,9 +965,6 @@ void wxWindow::PostCreation(void)
|
||||
gtk_signal_connect( GTK_OBJECT(connect_widget), "focus_out_event",
|
||||
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
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(m_widget), "enter_notify_event",
|
||||
@@ -1480,6 +1481,7 @@ void wxWindow::AddChild( wxWindow *child )
|
||||
|
||||
m_children.Append( child );
|
||||
if (m_wxwindow) gtk_myfixed_put( GTK_MYFIXED(m_wxwindow), child->m_widget, child->m_x, child->m_y );
|
||||
|
||||
gtk_widget_set_usize( child->m_widget, child->m_width, child->m_height );
|
||||
};
|
||||
|
||||
@@ -1693,17 +1695,23 @@ void wxWindow::InitDialog(void)
|
||||
|
||||
void wxWindow::SetDropTarget( wxDropTarget *dropTarget )
|
||||
{
|
||||
GtkWidget *connect_widget = m_widget;
|
||||
if (m_wxwindow) connect_widget = m_wxwindow;
|
||||
GtkWidget *dnd_widget = GetDropTargetWidget();
|
||||
|
||||
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;
|
||||
};
|
||||
m_pDropTarget = dropTarget;
|
||||
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;
|
||||
};
|
||||
|
||||
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 )
|
||||
{
|
||||
m_font = font;
|
||||
@@ -2445,7 +2461,7 @@ bool wxWindow::AcceptsFocus() const
|
||||
return IsEnabled() && IsShown();
|
||||
}
|
||||
|
||||
void wxWindow::OnIdle(wxIdleEvent& event)
|
||||
void wxWindow::OnIdle(wxIdleEvent& WXUNUSED(event) )
|
||||
{
|
||||
UpdateWindowUI();
|
||||
}
|
||||
|
@@ -28,6 +28,8 @@
|
||||
#include <../iodbc/itrace.h>
|
||||
#include <stdio.h>
|
||||
|
||||
extern RETCODE _iodbcdm_driverunload();
|
||||
|
||||
RETCODE SQL_API SQLAllocConnect(
|
||||
HENV henv,
|
||||
HDBC FAR* phdbc )
|
||||
@@ -156,7 +158,7 @@ RETCODE SQL_API SQLSetConnectOption(
|
||||
UWORD fOption,
|
||||
UDWORD vParam )
|
||||
{
|
||||
GENV_t FAR* genv;
|
||||
/* GENV_t FAR* genv; */
|
||||
DBC_t FAR* pdbc = (DBC_t FAR*)hdbc;
|
||||
STMT_t FAR* pstmt;
|
||||
HPROC hproc = SQL_NULL_HPROC;
|
||||
@@ -496,7 +498,7 @@ RETCODE SQL_API SQLGetConnectOption(
|
||||
UWORD fOption,
|
||||
PTR pvParam )
|
||||
{
|
||||
GENV_t FAR* genv;
|
||||
/* GENV_t FAR* genv; */
|
||||
DBC_t FAR* pdbc = (DBC_t FAR*)hdbc;
|
||||
int sqlstat = en_00000;
|
||||
HPROC hproc = SQL_NULL_HPROC;
|
||||
@@ -755,7 +757,7 @@ RETCODE SQL_API SQLTransact(
|
||||
GENV_t FAR* genv = (GENV_t FAR*)henv;
|
||||
DBC_t FAR* pdbc = (DBC_t FAR*)hdbc;
|
||||
HERR herr;
|
||||
RETCODE retcode;
|
||||
RETCODE retcode = 0;
|
||||
|
||||
if( hdbc != SQL_NULL_HDBC )
|
||||
{
|
||||
|
@@ -189,7 +189,7 @@ RETCODE SQL_API SQLFreeStmt (
|
||||
UWORD fOption )
|
||||
{
|
||||
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
||||
STMT_t FAR* tpstmt;
|
||||
/* STMT_t FAR* tpstmt; */
|
||||
DBC_t FAR* pdbc;
|
||||
|
||||
HPROC hproc = SQL_NULL_HPROC;
|
||||
|
Reference in New Issue
Block a user