Pretty redical change concerning the underlying
X's windows' position. Even without having scrolled anywhere, the device origin of the top left corner is no longer certain to be zero,zero. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@401 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -330,7 +330,6 @@ private:
|
||||
int m_lineHeight;
|
||||
wxPen m_dottedPen;
|
||||
bool m_isCreated;
|
||||
wxPaintDC *m_dc;
|
||||
wxBrush *m_hilightBrush;
|
||||
wxImageList *m_imageList;
|
||||
wxImageList *m_smallImageList;
|
||||
|
@@ -354,7 +354,6 @@ wxTreeCtrl::wxTreeCtrl()
|
||||
m_lineHeight = 10;
|
||||
m_indent = 15;
|
||||
m_isCreated = FALSE;
|
||||
m_dc = NULL;
|
||||
m_hilightBrush = new wxBrush( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_HIGHLIGHT), wxSOLID );
|
||||
m_imageList = NULL;
|
||||
m_smallImageList = NULL;
|
||||
@@ -373,7 +372,6 @@ wxTreeCtrl::wxTreeCtrl(wxWindow *parent, wxWindowID id,
|
||||
m_lineHeight = 10;
|
||||
m_indent = 15;
|
||||
m_isCreated = FALSE;
|
||||
m_dc = NULL;
|
||||
m_hilightBrush = new wxBrush( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_HIGHLIGHT), wxSOLID );
|
||||
m_imageList = NULL;
|
||||
m_smallImageList = NULL;
|
||||
@@ -382,7 +380,6 @@ wxTreeCtrl::wxTreeCtrl(wxWindow *parent, wxWindowID id,
|
||||
|
||||
wxTreeCtrl::~wxTreeCtrl()
|
||||
{
|
||||
if (m_dc) delete m_dc;
|
||||
};
|
||||
|
||||
bool wxTreeCtrl::Create(wxWindow *parent, wxWindowID id,
|
||||
@@ -450,11 +447,14 @@ long wxTreeCtrl::InsertItem( long parent, const wxString& label, int image,
|
||||
int ch = 0;
|
||||
GetClientSize( NULL, &ch );
|
||||
|
||||
wxRectangle rect;
|
||||
rect.x = 0; rect.y = 0;
|
||||
rect.width = 10000; rect.height = ch;
|
||||
|
||||
PrepareDC( dc );
|
||||
|
||||
wxRectangle rect;
|
||||
rect.x = dc.LogicalToDeviceX( 0 );
|
||||
rect.y = 0;
|
||||
rect.width = 10000;
|
||||
rect.height = ch;
|
||||
|
||||
if (p->m_children.Number() == 1)
|
||||
{
|
||||
rect.y = dc.LogicalToDeviceY( p->m_y );
|
||||
@@ -466,11 +466,6 @@ long wxTreeCtrl::InsertItem( long parent, const wxString& label, int image,
|
||||
rect.y = dc.LogicalToDeviceY( last_child->m_y );
|
||||
};
|
||||
|
||||
long doX = 0;
|
||||
long doY = 0;
|
||||
dc.GetDeviceOrigin( &doX, &doY );
|
||||
rect.height = ch-rect.y-doY;
|
||||
|
||||
AdjustMyScrollbars();
|
||||
|
||||
if (rect.height > 0) Refresh( FALSE, &rect);
|
||||
@@ -531,11 +526,14 @@ long wxTreeCtrl::InsertItem( long parent, wxTreeItem &info, long WXUNUSED(insert
|
||||
int ch = 0;
|
||||
GetClientSize( NULL, &ch );
|
||||
|
||||
wxRectangle rect;
|
||||
rect.x = 0; rect.y = 0;
|
||||
rect.width = 10000; rect.height = ch;
|
||||
|
||||
PrepareDC( dc );
|
||||
|
||||
wxRectangle rect;
|
||||
rect.x = dc.LogicalToDeviceX( 0 );
|
||||
rect.y = 0;
|
||||
rect.width = 10000;
|
||||
rect.height = ch;
|
||||
|
||||
if (p->m_children.Number() == 1)
|
||||
{
|
||||
rect.y = dc.LogicalToDeviceY( p->m_y );
|
||||
@@ -547,11 +545,6 @@ long wxTreeCtrl::InsertItem( long parent, wxTreeItem &info, long WXUNUSED(insert
|
||||
rect.y = dc.LogicalToDeviceY( last_child->m_y );
|
||||
};
|
||||
|
||||
long doX = 0;
|
||||
long doY = 0;
|
||||
dc.GetDeviceOrigin( &doX, &doY );
|
||||
rect.height = ch-rect.y-doY;
|
||||
|
||||
AdjustMyScrollbars();
|
||||
|
||||
if (rect.height > 0) Refresh( FALSE, &rect);
|
||||
@@ -609,19 +602,18 @@ bool wxTreeCtrl::ExpandItem( long item, int action )
|
||||
}
|
||||
};
|
||||
|
||||
wxClientDC dc(this);
|
||||
PrepareDC(dc);
|
||||
|
||||
int cw = 0;
|
||||
int ch = 0;
|
||||
GetClientSize( &cw, &ch );
|
||||
wxRect rect;
|
||||
rect.x = 0;
|
||||
rect.width = cw;
|
||||
wxClientDC dc(this);
|
||||
PrepareDC(dc);
|
||||
rect.y = dc.LogicalToDeviceY( i->m_y );
|
||||
|
||||
long doY = 0;
|
||||
dc.GetDeviceOrigin( NULL, &doY );
|
||||
rect.height = ch-rect.y-doY;
|
||||
wxRect rect;
|
||||
rect.x = dc.LogicalToDeviceX( 0 );
|
||||
rect.width = cw;
|
||||
rect.y = dc.LogicalToDeviceY( i->m_y );
|
||||
rect.height = ch;
|
||||
Refresh( TRUE, &rect );
|
||||
|
||||
AdjustMyScrollbars();
|
||||
@@ -847,12 +839,16 @@ void wxTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxPaintDC &dc, int level,
|
||||
|
||||
int oldY = y;
|
||||
|
||||
if (IsExposed( 0, item->m_y-2, 10000, m_lineHeight+4 ))
|
||||
int exposed_x = dc.LogicalToDeviceX( 0 );
|
||||
int exposed_y = dc.LogicalToDeviceY( item->m_y-2 );
|
||||
|
||||
if (IsExposed( exposed_x, exposed_y, 1000, m_lineHeight+4 ))
|
||||
{
|
||||
int startX = horizX;
|
||||
int endX = horizX + 10;
|
||||
|
||||
if (!item->HasChildren()) endX += 20;
|
||||
|
||||
dc.DrawLine( startX, y, endX, y );
|
||||
|
||||
if (item->HasChildren())
|
||||
@@ -890,6 +886,7 @@ void wxTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxPaintDC &dc, int level,
|
||||
}
|
||||
else
|
||||
{
|
||||
dc.SetBrush( *wxWHITE_BRUSH );
|
||||
dc.SetPen( *wxTRANSPARENT_PEN );
|
||||
long tw, th;
|
||||
dc.GetTextExtent( item->m_text, &tw, &th );
|
||||
@@ -923,19 +920,16 @@ void wxTreeCtrl::OnPaint( const wxPaintEvent &WXUNUSED(event) )
|
||||
{
|
||||
if (!m_anchor) return;
|
||||
|
||||
if (!m_dc)
|
||||
{
|
||||
m_dc = new wxPaintDC(this);
|
||||
PrepareDC( *m_dc );
|
||||
};
|
||||
wxPaintDC dc(this);
|
||||
PrepareDC( dc );
|
||||
|
||||
m_dc->SetFont( wxSystemSettings::GetSystemFont( wxSYS_SYSTEM_FONT ) );
|
||||
dc.SetFont( wxSystemSettings::GetSystemFont( wxSYS_SYSTEM_FONT ) );
|
||||
|
||||
m_dc->SetPen( m_dottedPen );
|
||||
m_lineHeight = (int)(m_dc->GetCharHeight() + 4);
|
||||
dc.SetPen( m_dottedPen );
|
||||
m_lineHeight = (int)(dc.GetCharHeight() + 4);
|
||||
|
||||
int y = m_lineHeight / 2 + 2;
|
||||
PaintLevel( m_anchor, *m_dc, 0, y );
|
||||
PaintLevel( m_anchor, dc, 0, y );
|
||||
};
|
||||
|
||||
void wxTreeCtrl::OnSetFocus( const wxFocusEvent &WXUNUSED(event) )
|
||||
@@ -1041,7 +1035,7 @@ void wxTreeCtrl::RefreshLine( wxGenericTreeItem *item )
|
||||
rect.x = dc.LogicalToDeviceX( item->m_x-2 );
|
||||
rect.y = dc.LogicalToDeviceY( item->m_y-2 );
|
||||
rect.width = 1000;
|
||||
rect.height = dc.GetCharHeight()+4;
|
||||
rect.height = dc.GetCharHeight()+6;
|
||||
Refresh( TRUE, &rect );
|
||||
};
|
||||
|
||||
|
@@ -293,8 +293,10 @@ void wxDC::SetDeviceOrigin( long x, long y )
|
||||
|
||||
void wxDC::GetDeviceOrigin( long *x, long *y )
|
||||
{
|
||||
if (x) *x = m_externalDeviceOriginX;
|
||||
if (y) *y = m_externalDeviceOriginY;
|
||||
// if (x) *x = m_externalDeviceOriginX;
|
||||
// if (y) *y = m_externalDeviceOriginY;
|
||||
if (x) *x = m_deviceOriginX;
|
||||
if (y) *y = m_deviceOriginY;
|
||||
};
|
||||
|
||||
void wxDC::SetInternalDeviceOrigin( long x, long y )
|
||||
|
@@ -19,6 +19,7 @@
|
||||
#include "wx/menu.h"
|
||||
#include "wx/toolbar.h"
|
||||
#include "wx/statusbr.h"
|
||||
#include "wx/mdi.h"
|
||||
#include "wx/gtk/win_gtk.h"
|
||||
|
||||
const wxMENU_HEIGHT = 28;
|
||||
@@ -253,18 +254,18 @@ void wxFrame::GtkOnSize( int x, int y, int width, int height )
|
||||
main_y += toolbar_height;
|
||||
main_height -= toolbar_height;
|
||||
|
||||
gtk_widget_set_uposition( GTK_WIDGET(m_wxwindow), main_x, main_y );
|
||||
gtk_widget_set_usize( GTK_WIDGET(m_wxwindow), main_width, main_height );
|
||||
gtk_myfixed_move( GTK_MYFIXED(m_mainWindow), m_wxwindow, main_x, main_y );
|
||||
gtk_widget_set_usize( m_wxwindow, main_width, main_height );
|
||||
|
||||
if (m_frameMenuBar)
|
||||
{
|
||||
gtk_widget_set_uposition( m_frameMenuBar->m_widget, 1, 1 );
|
||||
gtk_myfixed_move( GTK_MYFIXED(m_mainWindow), m_frameMenuBar->m_widget, 1, 1 );
|
||||
gtk_widget_set_usize( m_frameMenuBar->m_widget, width-2, wxMENU_HEIGHT-2 );
|
||||
};
|
||||
|
||||
if (m_frameToolBar)
|
||||
{
|
||||
gtk_widget_set_uposition( m_frameToolBar->m_widget, 1, wxMENU_HEIGHT );
|
||||
gtk_myfixed_move( GTK_MYFIXED(m_mainWindow), m_frameToolBar->m_widget, 1, wxMENU_HEIGHT );
|
||||
gtk_widget_set_usize( m_frameToolBar->m_widget, width-2, toolbar_height );
|
||||
};
|
||||
|
||||
@@ -320,7 +321,9 @@ 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)))
|
||||
if (IS_KIND_OF(child,wxMDIChildFrame)) printf( "wxFrame::AddChild error.\n" );
|
||||
|
||||
if ( IS_KIND_OF(child,wxFrame) || IS_KIND_OF(child,wxDialog))
|
||||
{
|
||||
m_children.Append( child );
|
||||
|
||||
|
@@ -150,8 +150,8 @@ gtk_myfixed_put (GtkMyFixed *myfixed,
|
||||
|
||||
child_info = g_new (GtkMyFixedChild, 1);
|
||||
child_info->widget = widget;
|
||||
child_info->x = x;
|
||||
child_info->y = y;
|
||||
child_info->x = x - myfixed->scroll_offset_x;
|
||||
child_info->y = y - myfixed->scroll_offset_y;
|
||||
|
||||
gtk_widget_set_parent (widget, GTK_WIDGET (myfixed));
|
||||
|
||||
@@ -188,8 +188,8 @@ gtk_myfixed_move (GtkMyFixed *myfixed,
|
||||
|
||||
if (child->widget == widget)
|
||||
{
|
||||
child->x = x;
|
||||
child->y = y;
|
||||
child->x = x - myfixed->scroll_offset_x;
|
||||
child->y = y - myfixed->scroll_offset_y;
|
||||
|
||||
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (myfixed))
|
||||
gtk_widget_queue_resize (GTK_WIDGET (myfixed));
|
||||
@@ -238,17 +238,20 @@ gtk_myfixed_unmap (GtkWidget *widget)
|
||||
static void
|
||||
gtk_myfixed_realize (GtkWidget *widget)
|
||||
{
|
||||
GtkMyFixed *myfixed;
|
||||
GdkWindowAttr attributes;
|
||||
gint attributes_mask;
|
||||
|
||||
g_return_if_fail (widget != NULL);
|
||||
g_return_if_fail (GTK_IS_MYFIXED (widget));
|
||||
|
||||
myfixed = GTK_MYFIXED (widget);
|
||||
|
||||
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
|
||||
|
||||
attributes.window_type = GDK_WINDOW_CHILD;
|
||||
attributes.x = widget->allocation.x;
|
||||
attributes.y = widget->allocation.y;
|
||||
attributes.x = widget->allocation.x + myfixed->scroll_offset_x;
|
||||
attributes.y = widget->allocation.y + myfixed->scroll_offset_x;
|
||||
attributes.width = 32000;
|
||||
attributes.height = 32000;
|
||||
attributes.wclass = GDK_INPUT_OUTPUT;
|
||||
|
@@ -26,6 +26,8 @@
|
||||
#include "wx/dnd.h"
|
||||
#include "wx/mdi.h"
|
||||
#include "wx/notebook.h"
|
||||
#include "wx/statusbr.h"
|
||||
#include "wx/treectrl.h"
|
||||
#include "gdk/gdkkeysyms.h"
|
||||
#include <math.h>
|
||||
#include "wx/gtk/win_gtk.h"
|
||||
@@ -52,6 +54,8 @@ void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExpose *gd
|
||||
if (g_blockEventsOnDrag) return;
|
||||
|
||||
/*
|
||||
if (IS_KIND_OF(win,wxTreeCtrl))
|
||||
{
|
||||
printf( "OnExpose from " );
|
||||
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
||||
printf( win->GetClassInfo()->GetClassName() );
|
||||
@@ -61,6 +65,7 @@ void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExpose *gd
|
||||
printf( "y: %d \n", gdk_event->area.y );
|
||||
printf( "w: %d \n", gdk_event->area.width );
|
||||
printf( "h: %d \n", gdk_event->area.height );
|
||||
}
|
||||
*/
|
||||
|
||||
win->m_updateRegion.Union( gdk_event->area.x,
|
||||
@@ -1319,14 +1324,11 @@ void wxWindow::ScreenToClient( int *x, int *y )
|
||||
|
||||
void wxWindow::Centre( int direction )
|
||||
{
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
GetPosition( &x, &y );
|
||||
if (this->IsKindOf(CLASSINFO(wxDialog)) || this->IsKindOf(CLASSINFO(wxFrame)))
|
||||
{
|
||||
if (direction & wxHORIZONTAL == wxHORIZONTAL) x = (gdk_screen_width () - m_width) / 2;
|
||||
if (direction & wxVERTICAL == wxVERTICAL) y = (gdk_screen_height () - m_height) / 2;
|
||||
gtk_widget_set_uposition( m_widget, x, y );
|
||||
if (direction & wxHORIZONTAL == wxHORIZONTAL) m_x = (gdk_screen_width () - m_width) / 2;
|
||||
if (direction & wxVERTICAL == wxVERTICAL) m_y = (gdk_screen_height () - m_height) / 2;
|
||||
ImplementSetPosition();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1335,9 +1337,9 @@ void wxWindow::Centre( int direction )
|
||||
int p_w = 0;
|
||||
int p_h = 0;
|
||||
m_parent->GetSize( &p_w, &p_h );
|
||||
if (direction & wxHORIZONTAL == wxHORIZONTAL) x = (p_w - m_width) / 2;
|
||||
if (direction & wxVERTICAL == wxVERTICAL) y = (p_h - m_height) / 2;
|
||||
gtk_widget_set_uposition( m_widget, x, y );
|
||||
if (direction & wxHORIZONTAL == wxHORIZONTAL) m_x = (p_w - m_width) / 2;
|
||||
if (direction & wxVERTICAL == wxVERTICAL) m_y = (p_h - m_height) / 2;
|
||||
ImplementSetPosition();
|
||||
};
|
||||
}
|
||||
};
|
||||
@@ -1433,7 +1435,8 @@ void wxWindow::AddChild( wxWindow *child )
|
||||
|
||||
// wxFrame and wxDialog as children aren't placed into the parents
|
||||
|
||||
if (child->IsKindOf(CLASSINFO(wxFrame)) || child->IsKindOf(CLASSINFO(wxDialog)))
|
||||
if (( IS_KIND_OF(child,wxFrame) || IS_KIND_OF(child,wxDialog) ) &&
|
||||
(!IS_KIND_OF(child,wxMDIChildFrame)))
|
||||
{
|
||||
m_children.Append( child );
|
||||
|
||||
@@ -1446,9 +1449,9 @@ void wxWindow::AddChild( wxWindow *child )
|
||||
// In the case of an wxMDIChildFrame descendant, we use the
|
||||
// client windows's AddChild()
|
||||
|
||||
if (IsKindOf(CLASSINFO(wxMDIParentFrame)))
|
||||
if (IS_KIND_OF(this,wxMDIParentFrame))
|
||||
{
|
||||
if (child->IsKindOf(CLASSINFO(wxMDIChildFrame)))
|
||||
if (IS_KIND_OF(child,wxMDIChildFrame))
|
||||
{
|
||||
wxMDIClientWindow *client = ((wxMDIParentFrame*)this)->GetClientWindow();
|
||||
if (client)
|
||||
@@ -1461,7 +1464,7 @@ void wxWindow::AddChild( wxWindow *child )
|
||||
|
||||
// wxNotebook is very special, so it has a private AddChild()
|
||||
|
||||
if (IsKindOf(CLASSINFO(wxNotebook)))
|
||||
if (IS_KIND_OF(this,wxNotebook))
|
||||
{
|
||||
wxNotebook *tab = (wxNotebook*)this;
|
||||
tab->AddChild( child );
|
||||
@@ -1470,7 +1473,7 @@ void wxWindow::AddChild( wxWindow *child )
|
||||
|
||||
// wxFrame has a private AddChild
|
||||
|
||||
if (IsKindOf(CLASSINFO(wxFrame)))
|
||||
if (IS_KIND_OF(this,wxFrame))
|
||||
{
|
||||
wxFrame *frame = (wxFrame*)this;
|
||||
frame->AddChild( child );
|
||||
@@ -1480,7 +1483,8 @@ void wxWindow::AddChild( wxWindow *child )
|
||||
// All the rest
|
||||
|
||||
m_children.Append( child );
|
||||
if (m_wxwindow) gtk_myfixed_put( GTK_MYFIXED(m_wxwindow), child->m_widget, child->m_x, child->m_y );
|
||||
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 );
|
||||
};
|
||||
@@ -1599,6 +1603,13 @@ void wxWindow::Refresh( bool eraseBackground, const wxRect *rect )
|
||||
gdk_rect.y = rect->y;
|
||||
gdk_rect.width = rect->width;
|
||||
gdk_rect.height = rect->height;
|
||||
|
||||
if (IS_KIND_OF(this,wxTreeCtrl))
|
||||
{
|
||||
printf( "x: %d y: %d w: %d h: %d .\n",
|
||||
gdk_rect.x, gdk_rect.y, gdk_rect.width, gdk_rect.height );
|
||||
}
|
||||
|
||||
if (m_wxwindow)
|
||||
gtk_widget_draw( m_wxwindow, &gdk_rect );
|
||||
else
|
||||
@@ -1887,9 +1898,23 @@ void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible,
|
||||
if (m_wxwindow->window)
|
||||
{
|
||||
if (orient == wxHORIZONTAL)
|
||||
{
|
||||
/*
|
||||
m_drawingOffsetX = -16000;
|
||||
|
||||
gtk_myfixed_set_offset( GTK_MYFIXED(m_wxwindow), m_drawingOffsetX, m_drawingOffsetY );
|
||||
*/
|
||||
gtk_signal_emit_by_name( GTK_OBJECT(m_hAdjust), "changed" );
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
m_drawingOffsetY = -16000;
|
||||
|
||||
gtk_myfixed_set_offset( GTK_MYFIXED(m_wxwindow), m_drawingOffsetX, m_drawingOffsetY );
|
||||
*/
|
||||
gtk_signal_emit_by_name( GTK_OBJECT(m_vAdjust), "changed" );
|
||||
}
|
||||
|
||||
gtk_widget_set_usize( m_widget, m_width, m_height );
|
||||
};
|
||||
@@ -1958,13 +1983,26 @@ void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) )
|
||||
{
|
||||
if (!m_wxwindow) return;
|
||||
|
||||
bool refresh = FALSE;
|
||||
|
||||
if ((m_drawingOffsetX == 0) && (m_drawingOffsetY == 0))
|
||||
{
|
||||
m_drawingOffsetX = -16000;
|
||||
m_drawingOffsetY = -16000;
|
||||
refresh = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_drawingOffsetX += dx;
|
||||
m_drawingOffsetY += dy;
|
||||
}
|
||||
|
||||
// printf( "X: %d Y: %d \n", (int)m_drawingOffsetX, (int)m_drawingOffsetY );
|
||||
|
||||
gtk_myfixed_set_offset( GTK_MYFIXED(m_wxwindow), m_drawingOffsetX, m_drawingOffsetY );
|
||||
|
||||
if (refresh) Refresh();
|
||||
|
||||
/*
|
||||
The code here is very nifty, but it doesn't work with
|
||||
overlapping windows...
|
||||
|
@@ -293,8 +293,10 @@ void wxDC::SetDeviceOrigin( long x, long y )
|
||||
|
||||
void wxDC::GetDeviceOrigin( long *x, long *y )
|
||||
{
|
||||
if (x) *x = m_externalDeviceOriginX;
|
||||
if (y) *y = m_externalDeviceOriginY;
|
||||
// if (x) *x = m_externalDeviceOriginX;
|
||||
// if (y) *y = m_externalDeviceOriginY;
|
||||
if (x) *x = m_deviceOriginX;
|
||||
if (y) *y = m_deviceOriginY;
|
||||
};
|
||||
|
||||
void wxDC::SetInternalDeviceOrigin( long x, long y )
|
||||
|
@@ -19,6 +19,7 @@
|
||||
#include "wx/menu.h"
|
||||
#include "wx/toolbar.h"
|
||||
#include "wx/statusbr.h"
|
||||
#include "wx/mdi.h"
|
||||
#include "wx/gtk/win_gtk.h"
|
||||
|
||||
const wxMENU_HEIGHT = 28;
|
||||
@@ -253,18 +254,18 @@ void wxFrame::GtkOnSize( int x, int y, int width, int height )
|
||||
main_y += toolbar_height;
|
||||
main_height -= toolbar_height;
|
||||
|
||||
gtk_widget_set_uposition( GTK_WIDGET(m_wxwindow), main_x, main_y );
|
||||
gtk_widget_set_usize( GTK_WIDGET(m_wxwindow), main_width, main_height );
|
||||
gtk_myfixed_move( GTK_MYFIXED(m_mainWindow), m_wxwindow, main_x, main_y );
|
||||
gtk_widget_set_usize( m_wxwindow, main_width, main_height );
|
||||
|
||||
if (m_frameMenuBar)
|
||||
{
|
||||
gtk_widget_set_uposition( m_frameMenuBar->m_widget, 1, 1 );
|
||||
gtk_myfixed_move( GTK_MYFIXED(m_mainWindow), m_frameMenuBar->m_widget, 1, 1 );
|
||||
gtk_widget_set_usize( m_frameMenuBar->m_widget, width-2, wxMENU_HEIGHT-2 );
|
||||
};
|
||||
|
||||
if (m_frameToolBar)
|
||||
{
|
||||
gtk_widget_set_uposition( m_frameToolBar->m_widget, 1, wxMENU_HEIGHT );
|
||||
gtk_myfixed_move( GTK_MYFIXED(m_mainWindow), m_frameToolBar->m_widget, 1, wxMENU_HEIGHT );
|
||||
gtk_widget_set_usize( m_frameToolBar->m_widget, width-2, toolbar_height );
|
||||
};
|
||||
|
||||
@@ -320,7 +321,9 @@ 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)))
|
||||
if (IS_KIND_OF(child,wxMDIChildFrame)) printf( "wxFrame::AddChild error.\n" );
|
||||
|
||||
if ( IS_KIND_OF(child,wxFrame) || IS_KIND_OF(child,wxDialog))
|
||||
{
|
||||
m_children.Append( child );
|
||||
|
||||
|
@@ -150,8 +150,8 @@ gtk_myfixed_put (GtkMyFixed *myfixed,
|
||||
|
||||
child_info = g_new (GtkMyFixedChild, 1);
|
||||
child_info->widget = widget;
|
||||
child_info->x = x;
|
||||
child_info->y = y;
|
||||
child_info->x = x - myfixed->scroll_offset_x;
|
||||
child_info->y = y - myfixed->scroll_offset_y;
|
||||
|
||||
gtk_widget_set_parent (widget, GTK_WIDGET (myfixed));
|
||||
|
||||
@@ -188,8 +188,8 @@ gtk_myfixed_move (GtkMyFixed *myfixed,
|
||||
|
||||
if (child->widget == widget)
|
||||
{
|
||||
child->x = x;
|
||||
child->y = y;
|
||||
child->x = x - myfixed->scroll_offset_x;
|
||||
child->y = y - myfixed->scroll_offset_y;
|
||||
|
||||
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (myfixed))
|
||||
gtk_widget_queue_resize (GTK_WIDGET (myfixed));
|
||||
@@ -238,17 +238,20 @@ gtk_myfixed_unmap (GtkWidget *widget)
|
||||
static void
|
||||
gtk_myfixed_realize (GtkWidget *widget)
|
||||
{
|
||||
GtkMyFixed *myfixed;
|
||||
GdkWindowAttr attributes;
|
||||
gint attributes_mask;
|
||||
|
||||
g_return_if_fail (widget != NULL);
|
||||
g_return_if_fail (GTK_IS_MYFIXED (widget));
|
||||
|
||||
myfixed = GTK_MYFIXED (widget);
|
||||
|
||||
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
|
||||
|
||||
attributes.window_type = GDK_WINDOW_CHILD;
|
||||
attributes.x = widget->allocation.x;
|
||||
attributes.y = widget->allocation.y;
|
||||
attributes.x = widget->allocation.x + myfixed->scroll_offset_x;
|
||||
attributes.y = widget->allocation.y + myfixed->scroll_offset_x;
|
||||
attributes.width = 32000;
|
||||
attributes.height = 32000;
|
||||
attributes.wclass = GDK_INPUT_OUTPUT;
|
||||
|
@@ -26,6 +26,8 @@
|
||||
#include "wx/dnd.h"
|
||||
#include "wx/mdi.h"
|
||||
#include "wx/notebook.h"
|
||||
#include "wx/statusbr.h"
|
||||
#include "wx/treectrl.h"
|
||||
#include "gdk/gdkkeysyms.h"
|
||||
#include <math.h>
|
||||
#include "wx/gtk/win_gtk.h"
|
||||
@@ -52,6 +54,8 @@ void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExpose *gd
|
||||
if (g_blockEventsOnDrag) return;
|
||||
|
||||
/*
|
||||
if (IS_KIND_OF(win,wxTreeCtrl))
|
||||
{
|
||||
printf( "OnExpose from " );
|
||||
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
||||
printf( win->GetClassInfo()->GetClassName() );
|
||||
@@ -61,6 +65,7 @@ void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExpose *gd
|
||||
printf( "y: %d \n", gdk_event->area.y );
|
||||
printf( "w: %d \n", gdk_event->area.width );
|
||||
printf( "h: %d \n", gdk_event->area.height );
|
||||
}
|
||||
*/
|
||||
|
||||
win->m_updateRegion.Union( gdk_event->area.x,
|
||||
@@ -1319,14 +1324,11 @@ void wxWindow::ScreenToClient( int *x, int *y )
|
||||
|
||||
void wxWindow::Centre( int direction )
|
||||
{
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
GetPosition( &x, &y );
|
||||
if (this->IsKindOf(CLASSINFO(wxDialog)) || this->IsKindOf(CLASSINFO(wxFrame)))
|
||||
{
|
||||
if (direction & wxHORIZONTAL == wxHORIZONTAL) x = (gdk_screen_width () - m_width) / 2;
|
||||
if (direction & wxVERTICAL == wxVERTICAL) y = (gdk_screen_height () - m_height) / 2;
|
||||
gtk_widget_set_uposition( m_widget, x, y );
|
||||
if (direction & wxHORIZONTAL == wxHORIZONTAL) m_x = (gdk_screen_width () - m_width) / 2;
|
||||
if (direction & wxVERTICAL == wxVERTICAL) m_y = (gdk_screen_height () - m_height) / 2;
|
||||
ImplementSetPosition();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1335,9 +1337,9 @@ void wxWindow::Centre( int direction )
|
||||
int p_w = 0;
|
||||
int p_h = 0;
|
||||
m_parent->GetSize( &p_w, &p_h );
|
||||
if (direction & wxHORIZONTAL == wxHORIZONTAL) x = (p_w - m_width) / 2;
|
||||
if (direction & wxVERTICAL == wxVERTICAL) y = (p_h - m_height) / 2;
|
||||
gtk_widget_set_uposition( m_widget, x, y );
|
||||
if (direction & wxHORIZONTAL == wxHORIZONTAL) m_x = (p_w - m_width) / 2;
|
||||
if (direction & wxVERTICAL == wxVERTICAL) m_y = (p_h - m_height) / 2;
|
||||
ImplementSetPosition();
|
||||
};
|
||||
}
|
||||
};
|
||||
@@ -1433,7 +1435,8 @@ void wxWindow::AddChild( wxWindow *child )
|
||||
|
||||
// wxFrame and wxDialog as children aren't placed into the parents
|
||||
|
||||
if (child->IsKindOf(CLASSINFO(wxFrame)) || child->IsKindOf(CLASSINFO(wxDialog)))
|
||||
if (( IS_KIND_OF(child,wxFrame) || IS_KIND_OF(child,wxDialog) ) &&
|
||||
(!IS_KIND_OF(child,wxMDIChildFrame)))
|
||||
{
|
||||
m_children.Append( child );
|
||||
|
||||
@@ -1446,9 +1449,9 @@ void wxWindow::AddChild( wxWindow *child )
|
||||
// In the case of an wxMDIChildFrame descendant, we use the
|
||||
// client windows's AddChild()
|
||||
|
||||
if (IsKindOf(CLASSINFO(wxMDIParentFrame)))
|
||||
if (IS_KIND_OF(this,wxMDIParentFrame))
|
||||
{
|
||||
if (child->IsKindOf(CLASSINFO(wxMDIChildFrame)))
|
||||
if (IS_KIND_OF(child,wxMDIChildFrame))
|
||||
{
|
||||
wxMDIClientWindow *client = ((wxMDIParentFrame*)this)->GetClientWindow();
|
||||
if (client)
|
||||
@@ -1461,7 +1464,7 @@ void wxWindow::AddChild( wxWindow *child )
|
||||
|
||||
// wxNotebook is very special, so it has a private AddChild()
|
||||
|
||||
if (IsKindOf(CLASSINFO(wxNotebook)))
|
||||
if (IS_KIND_OF(this,wxNotebook))
|
||||
{
|
||||
wxNotebook *tab = (wxNotebook*)this;
|
||||
tab->AddChild( child );
|
||||
@@ -1470,7 +1473,7 @@ void wxWindow::AddChild( wxWindow *child )
|
||||
|
||||
// wxFrame has a private AddChild
|
||||
|
||||
if (IsKindOf(CLASSINFO(wxFrame)))
|
||||
if (IS_KIND_OF(this,wxFrame))
|
||||
{
|
||||
wxFrame *frame = (wxFrame*)this;
|
||||
frame->AddChild( child );
|
||||
@@ -1480,7 +1483,8 @@ void wxWindow::AddChild( wxWindow *child )
|
||||
// All the rest
|
||||
|
||||
m_children.Append( child );
|
||||
if (m_wxwindow) gtk_myfixed_put( GTK_MYFIXED(m_wxwindow), child->m_widget, child->m_x, child->m_y );
|
||||
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 );
|
||||
};
|
||||
@@ -1599,6 +1603,13 @@ void wxWindow::Refresh( bool eraseBackground, const wxRect *rect )
|
||||
gdk_rect.y = rect->y;
|
||||
gdk_rect.width = rect->width;
|
||||
gdk_rect.height = rect->height;
|
||||
|
||||
if (IS_KIND_OF(this,wxTreeCtrl))
|
||||
{
|
||||
printf( "x: %d y: %d w: %d h: %d .\n",
|
||||
gdk_rect.x, gdk_rect.y, gdk_rect.width, gdk_rect.height );
|
||||
}
|
||||
|
||||
if (m_wxwindow)
|
||||
gtk_widget_draw( m_wxwindow, &gdk_rect );
|
||||
else
|
||||
@@ -1887,9 +1898,23 @@ void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible,
|
||||
if (m_wxwindow->window)
|
||||
{
|
||||
if (orient == wxHORIZONTAL)
|
||||
{
|
||||
/*
|
||||
m_drawingOffsetX = -16000;
|
||||
|
||||
gtk_myfixed_set_offset( GTK_MYFIXED(m_wxwindow), m_drawingOffsetX, m_drawingOffsetY );
|
||||
*/
|
||||
gtk_signal_emit_by_name( GTK_OBJECT(m_hAdjust), "changed" );
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
m_drawingOffsetY = -16000;
|
||||
|
||||
gtk_myfixed_set_offset( GTK_MYFIXED(m_wxwindow), m_drawingOffsetX, m_drawingOffsetY );
|
||||
*/
|
||||
gtk_signal_emit_by_name( GTK_OBJECT(m_vAdjust), "changed" );
|
||||
}
|
||||
|
||||
gtk_widget_set_usize( m_widget, m_width, m_height );
|
||||
};
|
||||
@@ -1958,13 +1983,26 @@ void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) )
|
||||
{
|
||||
if (!m_wxwindow) return;
|
||||
|
||||
bool refresh = FALSE;
|
||||
|
||||
if ((m_drawingOffsetX == 0) && (m_drawingOffsetY == 0))
|
||||
{
|
||||
m_drawingOffsetX = -16000;
|
||||
m_drawingOffsetY = -16000;
|
||||
refresh = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_drawingOffsetX += dx;
|
||||
m_drawingOffsetY += dy;
|
||||
}
|
||||
|
||||
// printf( "X: %d Y: %d \n", (int)m_drawingOffsetX, (int)m_drawingOffsetY );
|
||||
|
||||
gtk_myfixed_set_offset( GTK_MYFIXED(m_wxwindow), m_drawingOffsetX, m_drawingOffsetY );
|
||||
|
||||
if (refresh) Refresh();
|
||||
|
||||
/*
|
||||
The code here is very nifty, but it doesn't work with
|
||||
overlapping windows...
|
||||
|
Reference in New Issue
Block a user