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:
parent
2136a764e5
commit
ed673c6a48
@ -36,66 +36,68 @@ typedef enum
|
||||
|
||||
typedef struct _GtkMyFixed GtkMyFixed;
|
||||
typedef struct _GtkMyFixedClass GtkMyFixedClass;
|
||||
typedef struct _GtkMyFixedChild GtkMyFixedChild;
|
||||
|
||||
struct _GtkMyFixed
|
||||
{
|
||||
GtkContainer container;
|
||||
GList *children;
|
||||
#if (GTK_MINOR_VERSION > 0)
|
||||
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
|
||||
{
|
||||
GtkContainerClass parent_class;
|
||||
|
||||
#if (GTK_MINOR_VERSION > 0)
|
||||
void (*set_scroll_adjustments) (GtkMyFixed *myfixed,
|
||||
GtkAdjustment *hadjustment,
|
||||
GtkAdjustment *vadjustment);
|
||||
#endif
|
||||
};
|
||||
|
||||
struct _GtkMyFixedChild
|
||||
{
|
||||
GtkWidget *widget;
|
||||
gint16 x;
|
||||
gint16 y;
|
||||
gint16 width;
|
||||
gint16 height;
|
||||
};
|
||||
|
||||
guint gtk_myfixed_get_type (void);
|
||||
GtkWidget* gtk_myfixed_new (void);
|
||||
#if (GTK_MINOR_VERSION > 0)
|
||||
void gtk_myfixed_set_shadow_type (GtkMyFixed *myfixed,
|
||||
GtkMyShadowType type);
|
||||
#endif
|
||||
|
||||
void gtk_myfixed_scroll (GtkMyFixed *myfixed,
|
||||
gint dx,
|
||||
gint dy);
|
||||
|
||||
void gtk_myfixed_put (GtkMyFixed *myfixed,
|
||||
GtkWidget *widget,
|
||||
gint16 x,
|
||||
gint16 y,
|
||||
gint16 width,
|
||||
gint16 height);
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
|
||||
void gtk_myfixed_move (GtkMyFixed *myfixed,
|
||||
GtkWidget *widget,
|
||||
gint16 x,
|
||||
gint16 y );
|
||||
gint x,
|
||||
gint y );
|
||||
|
||||
void gtk_myfixed_resize (GtkMyFixed *myfixed,
|
||||
GtkWidget *widget,
|
||||
gint16 width,
|
||||
gint16 height );
|
||||
gint width,
|
||||
gint height );
|
||||
|
||||
void gtk_myfixed_set_size (GtkMyFixed *myfixed,
|
||||
GtkWidget *widget,
|
||||
gint16 x,
|
||||
gint16 y,
|
||||
gint16 width,
|
||||
gint16 height);
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
@ -36,66 +36,68 @@ typedef enum
|
||||
|
||||
typedef struct _GtkMyFixed GtkMyFixed;
|
||||
typedef struct _GtkMyFixedClass GtkMyFixedClass;
|
||||
typedef struct _GtkMyFixedChild GtkMyFixedChild;
|
||||
|
||||
struct _GtkMyFixed
|
||||
{
|
||||
GtkContainer container;
|
||||
GList *children;
|
||||
#if (GTK_MINOR_VERSION > 0)
|
||||
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
|
||||
{
|
||||
GtkContainerClass parent_class;
|
||||
|
||||
#if (GTK_MINOR_VERSION > 0)
|
||||
void (*set_scroll_adjustments) (GtkMyFixed *myfixed,
|
||||
GtkAdjustment *hadjustment,
|
||||
GtkAdjustment *vadjustment);
|
||||
#endif
|
||||
};
|
||||
|
||||
struct _GtkMyFixedChild
|
||||
{
|
||||
GtkWidget *widget;
|
||||
gint16 x;
|
||||
gint16 y;
|
||||
gint16 width;
|
||||
gint16 height;
|
||||
};
|
||||
|
||||
guint gtk_myfixed_get_type (void);
|
||||
GtkWidget* gtk_myfixed_new (void);
|
||||
#if (GTK_MINOR_VERSION > 0)
|
||||
void gtk_myfixed_set_shadow_type (GtkMyFixed *myfixed,
|
||||
GtkMyShadowType type);
|
||||
#endif
|
||||
|
||||
void gtk_myfixed_scroll (GtkMyFixed *myfixed,
|
||||
gint dx,
|
||||
gint dy);
|
||||
|
||||
void gtk_myfixed_put (GtkMyFixed *myfixed,
|
||||
GtkWidget *widget,
|
||||
gint16 x,
|
||||
gint16 y,
|
||||
gint16 width,
|
||||
gint16 height);
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
|
||||
void gtk_myfixed_move (GtkMyFixed *myfixed,
|
||||
GtkWidget *widget,
|
||||
gint16 x,
|
||||
gint16 y );
|
||||
gint x,
|
||||
gint y );
|
||||
|
||||
void gtk_myfixed_resize (GtkMyFixed *myfixed,
|
||||
GtkWidget *widget,
|
||||
gint16 width,
|
||||
gint16 height );
|
||||
gint width,
|
||||
gint height );
|
||||
|
||||
void gtk_myfixed_set_size (GtkMyFixed *myfixed,
|
||||
GtkWidget *widget,
|
||||
gint16 x,
|
||||
gint16 y,
|
||||
gint16 width,
|
||||
gint16 height);
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
2
modules
2
modules
@ -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/generic wxWindows/include/wx/os2 wxWindows/include/wx/protocol
|
||||
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/qt !wxWindows/src/stubs !wxWindows/src/unix !wxWindows/src/zlib \
|
||||
!wxWindows/src/iodbc
|
||||
|
@ -20,6 +20,9 @@
|
||||
|
||||
#include "wx/image.h"
|
||||
#include "wx/listctrl.h"
|
||||
#include "wx/sizer.h"
|
||||
#include "wx/log.h"
|
||||
|
||||
|
||||
// derived classes
|
||||
|
||||
@ -35,6 +38,12 @@ public:
|
||||
MyCanvas( wxWindow *parent, wxWindowID, const wxPoint &pos, const wxSize &size );
|
||||
~MyCanvas();
|
||||
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_EVENT_TABLE()
|
||||
@ -51,6 +60,7 @@ public:
|
||||
void OnQuit( wxCommandEvent &event );
|
||||
|
||||
MyCanvas *m_canvas;
|
||||
wxTextCtrl *m_log;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(MyFrame)
|
||||
DECLARE_EVENT_TABLE()
|
||||
@ -68,18 +78,36 @@ public:
|
||||
|
||||
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
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(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()
|
||||
|
||||
MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
const wxPoint &pos, const wxSize &size )
|
||||
: 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[] =
|
||||
{
|
||||
"This",
|
||||
@ -89,68 +117,99 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
"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(
|
||||
this, -1, wxPoint(200, 10), wxSize(180, 120),
|
||||
wxListCtrl *m_listCtrl = new wxListCtrl(
|
||||
this, -1, wxPoint(200, 110), wxSize(180, 120),
|
||||
wxLC_REPORT | wxSIMPLE_BORDER | wxLC_SINGLE_SEL );
|
||||
|
||||
m_listCtrl->InsertColumn(0, "First", wxLIST_FORMAT_LEFT, 90);
|
||||
m_listCtrl->InsertColumn(1, "Last", wxLIST_FORMAT_LEFT, 90);
|
||||
m_listCtrl->InsertColumn(0, "First", wxLIST_FORMAT_LEFT, 90);
|
||||
m_listCtrl->InsertColumn(1, "Last", wxLIST_FORMAT_LEFT, 90);
|
||||
|
||||
for ( int i=0; i < 30; i++)
|
||||
{
|
||||
char buf[20];
|
||||
sprintf(buf, "Item %d", i);
|
||||
m_listCtrl->InsertItem(i, buf);
|
||||
}
|
||||
m_listCtrl->SetItemState( 3, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
|
||||
for ( int i=0; i < 30; i++)
|
||||
{
|
||||
char buf[20];
|
||||
sprintf(buf, "Item %d", i);
|
||||
m_listCtrl->InsertItem(i, buf);
|
||||
}
|
||||
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 );
|
||||
test->SetBackgroundColour( "WHEAT" );
|
||||
wxButton *test2 = new wxButton( test, -1, "Hallo", wxPoint(10,10) );
|
||||
wxWindow *test = new wxWindow( this, -1, wxPoint(10, 530), wxSize(130,120), wxSIMPLE_BORDER | wxTAB_TRAVERSAL );
|
||||
test->SetBackgroundColour( "WHEAT" );
|
||||
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->SetBackgroundColour( "WHEAT" );
|
||||
test->SetCursor( wxCursor( wxCURSOR_NO_ENTRY ) );
|
||||
test2 = new wxButton( test, -1, "Hallo", wxPoint(10,10) );
|
||||
test2->SetCursor( wxCursor( wxCURSOR_PENCIL ) );
|
||||
test = new wxWindow( this, -1, wxPoint(160, 530), wxSize(130,120), wxSUNKEN_BORDER | wxTAB_TRAVERSAL );
|
||||
test->SetBackgroundColour( "WHEAT" );
|
||||
test->SetCursor( wxCursor( wxCURSOR_NO_ENTRY ) );
|
||||
test2 = new wxButton( test, -1, "Hallo", wxPoint(10,10) );
|
||||
test2->SetCursor( wxCursor( wxCURSOR_PENCIL ) );
|
||||
|
||||
test = new wxWindow( this, -1, wxPoint(310, 400), wxSize(130,120), wxRAISED_BORDER | wxTAB_TRAVERSAL );
|
||||
test->SetBackgroundColour( "WHEAT" );
|
||||
test->SetCursor( wxCursor( wxCURSOR_PENCIL ) );
|
||||
test2 = new wxButton( test, -1, "Hallo", wxPoint(10,10) );
|
||||
test2->SetCursor( wxCursor( wxCURSOR_NO_ENTRY ) );
|
||||
test = new wxWindow( this, -1, wxPoint(310, 530), wxSize(130,120), wxRAISED_BORDER | wxTAB_TRAVERSAL );
|
||||
test->SetBackgroundColour( "WHEAT" );
|
||||
test->SetCursor( wxCursor( wxCURSOR_PENCIL ) );
|
||||
test2 = new wxButton( test, -1, "Hallo", wxPoint(10,10) );
|
||||
test2->SetCursor( wxCursor( wxCURSOR_NO_ENTRY ) );
|
||||
|
||||
SetBackgroundColour( "WHEAT" );
|
||||
SetBackgroundColour( "WHEAT" );
|
||||
|
||||
SetCursor( wxCursor( wxCURSOR_IBEAM ) );
|
||||
SetCursor( wxCursor( wxCURSOR_IBEAM ) );
|
||||
}
|
||||
|
||||
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) )
|
||||
{
|
||||
wxPaintDC dc( this );
|
||||
PrepareDC( dc );
|
||||
wxPaintDC dc( this );
|
||||
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
|
||||
@ -167,23 +226,35 @@ END_EVENT_TABLE()
|
||||
|
||||
MyFrame::MyFrame()
|
||||
: wxFrame( (wxFrame *)NULL, -1, "wxScrolledWindow sample",
|
||||
wxPoint(20,20), wxSize(470,360) )
|
||||
wxPoint(20,20), wxSize(470,500) )
|
||||
{
|
||||
wxMenu *file_menu = new wxMenu();
|
||||
file_menu->Append( ID_ABOUT, "&About..");
|
||||
file_menu->Append( ID_QUIT, "E&xit\tAlt-X");
|
||||
wxMenu *file_menu = new wxMenu();
|
||||
file_menu->Append( ID_ABOUT, "&About..");
|
||||
file_menu->Append( ID_QUIT, "E&xit\tAlt-X");
|
||||
|
||||
wxMenuBar *menu_bar = new wxMenuBar();
|
||||
menu_bar->Append(file_menu, "&File");
|
||||
wxMenuBar *menu_bar = new wxMenuBar();
|
||||
menu_bar->Append(file_menu, "&File");
|
||||
|
||||
SetMenuBar( menu_bar );
|
||||
SetMenuBar( menu_bar );
|
||||
|
||||
CreateStatusBar(2);
|
||||
int widths[] = { -1, 100 };
|
||||
SetStatusWidths( 2, widths );
|
||||
CreateStatusBar(2);
|
||||
int widths[] = { -1, 100 };
|
||||
SetStatusWidths( 2, widths );
|
||||
|
||||
m_canvas = new MyCanvas( this, -1, wxPoint(0,0), wxSize(10,10) );
|
||||
m_canvas->SetScrollbars( 10, 10, 50, 100 );
|
||||
m_canvas = new MyCanvas( this, -1, wxPoint(0,0), wxSize(100,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) )
|
||||
|
@ -437,6 +437,7 @@ void wxScrolledWindow::Scroll( int x_pos, int y_pos )
|
||||
|
||||
if (x_pos != -1)
|
||||
{
|
||||
int old_x = m_xScrollPosition;
|
||||
m_xScrollPosition = x_pos;
|
||||
|
||||
// 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 );
|
||||
|
||||
SetScrollPos( wxHORIZONTAL, m_xScrollPosition, TRUE );
|
||||
|
||||
ScrollWindow( (old_x-m_xScrollPosition)*m_xScrollPixelsPerLine, 0 );
|
||||
}
|
||||
if (y_pos != -1)
|
||||
{
|
||||
int old_y = m_yScrollPosition;
|
||||
m_yScrollPosition = y_pos;
|
||||
|
||||
// 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 );
|
||||
|
||||
SetScrollPos( wxVERTICAL, m_yScrollPosition, TRUE );
|
||||
|
||||
ScrollWindow( 0, (old_y-m_yScrollPosition)*m_yScrollPixelsPerLine );
|
||||
}
|
||||
|
||||
|
||||
#ifdef __WXMSW__
|
||||
::UpdateWindow ((HWND) GetHWND());
|
||||
// ::UpdateWindow ((HWND) GetHWND());
|
||||
#else
|
||||
Refresh();
|
||||
// Refresh();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "wx/dcclient.h"
|
||||
#include "wx/dcmemory.h"
|
||||
#include "wx/image.h"
|
||||
#include "wx/gtk/win_gtk.h"
|
||||
#include <math.h> // for floating-point functions
|
||||
|
||||
#include "gdk/gdk.h"
|
||||
@ -118,7 +119,8 @@ wxWindowDC::wxWindowDC( wxWindow *window )
|
||||
|
||||
wxASSERT_MSG( widget, wxT("DC needs a widget") );
|
||||
|
||||
m_window = widget->window;
|
||||
GtkMyFixed *myfixed = GTK_MYFIXED( widget );
|
||||
m_window = myfixed->bin_window;
|
||||
|
||||
/* not realized ? */
|
||||
if (!m_window)
|
||||
|
1011
src/gtk/win_gtk.c
1011
src/gtk/win_gtk.c
File diff suppressed because it is too large
Load Diff
@ -210,6 +210,109 @@ gdk_window_warp_pointer (GdkWindow *window,
|
||||
extern void wxapp_install_idle_handler();
|
||||
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
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -564,108 +667,6 @@ static long map_to_wx_keysym( KeySym keysym )
|
||||
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
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -675,9 +676,6 @@ static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExp
|
||||
if (!win->m_hasVMT)
|
||||
return;
|
||||
|
||||
if (gdk_event->window != win->m_wxwindow->window)
|
||||
return;
|
||||
|
||||
win->GetUpdateRegion().Union( gdk_event->area.x,
|
||||
gdk_event->area.y,
|
||||
gdk_event->area.width,
|
||||
@ -715,10 +713,6 @@ static void gtk_window_draw_callback( GtkWidget *widget, GdkRectangle *rect, wxW
|
||||
if (!win->m_hasVMT)
|
||||
return;
|
||||
|
||||
GtkMyFixed *myfixed = GTK_MYFIXED (widget);
|
||||
if (!myfixed->children)
|
||||
return; /* mini optimisation */
|
||||
|
||||
win->GetUpdateRegion().Union( rect->x, rect->y,
|
||||
rect->width, rect->height );
|
||||
|
||||
@ -2042,7 +2036,7 @@ void wxWindow::PostCreation()
|
||||
GTK_SIGNAL_FUNC(gtk_window_draw_callback), (gpointer)this );
|
||||
|
||||
#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_FUNC(gtk_window_own_expose_callback), (gpointer)this );
|
||||
|
||||
@ -2212,7 +2206,7 @@ void wxWindow::OnInternalIdle()
|
||||
|
||||
if (m_wxwindow)
|
||||
{
|
||||
GdkWindow *window = m_wxwindow->window;
|
||||
GdkWindow *window = GTK_MYFIXED(m_wxwindow)->bin_window;
|
||||
if (window)
|
||||
gdk_window_set_cursor( window, cursor.GetCursor() );
|
||||
|
||||
@ -2410,7 +2404,7 @@ void wxWindow::DoClientToScreen( int *x, int *y ) const
|
||||
|
||||
GdkWindow *source = (GdkWindow *) NULL;
|
||||
if (m_wxwindow)
|
||||
source = m_wxwindow->window;
|
||||
source = GTK_MYFIXED(m_wxwindow)->bin_window;
|
||||
else
|
||||
source = m_widget->window;
|
||||
|
||||
@ -2439,7 +2433,7 @@ void wxWindow::DoScreenToClient( int *x, int *y ) const
|
||||
|
||||
GdkWindow *source = (GdkWindow *) NULL;
|
||||
if (m_wxwindow)
|
||||
source = m_wxwindow->window;
|
||||
source = GTK_MYFIXED(m_wxwindow)->bin_window;
|
||||
else
|
||||
source = m_widget->window;
|
||||
|
||||
@ -2642,13 +2636,17 @@ void wxWindow::WarpPointer( int x, int y )
|
||||
{
|
||||
wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
|
||||
|
||||
GtkWidget *connect_widget = GetConnectWidget();
|
||||
if (connect_widget->window)
|
||||
{
|
||||
/* we provide this function ourselves as it is
|
||||
missing in GDK */
|
||||
gdk_window_warp_pointer( connect_widget->window, x, y );
|
||||
}
|
||||
/* we provide this function ourselves as it is
|
||||
missing in GDK (top of this file) */
|
||||
|
||||
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 )
|
||||
@ -2661,13 +2659,13 @@ void wxWindow::Refresh( bool eraseBackground, const wxRect *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->width, rect->height );
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
GtkWidget *connect_widget = GetConnectWidget();
|
||||
if (!connect_widget->window)
|
||||
GdkWindow *window = (GdkWindow*) NULL;
|
||||
if (m_wxwindow)
|
||||
window = GTK_MYFIXED(m_wxwindow)->bin_window;
|
||||
else
|
||||
window = GetConnectWidget()->window;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
// indicate that a new style has been set
|
||||
// but it couldn't get applied as the
|
||||
@ -2768,13 +2771,13 @@ bool wxWindow::SetBackgroundColour( const wxColour &colour )
|
||||
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
|
||||
provide compatibility. call Clear() to do the job. */
|
||||
|
||||
m_backgroundColour.CalcPixel( gdk_window_get_colormap( m_wxwindow->window ) );
|
||||
gdk_window_set_background( m_wxwindow->window, m_backgroundColour.GetColor() );
|
||||
m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
|
||||
gdk_window_set_background( window, m_backgroundColour.GetColor() );
|
||||
}
|
||||
|
||||
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
|
||||
@ -2803,8 +2806,13 @@ bool wxWindow::SetForegroundColour( const wxColour &colour )
|
||||
if (!m_delayedForegroundColour) return FALSE;
|
||||
}
|
||||
|
||||
GtkWidget *connect_widget = GetConnectWidget();
|
||||
if (!connect_widget->window)
|
||||
GdkWindow *window = (GdkWindow*) NULL;
|
||||
if (m_wxwindow)
|
||||
window = GTK_MYFIXED(m_wxwindow)->bin_window;
|
||||
else
|
||||
window = GetConnectWidget()->window;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
// indicate that a new style has been set
|
||||
// but it couldn't get applied as the
|
||||
@ -2973,7 +2981,9 @@ GtkWidget* wxWindow::GetConnectWidget()
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@ -2988,8 +2998,13 @@ bool wxWindow::SetFont( const wxFont &font )
|
||||
if (!m_delayedFont) return FALSE;
|
||||
}
|
||||
|
||||
GtkWidget *connect_widget = GetConnectWidget();
|
||||
if (!connect_widget->window)
|
||||
GdkWindow *window = (GdkWindow*) NULL;
|
||||
if (m_wxwindow)
|
||||
window = GTK_MYFIXED(m_wxwindow)->bin_window;
|
||||
else
|
||||
window = GetConnectWidget()->window;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
// indicate that a new style has been set
|
||||
// but it couldn't get applied as the
|
||||
@ -3021,10 +3036,15 @@ void wxWindow::CaptureMouse()
|
||||
|
||||
wxCHECK_RET( g_captureWindow == NULL, wxT("CaptureMouse called twice") );
|
||||
|
||||
GtkWidget *connect_widget = GetConnectWidget();
|
||||
if (!connect_widget->window) return;
|
||||
GdkWindow *window = (GdkWindow*) NULL;
|
||||
if (m_wxwindow)
|
||||
window = GTK_MYFIXED(m_wxwindow)->bin_window;
|
||||
else
|
||||
window = GetConnectWidget()->window;
|
||||
|
||||
if (!window) return;
|
||||
|
||||
gdk_pointer_grab( connect_widget->window, FALSE,
|
||||
gdk_pointer_grab( window, FALSE,
|
||||
(GdkEventMask)
|
||||
(GDK_BUTTON_PRESS_MASK |
|
||||
GDK_BUTTON_RELEASE_MASK |
|
||||
@ -3042,8 +3062,13 @@ void wxWindow::ReleaseMouse()
|
||||
|
||||
wxCHECK_RET( g_captureWindow, wxT("ReleaseMouse called twice") );
|
||||
|
||||
GtkWidget *connect_widget = GetConnectWidget();
|
||||
if (!connect_widget->window) return;
|
||||
GdkWindow *window = (GdkWindow*) NULL;
|
||||
if (m_wxwindow)
|
||||
window = GTK_MYFIXED(m_wxwindow)->bin_window;
|
||||
else
|
||||
window = GetConnectWidget()->window;
|
||||
|
||||
if (!window) return;
|
||||
|
||||
gdk_pointer_ungrab ( GDK_CURRENT_TIME );
|
||||
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") );
|
||||
|
||||
gtk_myfixed_scroll( GTK_MYFIXED(m_wxwindow), -dx, -dy );
|
||||
|
||||
/*
|
||||
if (!m_scrollGC)
|
||||
{
|
||||
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 );
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void wxWindow::SetScrolling(bool scroll)
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "wx/dcclient.h"
|
||||
#include "wx/dcmemory.h"
|
||||
#include "wx/image.h"
|
||||
#include "wx/gtk/win_gtk.h"
|
||||
#include <math.h> // for floating-point functions
|
||||
|
||||
#include "gdk/gdk.h"
|
||||
@ -118,7 +119,8 @@ wxWindowDC::wxWindowDC( wxWindow *window )
|
||||
|
||||
wxASSERT_MSG( widget, wxT("DC needs a widget") );
|
||||
|
||||
m_window = widget->window;
|
||||
GtkMyFixed *myfixed = GTK_MYFIXED( widget );
|
||||
m_window = myfixed->bin_window;
|
||||
|
||||
/* not realized ? */
|
||||
if (!m_window)
|
||||
|
1011
src/gtk1/win_gtk.c
1011
src/gtk1/win_gtk.c
File diff suppressed because it is too large
Load Diff
@ -210,6 +210,109 @@ gdk_window_warp_pointer (GdkWindow *window,
|
||||
extern void wxapp_install_idle_handler();
|
||||
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
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -564,108 +667,6 @@ static long map_to_wx_keysym( KeySym keysym )
|
||||
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
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -675,9 +676,6 @@ static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExp
|
||||
if (!win->m_hasVMT)
|
||||
return;
|
||||
|
||||
if (gdk_event->window != win->m_wxwindow->window)
|
||||
return;
|
||||
|
||||
win->GetUpdateRegion().Union( gdk_event->area.x,
|
||||
gdk_event->area.y,
|
||||
gdk_event->area.width,
|
||||
@ -715,10 +713,6 @@ static void gtk_window_draw_callback( GtkWidget *widget, GdkRectangle *rect, wxW
|
||||
if (!win->m_hasVMT)
|
||||
return;
|
||||
|
||||
GtkMyFixed *myfixed = GTK_MYFIXED (widget);
|
||||
if (!myfixed->children)
|
||||
return; /* mini optimisation */
|
||||
|
||||
win->GetUpdateRegion().Union( rect->x, rect->y,
|
||||
rect->width, rect->height );
|
||||
|
||||
@ -2042,7 +2036,7 @@ void wxWindow::PostCreation()
|
||||
GTK_SIGNAL_FUNC(gtk_window_draw_callback), (gpointer)this );
|
||||
|
||||
#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_FUNC(gtk_window_own_expose_callback), (gpointer)this );
|
||||
|
||||
@ -2212,7 +2206,7 @@ void wxWindow::OnInternalIdle()
|
||||
|
||||
if (m_wxwindow)
|
||||
{
|
||||
GdkWindow *window = m_wxwindow->window;
|
||||
GdkWindow *window = GTK_MYFIXED(m_wxwindow)->bin_window;
|
||||
if (window)
|
||||
gdk_window_set_cursor( window, cursor.GetCursor() );
|
||||
|
||||
@ -2410,7 +2404,7 @@ void wxWindow::DoClientToScreen( int *x, int *y ) const
|
||||
|
||||
GdkWindow *source = (GdkWindow *) NULL;
|
||||
if (m_wxwindow)
|
||||
source = m_wxwindow->window;
|
||||
source = GTK_MYFIXED(m_wxwindow)->bin_window;
|
||||
else
|
||||
source = m_widget->window;
|
||||
|
||||
@ -2439,7 +2433,7 @@ void wxWindow::DoScreenToClient( int *x, int *y ) const
|
||||
|
||||
GdkWindow *source = (GdkWindow *) NULL;
|
||||
if (m_wxwindow)
|
||||
source = m_wxwindow->window;
|
||||
source = GTK_MYFIXED(m_wxwindow)->bin_window;
|
||||
else
|
||||
source = m_widget->window;
|
||||
|
||||
@ -2642,13 +2636,17 @@ void wxWindow::WarpPointer( int x, int y )
|
||||
{
|
||||
wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
|
||||
|
||||
GtkWidget *connect_widget = GetConnectWidget();
|
||||
if (connect_widget->window)
|
||||
{
|
||||
/* we provide this function ourselves as it is
|
||||
missing in GDK */
|
||||
gdk_window_warp_pointer( connect_widget->window, x, y );
|
||||
}
|
||||
/* we provide this function ourselves as it is
|
||||
missing in GDK (top of this file) */
|
||||
|
||||
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 )
|
||||
@ -2661,13 +2659,13 @@ void wxWindow::Refresh( bool eraseBackground, const wxRect *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->width, rect->height );
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
GtkWidget *connect_widget = GetConnectWidget();
|
||||
if (!connect_widget->window)
|
||||
GdkWindow *window = (GdkWindow*) NULL;
|
||||
if (m_wxwindow)
|
||||
window = GTK_MYFIXED(m_wxwindow)->bin_window;
|
||||
else
|
||||
window = GetConnectWidget()->window;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
// indicate that a new style has been set
|
||||
// but it couldn't get applied as the
|
||||
@ -2768,13 +2771,13 @@ bool wxWindow::SetBackgroundColour( const wxColour &colour )
|
||||
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
|
||||
provide compatibility. call Clear() to do the job. */
|
||||
|
||||
m_backgroundColour.CalcPixel( gdk_window_get_colormap( m_wxwindow->window ) );
|
||||
gdk_window_set_background( m_wxwindow->window, m_backgroundColour.GetColor() );
|
||||
m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
|
||||
gdk_window_set_background( window, m_backgroundColour.GetColor() );
|
||||
}
|
||||
|
||||
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
|
||||
@ -2803,8 +2806,13 @@ bool wxWindow::SetForegroundColour( const wxColour &colour )
|
||||
if (!m_delayedForegroundColour) return FALSE;
|
||||
}
|
||||
|
||||
GtkWidget *connect_widget = GetConnectWidget();
|
||||
if (!connect_widget->window)
|
||||
GdkWindow *window = (GdkWindow*) NULL;
|
||||
if (m_wxwindow)
|
||||
window = GTK_MYFIXED(m_wxwindow)->bin_window;
|
||||
else
|
||||
window = GetConnectWidget()->window;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
// indicate that a new style has been set
|
||||
// but it couldn't get applied as the
|
||||
@ -2973,7 +2981,9 @@ GtkWidget* wxWindow::GetConnectWidget()
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@ -2988,8 +2998,13 @@ bool wxWindow::SetFont( const wxFont &font )
|
||||
if (!m_delayedFont) return FALSE;
|
||||
}
|
||||
|
||||
GtkWidget *connect_widget = GetConnectWidget();
|
||||
if (!connect_widget->window)
|
||||
GdkWindow *window = (GdkWindow*) NULL;
|
||||
if (m_wxwindow)
|
||||
window = GTK_MYFIXED(m_wxwindow)->bin_window;
|
||||
else
|
||||
window = GetConnectWidget()->window;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
// indicate that a new style has been set
|
||||
// but it couldn't get applied as the
|
||||
@ -3021,10 +3036,15 @@ void wxWindow::CaptureMouse()
|
||||
|
||||
wxCHECK_RET( g_captureWindow == NULL, wxT("CaptureMouse called twice") );
|
||||
|
||||
GtkWidget *connect_widget = GetConnectWidget();
|
||||
if (!connect_widget->window) return;
|
||||
GdkWindow *window = (GdkWindow*) NULL;
|
||||
if (m_wxwindow)
|
||||
window = GTK_MYFIXED(m_wxwindow)->bin_window;
|
||||
else
|
||||
window = GetConnectWidget()->window;
|
||||
|
||||
if (!window) return;
|
||||
|
||||
gdk_pointer_grab( connect_widget->window, FALSE,
|
||||
gdk_pointer_grab( window, FALSE,
|
||||
(GdkEventMask)
|
||||
(GDK_BUTTON_PRESS_MASK |
|
||||
GDK_BUTTON_RELEASE_MASK |
|
||||
@ -3042,8 +3062,13 @@ void wxWindow::ReleaseMouse()
|
||||
|
||||
wxCHECK_RET( g_captureWindow, wxT("ReleaseMouse called twice") );
|
||||
|
||||
GtkWidget *connect_widget = GetConnectWidget();
|
||||
if (!connect_widget->window) return;
|
||||
GdkWindow *window = (GdkWindow*) NULL;
|
||||
if (m_wxwindow)
|
||||
window = GTK_MYFIXED(m_wxwindow)->bin_window;
|
||||
else
|
||||
window = GetConnectWidget()->window;
|
||||
|
||||
if (!window) return;
|
||||
|
||||
gdk_pointer_ungrab ( GDK_CURRENT_TIME );
|
||||
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") );
|
||||
|
||||
gtk_myfixed_scroll( GTK_MYFIXED(m_wxwindow), -dx, -dy );
|
||||
|
||||
/*
|
||||
if (!m_scrollGC)
|
||||
{
|
||||
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 );
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void wxWindow::SetScrolling(bool scroll)
|
||||
|
@ -463,10 +463,12 @@ void wxHtmlWidgetCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
|
||||
c = c -> GetParent();
|
||||
}
|
||||
|
||||
/*
|
||||
((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 -> Refresh();
|
||||
*/
|
||||
|
||||
m_Wnd -> SetSize(absx, absy, m_Width, m_Height);
|
||||
|
||||
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();
|
||||
c = c -> GetParent();
|
||||
}
|
||||
|
||||
/*
|
||||
((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, absy, m_Width, m_Height);
|
||||
|
||||
wxHtmlCell::DrawInvisible(dc, x, y);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user