New scrolling code.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3897 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling 1999-10-08 20:09:32 +00:00
parent 2136a764e5
commit ed673c6a48
12 changed files with 2058 additions and 890 deletions

View File

@ -36,66 +36,68 @@ typedef enum
typedef struct _GtkMyFixed GtkMyFixed; typedef struct _GtkMyFixed GtkMyFixed;
typedef struct _GtkMyFixedClass GtkMyFixedClass; typedef struct _GtkMyFixedClass GtkMyFixedClass;
typedef struct _GtkMyFixedChild GtkMyFixedChild;
struct _GtkMyFixed struct _GtkMyFixed
{ {
GtkContainer container; GtkContainer container;
GList *children; GList *children;
#if (GTK_MINOR_VERSION > 0)
GtkMyShadowType shadow_type; GtkMyShadowType shadow_type;
#endif
guint width;
guint height;
guint xoffset;
guint yoffset;
GdkWindow *bin_window;
GdkVisibilityState visibility;
gulong configure_serial;
gint scroll_x;
gint scroll_y;
}; };
struct _GtkMyFixedClass struct _GtkMyFixedClass
{ {
GtkContainerClass parent_class; GtkContainerClass parent_class;
#if (GTK_MINOR_VERSION > 0)
void (*set_scroll_adjustments) (GtkMyFixed *myfixed, void (*set_scroll_adjustments) (GtkMyFixed *myfixed,
GtkAdjustment *hadjustment, GtkAdjustment *hadjustment,
GtkAdjustment *vadjustment); GtkAdjustment *vadjustment);
#endif
};
struct _GtkMyFixedChild
{
GtkWidget *widget;
gint16 x;
gint16 y;
gint16 width;
gint16 height;
}; };
guint gtk_myfixed_get_type (void); guint gtk_myfixed_get_type (void);
GtkWidget* gtk_myfixed_new (void); GtkWidget* gtk_myfixed_new (void);
#if (GTK_MINOR_VERSION > 0)
void gtk_myfixed_set_shadow_type (GtkMyFixed *myfixed, void gtk_myfixed_set_shadow_type (GtkMyFixed *myfixed,
GtkMyShadowType type); GtkMyShadowType type);
#endif
void gtk_myfixed_scroll (GtkMyFixed *myfixed,
gint dx,
gint dy);
void gtk_myfixed_put (GtkMyFixed *myfixed, void gtk_myfixed_put (GtkMyFixed *myfixed,
GtkWidget *widget, GtkWidget *widget,
gint16 x, gint x,
gint16 y, gint y,
gint16 width, gint width,
gint16 height); gint height);
void gtk_myfixed_move (GtkMyFixed *myfixed, void gtk_myfixed_move (GtkMyFixed *myfixed,
GtkWidget *widget, GtkWidget *widget,
gint16 x, gint x,
gint16 y ); gint y );
void gtk_myfixed_resize (GtkMyFixed *myfixed, void gtk_myfixed_resize (GtkMyFixed *myfixed,
GtkWidget *widget, GtkWidget *widget,
gint16 width, gint width,
gint16 height ); gint height );
void gtk_myfixed_set_size (GtkMyFixed *myfixed, void gtk_myfixed_set_size (GtkMyFixed *myfixed,
GtkWidget *widget, GtkWidget *widget,
gint16 x, gint x,
gint16 y, gint y,
gint16 width, gint width,
gint16 height); gint height);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */

View File

@ -36,66 +36,68 @@ typedef enum
typedef struct _GtkMyFixed GtkMyFixed; typedef struct _GtkMyFixed GtkMyFixed;
typedef struct _GtkMyFixedClass GtkMyFixedClass; typedef struct _GtkMyFixedClass GtkMyFixedClass;
typedef struct _GtkMyFixedChild GtkMyFixedChild;
struct _GtkMyFixed struct _GtkMyFixed
{ {
GtkContainer container; GtkContainer container;
GList *children; GList *children;
#if (GTK_MINOR_VERSION > 0)
GtkMyShadowType shadow_type; GtkMyShadowType shadow_type;
#endif
guint width;
guint height;
guint xoffset;
guint yoffset;
GdkWindow *bin_window;
GdkVisibilityState visibility;
gulong configure_serial;
gint scroll_x;
gint scroll_y;
}; };
struct _GtkMyFixedClass struct _GtkMyFixedClass
{ {
GtkContainerClass parent_class; GtkContainerClass parent_class;
#if (GTK_MINOR_VERSION > 0)
void (*set_scroll_adjustments) (GtkMyFixed *myfixed, void (*set_scroll_adjustments) (GtkMyFixed *myfixed,
GtkAdjustment *hadjustment, GtkAdjustment *hadjustment,
GtkAdjustment *vadjustment); GtkAdjustment *vadjustment);
#endif
};
struct _GtkMyFixedChild
{
GtkWidget *widget;
gint16 x;
gint16 y;
gint16 width;
gint16 height;
}; };
guint gtk_myfixed_get_type (void); guint gtk_myfixed_get_type (void);
GtkWidget* gtk_myfixed_new (void); GtkWidget* gtk_myfixed_new (void);
#if (GTK_MINOR_VERSION > 0)
void gtk_myfixed_set_shadow_type (GtkMyFixed *myfixed, void gtk_myfixed_set_shadow_type (GtkMyFixed *myfixed,
GtkMyShadowType type); GtkMyShadowType type);
#endif
void gtk_myfixed_scroll (GtkMyFixed *myfixed,
gint dx,
gint dy);
void gtk_myfixed_put (GtkMyFixed *myfixed, void gtk_myfixed_put (GtkMyFixed *myfixed,
GtkWidget *widget, GtkWidget *widget,
gint16 x, gint x,
gint16 y, gint y,
gint16 width, gint width,
gint16 height); gint height);
void gtk_myfixed_move (GtkMyFixed *myfixed, void gtk_myfixed_move (GtkMyFixed *myfixed,
GtkWidget *widget, GtkWidget *widget,
gint16 x, gint x,
gint16 y ); gint y );
void gtk_myfixed_resize (GtkMyFixed *myfixed, void gtk_myfixed_resize (GtkMyFixed *myfixed,
GtkWidget *widget, GtkWidget *widget,
gint16 width, gint width,
gint16 height ); gint height );
void gtk_myfixed_set_size (GtkMyFixed *myfixed, void gtk_myfixed_set_size (GtkMyFixed *myfixed,
GtkWidget *widget, GtkWidget *widget,
gint16 x, gint x,
gint16 y, gint y,
gint16 width, gint width,
gint16 height); gint height);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */

View File

@ -62,7 +62,7 @@ wxOS2 -a wxWindows wxWindows/docs !wxWindows/docs/latex !wxWindows/docs/motif \
!wxWindows/include/wx/qt !wxWindows/include/wx/stubs !wxWindows/include/wx/unix \ !wxWindows/include/wx/qt !wxWindows/include/wx/stubs !wxWindows/include/wx/unix \
wxWindows/include/wx/generic wxWindows/include/wx/os2 wxWindows/include/wx/protocol wxWindows/include/wx/generic wxWindows/include/wx/os2 wxWindows/include/wx/protocol
wxWindows/include/wx/html \ wxWindows/include/wx/html \
wxWindows/src !wxWindows/src/Makefile !wxWindows/src/Makefile.in !wxWindows/src/gdk_implib \ wxWindows/src !wxWindows/src/Makefile !wxWindows/src/Makefile.in \
!wxWindows/src/mac !wxWindows/src/motif !wxWindows/src/msw !wxWindows/src/png \ !wxWindows/src/mac !wxWindows/src/motif !wxWindows/src/msw !wxWindows/src/png \
!wxWindows/src/qt !wxWindows/src/stubs !wxWindows/src/unix !wxWindows/src/zlib \ !wxWindows/src/qt !wxWindows/src/stubs !wxWindows/src/unix !wxWindows/src/zlib \
!wxWindows/src/iodbc !wxWindows/src/iodbc

View File

@ -20,6 +20,9 @@
#include "wx/image.h" #include "wx/image.h"
#include "wx/listctrl.h" #include "wx/listctrl.h"
#include "wx/sizer.h"
#include "wx/log.h"
// derived classes // derived classes
@ -35,6 +38,12 @@ public:
MyCanvas( wxWindow *parent, wxWindowID, const wxPoint &pos, const wxSize &size ); MyCanvas( wxWindow *parent, wxWindowID, const wxPoint &pos, const wxSize &size );
~MyCanvas(); ~MyCanvas();
void OnPaint( wxPaintEvent &event ); void OnPaint( wxPaintEvent &event );
void OnAddButton( wxCommandEvent &event );
void OnDeleteButton( wxCommandEvent &event );
void OnMoveButton( wxCommandEvent &event );
void OnScrollWin( wxCommandEvent &event );
wxButton *m_button;
DECLARE_DYNAMIC_CLASS(MyCanvas) DECLARE_DYNAMIC_CLASS(MyCanvas)
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
@ -51,6 +60,7 @@ public:
void OnQuit( wxCommandEvent &event ); void OnQuit( wxCommandEvent &event );
MyCanvas *m_canvas; MyCanvas *m_canvas;
wxTextCtrl *m_log;
DECLARE_DYNAMIC_CLASS(MyFrame) DECLARE_DYNAMIC_CLASS(MyFrame)
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
@ -68,18 +78,36 @@ public:
IMPLEMENT_APP(MyApp) IMPLEMENT_APP(MyApp)
// ids
#define ID_ADDBUTTON 1
#define ID_DELBUTTON 2
#define ID_MOVEBUTTON 3
#define ID_SCROLLWIN 4
#define ID_NEWBUTTON 10
// MyCanvas // MyCanvas
IMPLEMENT_DYNAMIC_CLASS(MyCanvas, wxScrolledWindow) IMPLEMENT_DYNAMIC_CLASS(MyCanvas, wxScrolledWindow)
BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow) BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow)
// EVT_PAINT(MyCanvas::OnPaint) EVT_PAINT( MyCanvas::OnPaint)
EVT_BUTTON( ID_ADDBUTTON, MyCanvas::OnAddButton)
EVT_BUTTON( ID_DELBUTTON, MyCanvas::OnDeleteButton)
EVT_BUTTON( ID_MOVEBUTTON, MyCanvas::OnMoveButton)
EVT_BUTTON( ID_SCROLLWIN, MyCanvas::OnScrollWin)
END_EVENT_TABLE() END_EVENT_TABLE()
MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id, MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size ) const wxPoint &pos, const wxSize &size )
: wxScrolledWindow( parent, id, pos, size, wxSUNKEN_BORDER | wxTAB_TRAVERSAL, "test canvas" ) : wxScrolledWindow( parent, id, pos, size, wxSUNKEN_BORDER | wxTAB_TRAVERSAL, "test canvas" )
{ {
(void) new wxButton( this, ID_ADDBUTTON, "add button", wxPoint(10,10) );
(void) new wxButton( this, ID_DELBUTTON, "del button", wxPoint(10,40) );
(void) new wxButton( this, ID_MOVEBUTTON, "move button", wxPoint(150,10) );
(void) new wxButton( this, ID_SCROLLWIN, "scroll win", wxPoint(250,10) );
wxString choices[] = wxString choices[] =
{ {
"This", "This",
@ -89,20 +117,20 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
"examples." "examples."
}; };
(void) new wxButton( this, -1, "wxButton", wxPoint(10,10) ); m_button = new wxButton( this, -1, "wxButton", wxPoint(10,110) );
(void) new wxTextCtrl( this, -1, "wxTextCtrl", wxPoint(10,50) ); (void) new wxTextCtrl( this, -1, "wxTextCtrl", wxPoint(10,150) );
(void) new wxRadioButton( this, -1, "Disable", wxPoint(10,90) ); (void) new wxRadioButton( this, -1, "Disable", wxPoint(10,190) );
(void) new wxComboBox( this, -1, "This", wxPoint(10,130), wxDefaultSize, 5, choices ); (void) new wxComboBox( this, -1, "This", wxPoint(10,230), wxDefaultSize, 5, choices );
(void) new wxRadioBox( this, -1, "This", wxPoint(10,200), wxDefaultSize, 5, choices, 2, wxRA_SPECIFY_COLS ); (void) new wxRadioBox( this, -1, "This", wxPoint(10,310), wxDefaultSize, 5, choices, 2, wxRA_SPECIFY_COLS );
(void) new wxRadioBox( this, -1, "This", wxPoint(10,300), wxDefaultSize, 5, choices, 2, wxRA_SPECIFY_ROWS ); (void) new wxRadioBox( this, -1, "This", wxPoint(10,440), wxDefaultSize, 5, choices, 2, wxRA_SPECIFY_ROWS );
wxListCtrl *m_listCtrl = new wxListCtrl( wxListCtrl *m_listCtrl = new wxListCtrl(
this, -1, wxPoint(200, 10), wxSize(180, 120), this, -1, wxPoint(200, 110), wxSize(180, 120),
wxLC_REPORT | wxSIMPLE_BORDER | wxLC_SINGLE_SEL ); wxLC_REPORT | wxSIMPLE_BORDER | wxLC_SINGLE_SEL );
m_listCtrl->InsertColumn(0, "First", wxLIST_FORMAT_LEFT, 90); m_listCtrl->InsertColumn(0, "First", wxLIST_FORMAT_LEFT, 90);
@ -116,19 +144,19 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
} }
m_listCtrl->SetItemState( 3, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED ); m_listCtrl->SetItemState( 3, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
(void) new wxListBox( this, -1, wxPoint(200,180), wxSize(180,120), 5, choices, wxLB_ALWAYS_SB ); (void) new wxListBox( this, -1, wxPoint(260,280), wxSize(120,120), 5, choices, wxLB_ALWAYS_SB );
wxWindow *test = new wxWindow( this, -1, wxPoint(10, 400), wxSize(130,120), wxSIMPLE_BORDER | wxTAB_TRAVERSAL ); wxWindow *test = new wxWindow( this, -1, wxPoint(10, 530), wxSize(130,120), wxSIMPLE_BORDER | wxTAB_TRAVERSAL );
test->SetBackgroundColour( "WHEAT" ); test->SetBackgroundColour( "WHEAT" );
wxButton *test2 = new wxButton( test, -1, "Hallo", wxPoint(10,10) ); wxButton *test2 = new wxButton( test, -1, "Hallo", wxPoint(10,10) );
test = new wxWindow( this, -1, wxPoint(160, 400), wxSize(130,120), wxSUNKEN_BORDER | wxTAB_TRAVERSAL ); test = new wxWindow( this, -1, wxPoint(160, 530), wxSize(130,120), wxSUNKEN_BORDER | wxTAB_TRAVERSAL );
test->SetBackgroundColour( "WHEAT" ); test->SetBackgroundColour( "WHEAT" );
test->SetCursor( wxCursor( wxCURSOR_NO_ENTRY ) ); test->SetCursor( wxCursor( wxCURSOR_NO_ENTRY ) );
test2 = new wxButton( test, -1, "Hallo", wxPoint(10,10) ); test2 = new wxButton( test, -1, "Hallo", wxPoint(10,10) );
test2->SetCursor( wxCursor( wxCURSOR_PENCIL ) ); test2->SetCursor( wxCursor( wxCURSOR_PENCIL ) );
test = new wxWindow( this, -1, wxPoint(310, 400), wxSize(130,120), wxRAISED_BORDER | wxTAB_TRAVERSAL ); test = new wxWindow( this, -1, wxPoint(310, 530), wxSize(130,120), wxRAISED_BORDER | wxTAB_TRAVERSAL );
test->SetBackgroundColour( "WHEAT" ); test->SetBackgroundColour( "WHEAT" );
test->SetCursor( wxCursor( wxCURSOR_PENCIL ) ); test->SetCursor( wxCursor( wxCURSOR_PENCIL ) );
test2 = new wxButton( test, -1, "Hallo", wxPoint(10,10) ); test2 = new wxButton( test, -1, "Hallo", wxPoint(10,10) );
@ -143,14 +171,45 @@ MyCanvas::~MyCanvas()
{ {
} }
void MyCanvas::OnAddButton( wxCommandEvent &WXUNUSED(event) )
{
wxLogMessage( "Inserting button at position 50,50" );
(void) new wxButton( this, ID_NEWBUTTON, "new button", wxPoint(50,50) );
}
void MyCanvas::OnDeleteButton( wxCommandEvent &event )
{
wxLogMessage( "deleting button inserted with ""add button""" );
wxWindow *win = FindWindow( ID_NEWBUTTON );
if (win)
win->Destroy();
else
wxLogMessage( "-> No window with id = ID_NEWBUTTON found." );
}
void MyCanvas::OnMoveButton( wxCommandEvent &event )
{
wxLogMessage( "Moving button 10 pixels downward.." );
wxWindow *win = FindWindow( event.GetId() );
win->Move( -1, win->GetPosition().y + 10 );
}
void MyCanvas::OnScrollWin( wxCommandEvent &WXUNUSED(event) )
{
wxLogMessage( "Scrolling 2 units up.\nThe white square and the controls should move equally!" );
int x,y;
ViewStart( &x, &y );
Scroll( -1, y+2 );
}
void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) ) void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
{ {
wxPaintDC dc( this ); wxPaintDC dc( this );
PrepareDC( dc ); PrepareDC( dc );
dc.DrawText( "Some text", 110, 10 ); dc.DrawText( "Some text", 140, 140 );
dc.DrawRectangle( 50, 30, 200, 200 ); dc.DrawRectangle( 100, 160, 200, 200 );
} }
// MyFrame // MyFrame
@ -167,7 +226,7 @@ END_EVENT_TABLE()
MyFrame::MyFrame() MyFrame::MyFrame()
: wxFrame( (wxFrame *)NULL, -1, "wxScrolledWindow sample", : wxFrame( (wxFrame *)NULL, -1, "wxScrolledWindow sample",
wxPoint(20,20), wxSize(470,360) ) wxPoint(20,20), wxSize(470,500) )
{ {
wxMenu *file_menu = new wxMenu(); wxMenu *file_menu = new wxMenu();
file_menu->Append( ID_ABOUT, "&About.."); file_menu->Append( ID_ABOUT, "&About..");
@ -182,8 +241,20 @@ MyFrame::MyFrame()
int widths[] = { -1, 100 }; int widths[] = { -1, 100 };
SetStatusWidths( 2, widths ); SetStatusWidths( 2, widths );
m_canvas = new MyCanvas( this, -1, wxPoint(0,0), wxSize(10,10) ); m_canvas = new MyCanvas( this, -1, wxPoint(0,0), wxSize(100,100) );
m_canvas->SetScrollbars( 10, 10, 50, 100 ); m_canvas->SetScrollbars( 10, 10, 50, 100 );
m_log = new wxTextCtrl( this, -1, "This is the log window.\n", wxPoint(0,0), wxSize(100,100), wxTE_MULTILINE );
wxLog *old_log = wxLog::SetActiveTarget( new wxLogTextCtrl( m_log ) );
delete old_log;
wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
topsizer->Add( m_canvas, 1, wxEXPAND );
topsizer->Add( m_log, 0, wxEXPAND );
SetAutoLayout( TRUE );
SetSizer( topsizer );
} }
void MyFrame::OnQuit( wxCommandEvent &WXUNUSED(event) ) void MyFrame::OnQuit( wxCommandEvent &WXUNUSED(event) )

View File

@ -437,6 +437,7 @@ void wxScrolledWindow::Scroll( int x_pos, int y_pos )
if (x_pos != -1) if (x_pos != -1)
{ {
int old_x = m_xScrollPosition;
m_xScrollPosition = x_pos; m_xScrollPosition = x_pos;
// Calculate page size i.e. number of scroll units you get on the // Calculate page size i.e. number of scroll units you get on the
@ -450,9 +451,12 @@ void wxScrolledWindow::Scroll( int x_pos, int y_pos )
m_xScrollPosition = wxMax( 0, m_xScrollPosition ); m_xScrollPosition = wxMax( 0, m_xScrollPosition );
SetScrollPos( wxHORIZONTAL, m_xScrollPosition, TRUE ); SetScrollPos( wxHORIZONTAL, m_xScrollPosition, TRUE );
ScrollWindow( (old_x-m_xScrollPosition)*m_xScrollPixelsPerLine, 0 );
} }
if (y_pos != -1) if (y_pos != -1)
{ {
int old_y = m_yScrollPosition;
m_yScrollPosition = y_pos; m_yScrollPosition = y_pos;
// Calculate page size i.e. number of scroll units you get on the // Calculate page size i.e. number of scroll units you get on the
@ -466,13 +470,15 @@ void wxScrolledWindow::Scroll( int x_pos, int y_pos )
m_yScrollPosition = wxMax( 0, m_yScrollPosition ); m_yScrollPosition = wxMax( 0, m_yScrollPosition );
SetScrollPos( wxVERTICAL, m_yScrollPosition, TRUE ); SetScrollPos( wxVERTICAL, m_yScrollPosition, TRUE );
ScrollWindow( 0, (old_y-m_yScrollPosition)*m_yScrollPixelsPerLine );
} }
#ifdef __WXMSW__ #ifdef __WXMSW__
::UpdateWindow ((HWND) GetHWND()); // ::UpdateWindow ((HWND) GetHWND());
#else #else
Refresh(); // Refresh();
#endif #endif
} }

View File

@ -14,6 +14,7 @@
#include "wx/dcclient.h" #include "wx/dcclient.h"
#include "wx/dcmemory.h" #include "wx/dcmemory.h"
#include "wx/image.h" #include "wx/image.h"
#include "wx/gtk/win_gtk.h"
#include <math.h> // for floating-point functions #include <math.h> // for floating-point functions
#include "gdk/gdk.h" #include "gdk/gdk.h"
@ -118,7 +119,8 @@ wxWindowDC::wxWindowDC( wxWindow *window )
wxASSERT_MSG( widget, wxT("DC needs a widget") ); wxASSERT_MSG( widget, wxT("DC needs a widget") );
m_window = widget->window; GtkMyFixed *myfixed = GTK_MYFIXED( widget );
m_window = myfixed->bin_window;
/* not realized ? */ /* not realized ? */
if (!m_window) if (!m_window)

File diff suppressed because it is too large Load Diff

View File

@ -210,6 +210,109 @@ gdk_window_warp_pointer (GdkWindow *window,
extern void wxapp_install_idle_handler(); extern void wxapp_install_idle_handler();
extern bool g_isIdle; extern bool g_isIdle;
//-----------------------------------------------------------------------------
// local code (see below)
//-----------------------------------------------------------------------------
#if (GTK_MINOR_VERSION > 0)
static void draw_frame( GtkWidget *widget, wxWindow *win )
{
if (!win->m_hasVMT)
return;
int dw = 0;
int dh = 0;
if (win->HasScrolling())
{
GtkScrolledWindow *scroll_window = GTK_SCROLLED_WINDOW(widget);
GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(widget)->klass );
/*
GtkWidget *hscrollbar = scroll_window->hscrollbar;
GtkWidget *vscrollbar = scroll_window->vscrollbar;
we use this instead: range.slider_width = 11 + 2*2pts edge
*/
if (scroll_window->vscrollbar_visible)
{
dw += 15; /* dw += vscrollbar->allocation.width; */
dw += scroll_class->scrollbar_spacing;
}
if (scroll_window->hscrollbar_visible)
{
dh += 15; /* dh += hscrollbar->allocation.height; */
dh += scroll_class->scrollbar_spacing;
}
}
int dx = 0;
int dy = 0;
if (GTK_WIDGET_NO_WINDOW (widget))
{
dx += widget->allocation.x;
dy += widget->allocation.y;
}
if (win->HasFlag(wxRAISED_BORDER))
{
gtk_draw_shadow( widget->style,
widget->window,
GTK_STATE_NORMAL,
GTK_SHADOW_OUT,
dx, dy,
win->m_width-dw, win->m_height-dh );
return;
}
if (win->HasFlag(wxSUNKEN_BORDER))
{
gtk_draw_shadow( widget->style,
widget->window,
GTK_STATE_NORMAL,
GTK_SHADOW_IN,
dx, dy,
win->m_width-dw, win->m_height-dh );
return;
}
if (win->HasFlag(wxSIMPLE_BORDER))
{
GdkGC *gc;
gc = gdk_gc_new( widget->window );
gdk_gc_set_foreground( gc, &widget->style->black );
gdk_draw_rectangle( widget->window, gc, FALSE,
dx, dy,
win->m_width-dw-1, win->m_height-dh-1 );
gdk_gc_unref( gc );
return;
}
}
//-----------------------------------------------------------------------------
// "expose_event" of m_widget
//-----------------------------------------------------------------------------
static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_event, wxWindow *win )
{
if (gdk_event->count > 0) return;
draw_frame( widget, win );
}
//-----------------------------------------------------------------------------
// "draw" of m_wxwindow
//-----------------------------------------------------------------------------
static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNUSED(rect), wxWindow *win )
{
draw_frame( widget, win );
}
#endif // GTK_MINOR_VERSION > 0
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// key event conversion routines // key event conversion routines
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -564,108 +667,6 @@ static long map_to_wx_keysym( KeySym keysym )
return (key_code); return (key_code);
} }
//-----------------------------------------------------------------------------
// local code (see below)
//-----------------------------------------------------------------------------
#if (GTK_MINOR_VERSION > 0)
static void draw_frame( GtkWidget *widget, wxWindow *win )
{
if (!win->m_hasVMT)
return;
int dw = 0;
int dh = 0;
if (win->HasScrolling())
{
GtkScrolledWindow *scroll_window = GTK_SCROLLED_WINDOW(widget);
GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(widget)->klass );
/*
GtkWidget *hscrollbar = scroll_window->hscrollbar;
GtkWidget *vscrollbar = scroll_window->vscrollbar;
we use this instead: range.slider_width = 11 + 2*2pts edge
*/
if (scroll_window->vscrollbar_visible)
{
dw += 15; /* dw += vscrollbar->allocation.width; */
dw += scroll_class->scrollbar_spacing;
}
if (scroll_window->hscrollbar_visible)
{
dh += 15; /* dh += hscrollbar->allocation.height; */
dh += scroll_class->scrollbar_spacing;
}
}
int dx = 0;
int dy = 0;
if (GTK_WIDGET_NO_WINDOW (widget))
{
dx += widget->allocation.x;
dy += widget->allocation.y;
}
if (win->HasFlag(wxRAISED_BORDER))
{
gtk_draw_shadow( widget->style,
widget->window,
GTK_STATE_NORMAL,
GTK_SHADOW_OUT,
dx, dy,
win->m_width-dw, win->m_height-dh );
return;
}
if (win->HasFlag(wxSUNKEN_BORDER))
{
gtk_draw_shadow( widget->style,
widget->window,
GTK_STATE_NORMAL,
GTK_SHADOW_IN,
dx, dy,
win->m_width-dw, win->m_height-dh );
return;
}
if (win->HasFlag(wxSIMPLE_BORDER))
{
GdkGC *gc = gdk_gc_new( widget->window );
gdk_gc_set_foreground( gc, &widget->style->black );
gdk_draw_rectangle( widget->window, gc, FALSE,
dx, dy,
win->m_width-dw-1, win->m_height-dh-1 );
gdk_gc_unref( gc );
return;
}
}
//-----------------------------------------------------------------------------
// "expose_event" of m_widget
//-----------------------------------------------------------------------------
static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_event, wxWindow *win )
{
if (gdk_event->count > 0) return;
draw_frame( widget, win );
}
//-----------------------------------------------------------------------------
// "draw" of m_wxwindow
//-----------------------------------------------------------------------------
static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNUSED(rect), wxWindow *win )
{
draw_frame( widget, win );
}
#endif // GTK_MINOR_VERSION > 0
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// "expose_event" of m_wxwindow // "expose_event" of m_wxwindow
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -675,9 +676,6 @@ static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExp
if (!win->m_hasVMT) if (!win->m_hasVMT)
return; return;
if (gdk_event->window != win->m_wxwindow->window)
return;
win->GetUpdateRegion().Union( gdk_event->area.x, win->GetUpdateRegion().Union( gdk_event->area.x,
gdk_event->area.y, gdk_event->area.y,
gdk_event->area.width, gdk_event->area.width,
@ -715,10 +713,6 @@ static void gtk_window_draw_callback( GtkWidget *widget, GdkRectangle *rect, wxW
if (!win->m_hasVMT) if (!win->m_hasVMT)
return; return;
GtkMyFixed *myfixed = GTK_MYFIXED (widget);
if (!myfixed->children)
return; /* mini optimisation */
win->GetUpdateRegion().Union( rect->x, rect->y, win->GetUpdateRegion().Union( rect->x, rect->y,
rect->width, rect->height ); rect->width, rect->height );
@ -2042,7 +2036,7 @@ void wxWindow::PostCreation()
GTK_SIGNAL_FUNC(gtk_window_draw_callback), (gpointer)this ); GTK_SIGNAL_FUNC(gtk_window_draw_callback), (gpointer)this );
#if (GTK_MINOR_VERSION > 0) #if (GTK_MINOR_VERSION > 0)
/* these are called when the "sunken", "raised" or "simple" borders are drawn */ /* these are called when the "sunken" or "raised" borders are drawn */
gtk_signal_connect( GTK_OBJECT(m_widget), "expose_event", gtk_signal_connect( GTK_OBJECT(m_widget), "expose_event",
GTK_SIGNAL_FUNC(gtk_window_own_expose_callback), (gpointer)this ); GTK_SIGNAL_FUNC(gtk_window_own_expose_callback), (gpointer)this );
@ -2212,7 +2206,7 @@ void wxWindow::OnInternalIdle()
if (m_wxwindow) if (m_wxwindow)
{ {
GdkWindow *window = m_wxwindow->window; GdkWindow *window = GTK_MYFIXED(m_wxwindow)->bin_window;
if (window) if (window)
gdk_window_set_cursor( window, cursor.GetCursor() ); gdk_window_set_cursor( window, cursor.GetCursor() );
@ -2410,7 +2404,7 @@ void wxWindow::DoClientToScreen( int *x, int *y ) const
GdkWindow *source = (GdkWindow *) NULL; GdkWindow *source = (GdkWindow *) NULL;
if (m_wxwindow) if (m_wxwindow)
source = m_wxwindow->window; source = GTK_MYFIXED(m_wxwindow)->bin_window;
else else
source = m_widget->window; source = m_widget->window;
@ -2439,7 +2433,7 @@ void wxWindow::DoScreenToClient( int *x, int *y ) const
GdkWindow *source = (GdkWindow *) NULL; GdkWindow *source = (GdkWindow *) NULL;
if (m_wxwindow) if (m_wxwindow)
source = m_wxwindow->window; source = GTK_MYFIXED(m_wxwindow)->bin_window;
else else
source = m_widget->window; source = m_widget->window;
@ -2642,13 +2636,17 @@ void wxWindow::WarpPointer( int x, int y )
{ {
wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
GtkWidget *connect_widget = GetConnectWidget();
if (connect_widget->window)
{
/* we provide this function ourselves as it is /* we provide this function ourselves as it is
missing in GDK */ missing in GDK (top of this file) */
gdk_window_warp_pointer( connect_widget->window, x, y );
} GdkWindow *window = (GdkWindow*) NULL;
if (m_wxwindow)
window = GTK_MYFIXED(m_wxwindow)->bin_window;
else
window = GetConnectWidget()->window;
if (window)
gdk_window_warp_pointer( window, x, y );
} }
void wxWindow::Refresh( bool eraseBackground, const wxRect *rect ) void wxWindow::Refresh( bool eraseBackground, const wxRect *rect )
@ -2661,13 +2659,13 @@ void wxWindow::Refresh( bool eraseBackground, const wxRect *rect )
{ {
if (rect) if (rect)
{ {
gdk_window_clear_area( m_wxwindow->window, gdk_window_clear_area( GTK_MYFIXED(m_wxwindow)->bin_window,
rect->x, rect->y, rect->x, rect->y,
rect->width, rect->height ); rect->width, rect->height );
} }
else else
{ {
gdk_window_clear( m_wxwindow->window ); gdk_window_clear( GTK_MYFIXED(m_wxwindow)->bin_window );
} }
} }
@ -2756,8 +2754,13 @@ bool wxWindow::SetBackgroundColour( const wxColour &colour )
if (!m_delayedBackgroundColour) return FALSE; if (!m_delayedBackgroundColour) return FALSE;
} }
GtkWidget *connect_widget = GetConnectWidget(); GdkWindow *window = (GdkWindow*) NULL;
if (!connect_widget->window) if (m_wxwindow)
window = GTK_MYFIXED(m_wxwindow)->bin_window;
else
window = GetConnectWidget()->window;
if (!window)
{ {
// indicate that a new style has been set // indicate that a new style has been set
// but it couldn't get applied as the // but it couldn't get applied as the
@ -2768,13 +2771,13 @@ bool wxWindow::SetBackgroundColour( const wxColour &colour )
return TRUE; return TRUE;
} }
if (m_wxwindow && m_wxwindow->window) if (m_wxwindow)
{ {
/* wxMSW doesn't clear the window here. I don't do that either to /* wxMSW doesn't clear the window here. I don't do that either to
provide compatibility. call Clear() to do the job. */ provide compatibility. call Clear() to do the job. */
m_backgroundColour.CalcPixel( gdk_window_get_colormap( m_wxwindow->window ) ); m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
gdk_window_set_background( m_wxwindow->window, m_backgroundColour.GetColor() ); gdk_window_set_background( window, m_backgroundColour.GetColor() );
} }
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE ); wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
@ -2803,8 +2806,13 @@ bool wxWindow::SetForegroundColour( const wxColour &colour )
if (!m_delayedForegroundColour) return FALSE; if (!m_delayedForegroundColour) return FALSE;
} }
GtkWidget *connect_widget = GetConnectWidget(); GdkWindow *window = (GdkWindow*) NULL;
if (!connect_widget->window) if (m_wxwindow)
window = GTK_MYFIXED(m_wxwindow)->bin_window;
else
window = GetConnectWidget()->window;
if (!window)
{ {
// indicate that a new style has been set // indicate that a new style has been set
// but it couldn't get applied as the // but it couldn't get applied as the
@ -2973,7 +2981,9 @@ GtkWidget* wxWindow::GetConnectWidget()
bool wxWindow::IsOwnGtkWindow( GdkWindow *window ) bool wxWindow::IsOwnGtkWindow( GdkWindow *window )
{ {
if (m_wxwindow) return (window == m_wxwindow->window); if (m_wxwindow)
return (window == GTK_MYFIXED(m_wxwindow)->bin_window);
return (window == m_widget->window); return (window == m_widget->window);
} }
@ -2988,8 +2998,13 @@ bool wxWindow::SetFont( const wxFont &font )
if (!m_delayedFont) return FALSE; if (!m_delayedFont) return FALSE;
} }
GtkWidget *connect_widget = GetConnectWidget(); GdkWindow *window = (GdkWindow*) NULL;
if (!connect_widget->window) if (m_wxwindow)
window = GTK_MYFIXED(m_wxwindow)->bin_window;
else
window = GetConnectWidget()->window;
if (!window)
{ {
// indicate that a new style has been set // indicate that a new style has been set
// but it couldn't get applied as the // but it couldn't get applied as the
@ -3021,10 +3036,15 @@ void wxWindow::CaptureMouse()
wxCHECK_RET( g_captureWindow == NULL, wxT("CaptureMouse called twice") ); wxCHECK_RET( g_captureWindow == NULL, wxT("CaptureMouse called twice") );
GtkWidget *connect_widget = GetConnectWidget(); GdkWindow *window = (GdkWindow*) NULL;
if (!connect_widget->window) return; if (m_wxwindow)
window = GTK_MYFIXED(m_wxwindow)->bin_window;
else
window = GetConnectWidget()->window;
gdk_pointer_grab( connect_widget->window, FALSE, if (!window) return;
gdk_pointer_grab( window, FALSE,
(GdkEventMask) (GdkEventMask)
(GDK_BUTTON_PRESS_MASK | (GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_RELEASE_MASK |
@ -3042,8 +3062,13 @@ void wxWindow::ReleaseMouse()
wxCHECK_RET( g_captureWindow, wxT("ReleaseMouse called twice") ); wxCHECK_RET( g_captureWindow, wxT("ReleaseMouse called twice") );
GtkWidget *connect_widget = GetConnectWidget(); GdkWindow *window = (GdkWindow*) NULL;
if (!connect_widget->window) return; if (m_wxwindow)
window = GTK_MYFIXED(m_wxwindow)->bin_window;
else
window = GetConnectWidget()->window;
if (!window) return;
gdk_pointer_ungrab ( GDK_CURRENT_TIME ); gdk_pointer_ungrab ( GDK_CURRENT_TIME );
g_captureWindow = (wxWindow*) NULL; g_captureWindow = (wxWindow*) NULL;
@ -3203,6 +3228,9 @@ void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) )
wxCHECK_RET( m_wxwindow != NULL, wxT("window needs client area for scrolling") ); wxCHECK_RET( m_wxwindow != NULL, wxT("window needs client area for scrolling") );
gtk_myfixed_scroll( GTK_MYFIXED(m_wxwindow), -dx, -dy );
/*
if (!m_scrollGC) if (!m_scrollGC)
{ {
m_scrollGC = gdk_gc_new( m_wxwindow->window ); m_scrollGC = gdk_gc_new( m_wxwindow->window );
@ -3252,6 +3280,7 @@ void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) )
Refresh( TRUE, &rect ); Refresh( TRUE, &rect );
} }
*/
} }
void wxWindow::SetScrolling(bool scroll) void wxWindow::SetScrolling(bool scroll)

View File

@ -14,6 +14,7 @@
#include "wx/dcclient.h" #include "wx/dcclient.h"
#include "wx/dcmemory.h" #include "wx/dcmemory.h"
#include "wx/image.h" #include "wx/image.h"
#include "wx/gtk/win_gtk.h"
#include <math.h> // for floating-point functions #include <math.h> // for floating-point functions
#include "gdk/gdk.h" #include "gdk/gdk.h"
@ -118,7 +119,8 @@ wxWindowDC::wxWindowDC( wxWindow *window )
wxASSERT_MSG( widget, wxT("DC needs a widget") ); wxASSERT_MSG( widget, wxT("DC needs a widget") );
m_window = widget->window; GtkMyFixed *myfixed = GTK_MYFIXED( widget );
m_window = myfixed->bin_window;
/* not realized ? */ /* not realized ? */
if (!m_window) if (!m_window)

File diff suppressed because it is too large Load Diff

View File

@ -210,6 +210,109 @@ gdk_window_warp_pointer (GdkWindow *window,
extern void wxapp_install_idle_handler(); extern void wxapp_install_idle_handler();
extern bool g_isIdle; extern bool g_isIdle;
//-----------------------------------------------------------------------------
// local code (see below)
//-----------------------------------------------------------------------------
#if (GTK_MINOR_VERSION > 0)
static void draw_frame( GtkWidget *widget, wxWindow *win )
{
if (!win->m_hasVMT)
return;
int dw = 0;
int dh = 0;
if (win->HasScrolling())
{
GtkScrolledWindow *scroll_window = GTK_SCROLLED_WINDOW(widget);
GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(widget)->klass );
/*
GtkWidget *hscrollbar = scroll_window->hscrollbar;
GtkWidget *vscrollbar = scroll_window->vscrollbar;
we use this instead: range.slider_width = 11 + 2*2pts edge
*/
if (scroll_window->vscrollbar_visible)
{
dw += 15; /* dw += vscrollbar->allocation.width; */
dw += scroll_class->scrollbar_spacing;
}
if (scroll_window->hscrollbar_visible)
{
dh += 15; /* dh += hscrollbar->allocation.height; */
dh += scroll_class->scrollbar_spacing;
}
}
int dx = 0;
int dy = 0;
if (GTK_WIDGET_NO_WINDOW (widget))
{
dx += widget->allocation.x;
dy += widget->allocation.y;
}
if (win->HasFlag(wxRAISED_BORDER))
{
gtk_draw_shadow( widget->style,
widget->window,
GTK_STATE_NORMAL,
GTK_SHADOW_OUT,
dx, dy,
win->m_width-dw, win->m_height-dh );
return;
}
if (win->HasFlag(wxSUNKEN_BORDER))
{
gtk_draw_shadow( widget->style,
widget->window,
GTK_STATE_NORMAL,
GTK_SHADOW_IN,
dx, dy,
win->m_width-dw, win->m_height-dh );
return;
}
if (win->HasFlag(wxSIMPLE_BORDER))
{
GdkGC *gc;
gc = gdk_gc_new( widget->window );
gdk_gc_set_foreground( gc, &widget->style->black );
gdk_draw_rectangle( widget->window, gc, FALSE,
dx, dy,
win->m_width-dw-1, win->m_height-dh-1 );
gdk_gc_unref( gc );
return;
}
}
//-----------------------------------------------------------------------------
// "expose_event" of m_widget
//-----------------------------------------------------------------------------
static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_event, wxWindow *win )
{
if (gdk_event->count > 0) return;
draw_frame( widget, win );
}
//-----------------------------------------------------------------------------
// "draw" of m_wxwindow
//-----------------------------------------------------------------------------
static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNUSED(rect), wxWindow *win )
{
draw_frame( widget, win );
}
#endif // GTK_MINOR_VERSION > 0
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// key event conversion routines // key event conversion routines
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -564,108 +667,6 @@ static long map_to_wx_keysym( KeySym keysym )
return (key_code); return (key_code);
} }
//-----------------------------------------------------------------------------
// local code (see below)
//-----------------------------------------------------------------------------
#if (GTK_MINOR_VERSION > 0)
static void draw_frame( GtkWidget *widget, wxWindow *win )
{
if (!win->m_hasVMT)
return;
int dw = 0;
int dh = 0;
if (win->HasScrolling())
{
GtkScrolledWindow *scroll_window = GTK_SCROLLED_WINDOW(widget);
GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(widget)->klass );
/*
GtkWidget *hscrollbar = scroll_window->hscrollbar;
GtkWidget *vscrollbar = scroll_window->vscrollbar;
we use this instead: range.slider_width = 11 + 2*2pts edge
*/
if (scroll_window->vscrollbar_visible)
{
dw += 15; /* dw += vscrollbar->allocation.width; */
dw += scroll_class->scrollbar_spacing;
}
if (scroll_window->hscrollbar_visible)
{
dh += 15; /* dh += hscrollbar->allocation.height; */
dh += scroll_class->scrollbar_spacing;
}
}
int dx = 0;
int dy = 0;
if (GTK_WIDGET_NO_WINDOW (widget))
{
dx += widget->allocation.x;
dy += widget->allocation.y;
}
if (win->HasFlag(wxRAISED_BORDER))
{
gtk_draw_shadow( widget->style,
widget->window,
GTK_STATE_NORMAL,
GTK_SHADOW_OUT,
dx, dy,
win->m_width-dw, win->m_height-dh );
return;
}
if (win->HasFlag(wxSUNKEN_BORDER))
{
gtk_draw_shadow( widget->style,
widget->window,
GTK_STATE_NORMAL,
GTK_SHADOW_IN,
dx, dy,
win->m_width-dw, win->m_height-dh );
return;
}
if (win->HasFlag(wxSIMPLE_BORDER))
{
GdkGC *gc = gdk_gc_new( widget->window );
gdk_gc_set_foreground( gc, &widget->style->black );
gdk_draw_rectangle( widget->window, gc, FALSE,
dx, dy,
win->m_width-dw-1, win->m_height-dh-1 );
gdk_gc_unref( gc );
return;
}
}
//-----------------------------------------------------------------------------
// "expose_event" of m_widget
//-----------------------------------------------------------------------------
static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_event, wxWindow *win )
{
if (gdk_event->count > 0) return;
draw_frame( widget, win );
}
//-----------------------------------------------------------------------------
// "draw" of m_wxwindow
//-----------------------------------------------------------------------------
static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNUSED(rect), wxWindow *win )
{
draw_frame( widget, win );
}
#endif // GTK_MINOR_VERSION > 0
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// "expose_event" of m_wxwindow // "expose_event" of m_wxwindow
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -675,9 +676,6 @@ static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExp
if (!win->m_hasVMT) if (!win->m_hasVMT)
return; return;
if (gdk_event->window != win->m_wxwindow->window)
return;
win->GetUpdateRegion().Union( gdk_event->area.x, win->GetUpdateRegion().Union( gdk_event->area.x,
gdk_event->area.y, gdk_event->area.y,
gdk_event->area.width, gdk_event->area.width,
@ -715,10 +713,6 @@ static void gtk_window_draw_callback( GtkWidget *widget, GdkRectangle *rect, wxW
if (!win->m_hasVMT) if (!win->m_hasVMT)
return; return;
GtkMyFixed *myfixed = GTK_MYFIXED (widget);
if (!myfixed->children)
return; /* mini optimisation */
win->GetUpdateRegion().Union( rect->x, rect->y, win->GetUpdateRegion().Union( rect->x, rect->y,
rect->width, rect->height ); rect->width, rect->height );
@ -2042,7 +2036,7 @@ void wxWindow::PostCreation()
GTK_SIGNAL_FUNC(gtk_window_draw_callback), (gpointer)this ); GTK_SIGNAL_FUNC(gtk_window_draw_callback), (gpointer)this );
#if (GTK_MINOR_VERSION > 0) #if (GTK_MINOR_VERSION > 0)
/* these are called when the "sunken", "raised" or "simple" borders are drawn */ /* these are called when the "sunken" or "raised" borders are drawn */
gtk_signal_connect( GTK_OBJECT(m_widget), "expose_event", gtk_signal_connect( GTK_OBJECT(m_widget), "expose_event",
GTK_SIGNAL_FUNC(gtk_window_own_expose_callback), (gpointer)this ); GTK_SIGNAL_FUNC(gtk_window_own_expose_callback), (gpointer)this );
@ -2212,7 +2206,7 @@ void wxWindow::OnInternalIdle()
if (m_wxwindow) if (m_wxwindow)
{ {
GdkWindow *window = m_wxwindow->window; GdkWindow *window = GTK_MYFIXED(m_wxwindow)->bin_window;
if (window) if (window)
gdk_window_set_cursor( window, cursor.GetCursor() ); gdk_window_set_cursor( window, cursor.GetCursor() );
@ -2410,7 +2404,7 @@ void wxWindow::DoClientToScreen( int *x, int *y ) const
GdkWindow *source = (GdkWindow *) NULL; GdkWindow *source = (GdkWindow *) NULL;
if (m_wxwindow) if (m_wxwindow)
source = m_wxwindow->window; source = GTK_MYFIXED(m_wxwindow)->bin_window;
else else
source = m_widget->window; source = m_widget->window;
@ -2439,7 +2433,7 @@ void wxWindow::DoScreenToClient( int *x, int *y ) const
GdkWindow *source = (GdkWindow *) NULL; GdkWindow *source = (GdkWindow *) NULL;
if (m_wxwindow) if (m_wxwindow)
source = m_wxwindow->window; source = GTK_MYFIXED(m_wxwindow)->bin_window;
else else
source = m_widget->window; source = m_widget->window;
@ -2642,13 +2636,17 @@ void wxWindow::WarpPointer( int x, int y )
{ {
wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
GtkWidget *connect_widget = GetConnectWidget();
if (connect_widget->window)
{
/* we provide this function ourselves as it is /* we provide this function ourselves as it is
missing in GDK */ missing in GDK (top of this file) */
gdk_window_warp_pointer( connect_widget->window, x, y );
} GdkWindow *window = (GdkWindow*) NULL;
if (m_wxwindow)
window = GTK_MYFIXED(m_wxwindow)->bin_window;
else
window = GetConnectWidget()->window;
if (window)
gdk_window_warp_pointer( window, x, y );
} }
void wxWindow::Refresh( bool eraseBackground, const wxRect *rect ) void wxWindow::Refresh( bool eraseBackground, const wxRect *rect )
@ -2661,13 +2659,13 @@ void wxWindow::Refresh( bool eraseBackground, const wxRect *rect )
{ {
if (rect) if (rect)
{ {
gdk_window_clear_area( m_wxwindow->window, gdk_window_clear_area( GTK_MYFIXED(m_wxwindow)->bin_window,
rect->x, rect->y, rect->x, rect->y,
rect->width, rect->height ); rect->width, rect->height );
} }
else else
{ {
gdk_window_clear( m_wxwindow->window ); gdk_window_clear( GTK_MYFIXED(m_wxwindow)->bin_window );
} }
} }
@ -2756,8 +2754,13 @@ bool wxWindow::SetBackgroundColour( const wxColour &colour )
if (!m_delayedBackgroundColour) return FALSE; if (!m_delayedBackgroundColour) return FALSE;
} }
GtkWidget *connect_widget = GetConnectWidget(); GdkWindow *window = (GdkWindow*) NULL;
if (!connect_widget->window) if (m_wxwindow)
window = GTK_MYFIXED(m_wxwindow)->bin_window;
else
window = GetConnectWidget()->window;
if (!window)
{ {
// indicate that a new style has been set // indicate that a new style has been set
// but it couldn't get applied as the // but it couldn't get applied as the
@ -2768,13 +2771,13 @@ bool wxWindow::SetBackgroundColour( const wxColour &colour )
return TRUE; return TRUE;
} }
if (m_wxwindow && m_wxwindow->window) if (m_wxwindow)
{ {
/* wxMSW doesn't clear the window here. I don't do that either to /* wxMSW doesn't clear the window here. I don't do that either to
provide compatibility. call Clear() to do the job. */ provide compatibility. call Clear() to do the job. */
m_backgroundColour.CalcPixel( gdk_window_get_colormap( m_wxwindow->window ) ); m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
gdk_window_set_background( m_wxwindow->window, m_backgroundColour.GetColor() ); gdk_window_set_background( window, m_backgroundColour.GetColor() );
} }
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE ); wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
@ -2803,8 +2806,13 @@ bool wxWindow::SetForegroundColour( const wxColour &colour )
if (!m_delayedForegroundColour) return FALSE; if (!m_delayedForegroundColour) return FALSE;
} }
GtkWidget *connect_widget = GetConnectWidget(); GdkWindow *window = (GdkWindow*) NULL;
if (!connect_widget->window) if (m_wxwindow)
window = GTK_MYFIXED(m_wxwindow)->bin_window;
else
window = GetConnectWidget()->window;
if (!window)
{ {
// indicate that a new style has been set // indicate that a new style has been set
// but it couldn't get applied as the // but it couldn't get applied as the
@ -2973,7 +2981,9 @@ GtkWidget* wxWindow::GetConnectWidget()
bool wxWindow::IsOwnGtkWindow( GdkWindow *window ) bool wxWindow::IsOwnGtkWindow( GdkWindow *window )
{ {
if (m_wxwindow) return (window == m_wxwindow->window); if (m_wxwindow)
return (window == GTK_MYFIXED(m_wxwindow)->bin_window);
return (window == m_widget->window); return (window == m_widget->window);
} }
@ -2988,8 +2998,13 @@ bool wxWindow::SetFont( const wxFont &font )
if (!m_delayedFont) return FALSE; if (!m_delayedFont) return FALSE;
} }
GtkWidget *connect_widget = GetConnectWidget(); GdkWindow *window = (GdkWindow*) NULL;
if (!connect_widget->window) if (m_wxwindow)
window = GTK_MYFIXED(m_wxwindow)->bin_window;
else
window = GetConnectWidget()->window;
if (!window)
{ {
// indicate that a new style has been set // indicate that a new style has been set
// but it couldn't get applied as the // but it couldn't get applied as the
@ -3021,10 +3036,15 @@ void wxWindow::CaptureMouse()
wxCHECK_RET( g_captureWindow == NULL, wxT("CaptureMouse called twice") ); wxCHECK_RET( g_captureWindow == NULL, wxT("CaptureMouse called twice") );
GtkWidget *connect_widget = GetConnectWidget(); GdkWindow *window = (GdkWindow*) NULL;
if (!connect_widget->window) return; if (m_wxwindow)
window = GTK_MYFIXED(m_wxwindow)->bin_window;
else
window = GetConnectWidget()->window;
gdk_pointer_grab( connect_widget->window, FALSE, if (!window) return;
gdk_pointer_grab( window, FALSE,
(GdkEventMask) (GdkEventMask)
(GDK_BUTTON_PRESS_MASK | (GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_RELEASE_MASK |
@ -3042,8 +3062,13 @@ void wxWindow::ReleaseMouse()
wxCHECK_RET( g_captureWindow, wxT("ReleaseMouse called twice") ); wxCHECK_RET( g_captureWindow, wxT("ReleaseMouse called twice") );
GtkWidget *connect_widget = GetConnectWidget(); GdkWindow *window = (GdkWindow*) NULL;
if (!connect_widget->window) return; if (m_wxwindow)
window = GTK_MYFIXED(m_wxwindow)->bin_window;
else
window = GetConnectWidget()->window;
if (!window) return;
gdk_pointer_ungrab ( GDK_CURRENT_TIME ); gdk_pointer_ungrab ( GDK_CURRENT_TIME );
g_captureWindow = (wxWindow*) NULL; g_captureWindow = (wxWindow*) NULL;
@ -3203,6 +3228,9 @@ void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) )
wxCHECK_RET( m_wxwindow != NULL, wxT("window needs client area for scrolling") ); wxCHECK_RET( m_wxwindow != NULL, wxT("window needs client area for scrolling") );
gtk_myfixed_scroll( GTK_MYFIXED(m_wxwindow), -dx, -dy );
/*
if (!m_scrollGC) if (!m_scrollGC)
{ {
m_scrollGC = gdk_gc_new( m_wxwindow->window ); m_scrollGC = gdk_gc_new( m_wxwindow->window );
@ -3252,6 +3280,7 @@ void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) )
Refresh( TRUE, &rect ); Refresh( TRUE, &rect );
} }
*/
} }
void wxWindow::SetScrolling(bool scroll) void wxWindow::SetScrolling(bool scroll)

View File

@ -463,10 +463,12 @@ void wxHtmlWidgetCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
c = c -> GetParent(); c = c -> GetParent();
} }
/*
((wxScrolledWindow*)(m_Wnd -> GetParent())) -> ViewStart(&stx, &sty); ((wxScrolledWindow*)(m_Wnd -> GetParent())) -> ViewStart(&stx, &sty);
m_Wnd -> SetSize(absx - HTML_SCROLL_STEP * stx, absy - HTML_SCROLL_STEP * sty, m_Width, m_Height); m_Wnd -> SetSize(absx - HTML_SCROLL_STEP * stx, absy - HTML_SCROLL_STEP * sty, m_Width, m_Height);
// m_Wnd -> Refresh(); */
m_Wnd -> SetSize(absx, absy, m_Width, m_Height);
wxHtmlCell::Draw(dc, x, y, view_y1, view_y2); wxHtmlCell::Draw(dc, x, y, view_y1, view_y2);
} }
@ -483,9 +485,14 @@ void wxHtmlWidgetCell::DrawInvisible(wxDC& dc, int x, int y)
absy += c -> GetPosY(); absy += c -> GetPosY();
c = c -> GetParent(); c = c -> GetParent();
} }
((wxScrolledWindow*)(m_Wnd -> GetParent())) -> ViewStart(&stx, &sty);
/*
((wxScrolledWindow*)(m_Wnd -> GetParent())) -> ViewStart(&stx, &sty);
m_Wnd -> SetSize(absx - HTML_SCROLL_STEP * stx, absy - HTML_SCROLL_STEP * sty, m_Width, m_Height); m_Wnd -> SetSize(absx - HTML_SCROLL_STEP * stx, absy - HTML_SCROLL_STEP * sty, m_Width, m_Height);
*/
m_Wnd -> SetSize(absx, absy, m_Width, m_Height);
wxHtmlCell::DrawInvisible(dc, x, y); wxHtmlCell::DrawInvisible(dc, x, y);
} }