// wxWindows callbacks
void OnKeyDown( wxKeyEvent &event );
- // simple accessors
- bool HasVMT() const { return m_hasVMT; }
-
- int GetX() const { return m_x; }
- int GetY() const { return m_y; }
- int GetWidth() const { return m_width; }
- int GetHeight() const { return m_height; }
-
- GtkWidget *GetWxWindow() const { return m_wxwindow; }
- GtkWidget *GetWidget() const { return GetHandle(); }
-
- GtkAdjustment *GetHAdjust() const { return m_hAdjust; }
- GtkAdjustment *GetVAdjust() const { return m_vAdjust; }
-
- float GetOldHorizontalPos() const { return m_oldHorizontalPos; }
- float GetOldVerticalPos() const { return m_oldVerticalPos; }
-
- void SetOldHorizontalPos(float fpos) { m_oldHorizontalPos = fpos; }
- void SetOldVerticalPos(float fpos) { m_oldVerticalPos = fpos; }
-
- bool IsSizeSet() const { return m_sizeSet; }
-
// also sets the global flag
void SetScrolling(bool scroll);
bool HasScrolling() const { return m_hasScrolling; }
bool IsScrolling() const { return m_isScrolling; }
- bool IsStaticBox() const { return m_isStaticBox; }
/* I don't want users to override what's done in idle so everything that
has to be done in idle time in order for wxGTK to work is done in
void InternalSetSize(int w, int h)
{ m_width = w; m_height = h; UpdateSize(); }
-protected:
// position and size of the window
int m_x, m_y;
int m_width, m_height;
// see the docs in src/gtk/window.cpp
+ GtkWidget *m_widget;
GtkWidget *m_wxwindow;
// scrolling stuff
// wxWindows callbacks
void OnKeyDown( wxKeyEvent &event );
- // simple accessors
- bool HasVMT() const { return m_hasVMT; }
-
- int GetX() const { return m_x; }
- int GetY() const { return m_y; }
- int GetWidth() const { return m_width; }
- int GetHeight() const { return m_height; }
-
- GtkWidget *GetWxWindow() const { return m_wxwindow; }
- GtkWidget *GetWidget() const { return GetHandle(); }
-
- GtkAdjustment *GetHAdjust() const { return m_hAdjust; }
- GtkAdjustment *GetVAdjust() const { return m_vAdjust; }
-
- float GetOldHorizontalPos() const { return m_oldHorizontalPos; }
- float GetOldVerticalPos() const { return m_oldVerticalPos; }
-
- void SetOldHorizontalPos(float fpos) { m_oldHorizontalPos = fpos; }
- void SetOldVerticalPos(float fpos) { m_oldVerticalPos = fpos; }
-
- bool IsSizeSet() const { return m_sizeSet; }
-
// also sets the global flag
void SetScrolling(bool scroll);
bool HasScrolling() const { return m_hasScrolling; }
bool IsScrolling() const { return m_isScrolling; }
- bool IsStaticBox() const { return m_isStaticBox; }
/* I don't want users to override what's done in idle so everything that
has to be done in idle time in order for wxGTK to work is done in
void InternalSetSize(int w, int h)
{ m_width = w; m_height = h; UpdateSize(); }
-protected:
// position and size of the window
int m_x, m_y;
int m_width, m_height;
// see the docs in src/gtk/window.cpp
+ GtkWidget *m_widget;
GtkWidget *m_wxwindow;
// scrolling stuff
void OnSysColourChanged( wxSysColourChangedEvent& event );
void OnInitDialog( wxInitDialogEvent &event );
+/*
+ What is this doing in the platform independent part?
+
// accessors
WXWidget GetHandle() const { return m_widget; }
-protected:
// the window handle (for the underlying windowing system) and the window
// id - a number which uniquely identifies a window among its siblings
// unless it is -1
WXWidget m_widget;
WXWidget m_hWnd;
};
+*/
wxWindowID m_windowId;
void wxWindowBase::InitBase()
{
// no window yet, no parent nor children
- m_widget = (WXWidget)0;
+// m_widget = (WXWidget)0;
m_parent = (wxWindow *)NULL;
m_windowId = -1;
m_children.DeleteContents( FALSE ); // don't auto delete node data
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!button->HasVMT()) return;
+ if (!button->m_hasVMT) return;
if (g_blockEventsOnDrag) return;
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
static void gtk_bmpbutton_enter_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button )
{
- if (!button->HasVMT()) return;
+ if (!button->m_hasVMT) return;
if (g_blockEventsOnDrag) return;
button->HasFocus();
static void gtk_bmpbutton_leave_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button )
{
- if (!button->HasVMT()) return;
+ if (!button->m_hasVMT) return;
if (g_blockEventsOnDrag) return;
button->NotFocus();
static void gtk_bmpbutton_press_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button )
{
- if (!button->HasVMT()) return;
+ if (!button->m_hasVMT) return;
if (g_blockEventsOnDrag) return;
button->StartSelect();
static void gtk_bmpbutton_release_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button )
{
- if (!button->HasVMT()) return;
+ if (!button->m_hasVMT) return;
if (g_blockEventsOnDrag) return;
button->EndSelect();
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!button->HasVMT()) return;
+ if (!button->m_hasVMT) return;
if (g_blockEventsOnDrag) return;
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!cb->HasVMT()) return;
+ if (!cb->m_hasVMT) return;
if (cb->m_blockFirstEvent)
{
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!choice->HasVMT()) return;
+ if (!choice->m_hasVMT) return;
if (g_blockEventsOnDrag) return;
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!combo->HasVMT()) return;
+ if (!combo->m_hasVMT) return;
if (g_blockEventsOnDrag) return;
{
if (g_isIdle) wxapp_install_idle_handler();
+ if (!combo->m_hasVMT) return;
+
wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, combo->GetId() );
event.SetString( combo->GetValue() );
event.SetEventObject( combo );
if (!window) return;
- GtkWidget *widget = window->GetWxWindow();
+ GtkWidget *widget = window->m_wxwindow;
if (!widget)
return;
/* still not realized ? */
if (!m_window) return;
- if (window->GetWxWindow())
- m_cmap = gtk_widget_get_colormap( window->GetWxWindow() );
+ if (window->m_wxwindow)
+ m_cmap = gtk_widget_get_colormap( window->m_wxwindow );
else
- m_cmap = gtk_widget_get_colormap( window->GetHandle() );
+ m_cmap = gtk_widget_get_colormap( window->m_widget );
m_isMemDC = FALSE;
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!win->HasVMT()) return;
+ if (!win->m_hasVMT) return;
/*
printf( "OnDialogResize from " );
printf( ".\n" );
*/
- if ((win->GetWidth() != alloc->width) || (win->GetHeight() != alloc->height))
+ if ((win->m_width != alloc->width) || (win->m_height != alloc->height))
{
win->InternalSetSize( alloc->width, alloc->height );
}
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!win->HasVMT()) return FALSE;
+ if (!win->m_hasVMT) return FALSE;
win->InternalSetPosition(event->x, event->y);
- wxMoveEvent mevent( wxPoint(win->GetX(),win->GetY()), win->GetId() );
+ wxMoveEvent mevent( wxPoint(win->m_x,win->m_y), win->GetId() );
mevent.SetEventObject( win );
win->GetEventHandler()->ProcessEvent( mevent );
{
/* I haven''t been able to set the position of
the dialog before it is shown, so I do it here */
- gtk_widget_set_uposition( widget, win->GetX(), win->GetY() );
+ gtk_widget_set_uposition( widget, win->m_x, win->m_y );
/* all this is for Motif Window Manager "hints" and is supposed to be
recognized by other WM as well. not tested. */
func |= GDK_FUNC_RESIZE;
decor |= GDK_DECOR_RESIZEH;
}
- gdk_window_set_decorations( win->GetHandle()->window, (GdkWMDecoration)decor);
- gdk_window_set_functions( win->GetHandle()->window, (GdkWMFunction)func);
+ gdk_window_set_decorations( win->m_widget->window, (GdkWMDecoration)decor);
+ gdk_window_set_functions( win->m_widget->window, (GdkWMFunction)func);
/* GTK's shrinking/growing policy */
if ((win->GetWindowStyle() & wxRESIZE_BORDER) == 0)
- gtk_window_set_policy(GTK_WINDOW(win->GetHandle()), 0, 0, 1);
+ gtk_window_set_policy(GTK_WINDOW(win->m_widget), 0, 0, 1);
else
- gtk_window_set_policy(GTK_WINDOW(win->GetHandle()), 1, 1, 1);
+ gtk_window_set_policy(GTK_WINDOW(win->m_widget), 1, 1, 1);
return FALSE;
}
m_waiting = TRUE;
m_window = win;
- m_widget = win->GetWidget();
- if (win->GetWxWindow()) m_widget = win->GetWxWindow();
+ m_widget = win->m_widget;
+ if (win->m_wxwindow) m_widget = win->m_wxwindow;
m_data = (wxDataBroker*) NULL;
m_retValue = wxDragCancel;
m_waiting = TRUE;
m_window = win;
- m_widget = win->GetWidget();
- if (win->GetWxWindow()) m_widget = win->GetWxWindow();
+ m_widget = win->m_widget;
+ if (win->m_wxwindow) m_widget = win->m_wxwindow;
m_retValue = wxDragCancel;
if (data)
wxDropSource::wxDropSource( wxDataBroker *data, wxWindow *win )
{
m_window = win;
- m_widget = win->GetWidget();
- if (win->GetWxWindow()) m_widget = win->GetWxWindow();
+ m_widget = win->m_widget;
+ if (win->m_wxwindow) m_widget = win->m_wxwindow;
m_retValue = wxDragCancel;
m_data = data;
int style = dialog->GetStyle();
- GtkFileSelection *filedlg = GTK_FILE_SELECTION(dialog->GetHandle());
+ GtkFileSelection *filedlg = GTK_FILE_SELECTION(dialog->m_widget);
char *filename = gtk_file_selection_get_filename(filedlg);
if ( (style & wxSAVE) && ( style & wxOVERWRITE_PROMPT ) )
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!win->HasVMT()) return;
+ if (!win->m_hasVMT) return;
/*
printf( "OnFrameResize from " );
printf( ".\n" );
*/
- if ((win->GetWidth() != alloc->width) || (win->GetHeight() != alloc->height))
+ if ((win->m_width != alloc->width) || (win->m_height != alloc->height))
{
win->InternalSetSize( alloc->width, alloc->height );
}
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!win->HasVMT()) return;
+ if (!win->m_hasVMT) return;
win->m_menuBarDetached = FALSE;
win->UpdateSize();
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!win->HasVMT()) return;
+ if (!win->m_hasVMT) return;
win->m_menuBarDetached = TRUE;
win->UpdateSize();
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!win->HasVMT()) return;
+ if (!win->m_hasVMT) return;
win->m_toolBarDetached = FALSE;
win->UpdateSize();
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!win->HasVMT()) return;
+ if (!win->m_hasVMT) return;
win->m_toolBarDetached = TRUE;
win->UpdateSize();
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!win->HasVMT()) return FALSE;
+ if (!win->m_hasVMT) return FALSE;
win->InternalSetPosition(event->x, event->y);
- wxMoveEvent mevent( wxPoint(win->GetX(),win->GetY()), win->GetId() );
+ wxMoveEvent mevent( wxPoint(win->m_x,win->m_y), win->GetId() );
mevent.SetEventObject( win );
win->GetEventHandler()->ProcessEvent( mevent );
}
- gdk_window_set_decorations( win->GetHandle()->window, (GdkWMDecoration)decor);
- gdk_window_set_functions( win->GetHandle()->window, (GdkWMFunction)func);
+ gdk_window_set_decorations( win->m_widget->window, (GdkWMDecoration)decor);
+ gdk_window_set_functions( win->m_widget->window, (GdkWMFunction)func);
/* GTK's shrinking/growing policy */
if ((win->GetWindowStyle() & wxRESIZE_BORDER) == 0)
- gtk_window_set_policy(GTK_WINDOW(win->GetHandle()), 0, 0, 1);
+ gtk_window_set_policy(GTK_WINDOW(win->m_widget), 0, 0, 1);
else
- gtk_window_set_policy(GTK_WINDOW(win->GetHandle()), 1, 1, 1);
+ gtk_window_set_policy(GTK_WINDOW(win->m_widget), 1, 1, 1);
/* reset the icon */
if (win->m_icon != wxNullIcon)
/* these are outside the client area */
wxFrame* frame = (wxFrame*) parent;
gtk_myfixed_put( GTK_MYFIXED(frame->m_mainWidget),
- GTK_WIDGET(child->GetHandle()),
- child->GetX(),
- child->GetY(),
- child->GetWidth(),
- child->GetHeight() );
+ GTK_WIDGET(child->m_widget),
+ child->m_x,
+ child->m_y,
+ child->m_width,
+ child->m_height );
/* we connect to these events for recalculating the client area
space when the toolbar is floating */
wxToolBar *toolBar = (wxToolBar*) child;
if (toolBar->GetWindowStyle() & wxTB_DOCKABLE)
{
- gtk_signal_connect( GTK_OBJECT(toolBar->GetHandle()), "child_attached",
+ gtk_signal_connect( GTK_OBJECT(toolBar->m_widget), "child_attached",
GTK_SIGNAL_FUNC(gtk_toolbar_attached_callback), (gpointer)parent );
- gtk_signal_connect( GTK_OBJECT(toolBar->GetHandle()), "child_detached",
+ gtk_signal_connect( GTK_OBJECT(toolBar->m_widget), "child_detached",
GTK_SIGNAL_FUNC(gtk_toolbar_detached_callback), (gpointer)parent );
}
}
else
{
/* these are inside the client area */
- gtk_myfixed_put( GTK_MYFIXED(parent->GetWxWindow()),
- GTK_WIDGET(child->GetHandle()),
- child->GetX(),
- child->GetY(),
- child->GetWidth(),
- child->GetHeight() );
+ gtk_myfixed_put( GTK_MYFIXED(parent->m_wxwindow),
+ GTK_WIDGET(child->m_widget),
+ child->m_x,
+ child->m_y,
+ child->m_width,
+ child->m_height );
}
/* resize on OnInternalIdle */
m_frameMenuBar->InternalSetPosition(xx, yy);
m_frameMenuBar->InternalSetSize(ww, hh);
gtk_myfixed_set_size( GTK_MYFIXED(m_mainWidget),
- m_frameMenuBar->GetHandle(),
+ m_frameMenuBar->m_widget,
xx, yy, ww, hh );
client_area_y_offset += hh;
}
yy += wxPLACE_HOLDER;
}
int ww = m_width - 2*m_miniEdge;
- int hh = m_frameToolBar->GetHeight();
+ int hh = m_frameToolBar->m_height;
// VZ: according to earlier comments in this file, the tbar height
// shouldn't be changed, so I comment out the next line
// (09.05.99)
m_frameToolBar->InternalSetSize(ww, hh);
gtk_myfixed_set_size( GTK_MYFIXED(m_mainWidget),
- m_frameToolBar->GetHandle(),
+ m_frameToolBar->m_widget,
xx, yy, ww, hh );
client_area_y_offset += hh;
}
m_frameStatusBar->InternalSetPosition(xx, yy);
m_frameStatusBar->InternalSetSize(ww, hh);
gtk_myfixed_set_size( GTK_MYFIXED(m_wxwindow),
- m_frameStatusBar->GetHandle(),
+ m_frameStatusBar->m_widget,
xx, yy, ww, hh );
}
/* send size event to status bar */
if (m_frameStatusBar)
{
- wxSizeEvent event2( wxSize(m_frameStatusBar->GetWidth(),m_frameStatusBar->GetHeight()), m_frameStatusBar->GetId() );
+ wxSizeEvent event2( wxSize(m_frameStatusBar->m_width,m_frameStatusBar->m_height), m_frameStatusBar->GetId() );
event2.SetEventObject( m_frameStatusBar );
m_frameStatusBar->GetEventHandler()->ProcessEvent( event2 );
}
#if (GTK_MINOR_VERSION > 0)
/* support for native hot keys */
- gtk_accel_group_attach( menu->m_accel, GTK_OBJECT(win->GetHandle()));
+ gtk_accel_group_attach( menu->m_accel, GTK_OBJECT(win->m_widget));
#endif
wxNode *node = menu->GetItems().First();
{
m_frameMenuBar->SetParent(this);
gtk_myfixed_put( GTK_MYFIXED(m_mainWidget),
- m_frameMenuBar->GetHandle(),
- m_frameMenuBar->GetX(),
- m_frameMenuBar->GetY(),
- m_frameMenuBar->GetWidth(),
- m_frameMenuBar->GetHeight() );
+ m_frameMenuBar->m_widget,
+ m_frameMenuBar->m_x,
+ m_frameMenuBar->m_y,
+ m_frameMenuBar->m_width,
+ m_frameMenuBar->m_height );
if (menuBar->GetWindowStyle() & wxMB_DOCKABLE)
{
- gtk_signal_connect( GTK_OBJECT(menuBar->GetHandle()), "child_attached",
+ gtk_signal_connect( GTK_OBJECT(menuBar->m_widget), "child_attached",
GTK_SIGNAL_FUNC(gtk_menu_attached_callback), (gpointer)this );
- gtk_signal_connect( GTK_OBJECT(menuBar->GetHandle()), "child_detached",
+ gtk_signal_connect( GTK_OBJECT(menuBar->m_widget), "child_detached",
GTK_SIGNAL_FUNC(gtk_menu_detached_callback), (gpointer)this );
}
}
if (g_blockEventsOnDrag) return FALSE;
if (g_blockEventsOnScroll) return FALSE;
- if (!listbox->HasVMT()) return FALSE;
+ if (!listbox->m_hasVMT) return FALSE;
int sel = listbox->GetIndex( widget );
if (g_blockEventsOnDrag) return FALSE;
- if (!listbox->HasVMT()) return FALSE;
+ if (!listbox->m_hasVMT) return FALSE;
if (gdk_event->keyval != ' ') return FALSE;
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!listbox->HasVMT()) return;
+ if (!listbox->m_hasVMT) return;
if (g_blockEventsOnDrag) return;
wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, listbox->GetId() );
wxMenuBar *menu_bar = child_frame->m_menuBar;
if (!menu_bar) return;
- if (!menu_bar->GetHandle()) return;
+ if (!menu_bar->m_widget) return;
menu_bar->InternalSetPosition(0, 0);
menu_bar->InternalSetSize(m_width, wxMENU_HEIGHT);
gtk_myfixed_set_size( GTK_MYFIXED(m_mainWidget),
- menu_bar->GetHandle(),
+ menu_bar->m_widget,
0, 0, m_width, wxMENU_HEIGHT );
}
if (m_justInserted)
{
- GtkNotebook *notebook = GTK_NOTEBOOK(m_clientWindow->GetHandle());
+ GtkNotebook *notebook = GTK_NOTEBOOK(m_clientWindow->m_widget);
gtk_notebook_set_page( notebook, g_list_length( notebook->children ) - 1 );
m_justInserted = FALSE;
{
if (child_frame == active_child_frame)
{
- gtk_widget_show( child_frame->m_menuBar->GetHandle() );
+ gtk_widget_show( child_frame->m_menuBar->m_widget );
visible_child_menu = TRUE;
}
else
- gtk_widget_hide( child_frame->m_menuBar->GetHandle() );
+ gtk_widget_hide( child_frame->m_menuBar->m_widget );
}
node = node->Next();
}
{
if (!m_clientWindow) return (wxMDIChildFrame*) NULL;
- GtkNotebook *notebook = GTK_NOTEBOOK(m_clientWindow->GetHandle());
+ GtkNotebook *notebook = GTK_NOTEBOOK(m_clientWindow->m_widget);
if (!notebook) return (wxMDIChildFrame*) NULL;
#if (GTK_MINOR_VERSION > 0)
void wxMDIParentFrame::ActivateNext()
{
if (m_clientWindow)
- gtk_notebook_next_page( GTK_NOTEBOOK(m_clientWindow->GetHandle()) );
+ gtk_notebook_next_page( GTK_NOTEBOOK(m_clientWindow->m_widget) );
}
void wxMDIParentFrame::ActivatePrevious()
{
if (m_clientWindow)
- gtk_notebook_prev_page( GTK_NOTEBOOK(m_clientWindow->GetHandle()) );
+ gtk_notebook_prev_page( GTK_NOTEBOOK(m_clientWindow->m_widget) );
}
void wxMDIParentFrame::OnActivate( wxActivateEvent& WXUNUSED(event) )
}
/* the menu bar of the child window is shown in idle time as needed */
- gtk_widget_hide( m_menuBar->GetHandle() );
+ gtk_widget_hide( m_menuBar->m_widget );
/* insert the invisible menu bar into the _parent_ mdi frame */
gtk_myfixed_put( GTK_MYFIXED(mdi_frame->m_mainWidget),
- m_menuBar->GetHandle(),
- 0, 0, mdi_frame->GetWidth(), wxMENU_HEIGHT );
+ m_menuBar->m_widget,
+ 0, 0, mdi_frame->m_width, wxMENU_HEIGHT );
}
}
{
if (g_isIdle) wxapp_install_idle_handler();
- if ((win->GetX() == alloc->x) &&
- (win->GetY() == alloc->y) &&
- (win->GetWidth() == alloc->width) &&
- (win->GetHeight() == alloc->height) &&
- (win->IsSizeSet()))
+ if ((win->m_x == alloc->x) &&
+ (win->m_y == alloc->y) &&
+ (win->m_width == alloc->width) &&
+ (win->m_height == alloc->height) &&
+ (win->m_sizeSet))
{
return;
}
GtkWidget *label_widget = gtk_label_new( s.mbc_str() );
gtk_misc_set_alignment( GTK_MISC(label_widget), 0.0, 0.5 );
- gtk_signal_connect( GTK_OBJECT(child->GetHandle()), "size_allocate",
+ gtk_signal_connect( GTK_OBJECT(child->m_widget), "size_allocate",
GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)child );
- GtkNotebook *notebook = GTK_NOTEBOOK(parent->GetHandle());
+ GtkNotebook *notebook = GTK_NOTEBOOK(parent->m_widget);
- gtk_notebook_append_page( notebook, child->GetHandle(), label_widget );
+ gtk_notebook_append_page( notebook, child->m_widget, label_widget );
child->m_page = (GtkNotebookPage*) (g_list_last(notebook->children)->data);
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!win->HasVMT()) return;
+ if (!win->m_hasVMT) return;
if (gdk_event->count > 0) return;
gtk_draw_shadow( widget->style,
GTK_STATE_NORMAL,
GTK_SHADOW_OUT,
0, 0,
- win->GetWidth(), win->GetHeight() );
+ win->m_width, win->m_height );
if (!win->m_title.IsEmpty() &&
((win->GetWindowStyle() & wxCAPTION) ||
gdk_draw_rectangle( widget->window, gc, TRUE,
x,
3,
- win->GetWidth() - 4 - x,
+ win->m_width - 4 - x,
font->ascent + font->descent+1 );
gdk_gc_set_foreground( gc, &widget->style->white );
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!win->HasVMT()) return;
+ if (!win->m_hasVMT) return;
gtk_draw_shadow( widget->style,
widget->window,
GTK_STATE_NORMAL,
GTK_SHADOW_OUT,
0, 0,
- win->GetWidth(), win->GetHeight() );
+ win->m_width, win->m_height );
if (!win->m_title.IsEmpty() &&
((win->GetWindowStyle() & wxCAPTION) ||
gdk_draw_rectangle( widget->window, gc, TRUE,
x,
3,
- win->GetWidth() - 4 - x,
+ win->m_width - 4 - x,
font->ascent + font->descent+1 );
gdk_gc_set_foreground( gc, &widget->style->white );
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!win->HasVMT()) return FALSE;
+ if (!win->m_hasVMT) return FALSE;
if (g_blockEventsOnDrag) return TRUE;
if (g_blockEventsOnScroll) return TRUE;
win->m_diffX = (int)gdk_event->x;
win->m_diffY = (int)gdk_event->y;
- DrawFrame( widget, 0, 0, win->GetWidth(), win->GetHeight() );
+ DrawFrame( widget, 0, 0, win->m_width, win->m_height );
win->m_oldX = 0;
win->m_oldY = 0;
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!win->HasVMT()) return FALSE;
+ if (!win->m_hasVMT) return FALSE;
if (g_blockEventsOnDrag) return TRUE;
if (g_blockEventsOnScroll) return TRUE;
int x = (int)gdk_event->x;
int y = (int)gdk_event->y;
- DrawFrame( widget, win->m_oldX, win->m_oldY, win->GetWidth(), win->GetHeight() );
+ DrawFrame( widget, win->m_oldX, win->m_oldY, win->m_width, win->m_height );
gdk_pointer_ungrab ( GDK_CURRENT_TIME );
int org_x = 0;
int org_y = 0;
x += org_x - win->m_diffX;
y += org_y - win->m_diffY;
win->InternalSetPosition(x, y);
- gtk_widget_set_uposition( win->GetWidget(), x, y );
+ gtk_widget_set_uposition( win->m_widget, x, y );
return TRUE;
}
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!win->HasVMT()) return FALSE;
+ if (!win->m_hasVMT) return FALSE;
if (g_blockEventsOnDrag) return TRUE;
if (g_blockEventsOnScroll) return TRUE;
gdk_event->state = state;
}
- DrawFrame( widget, win->m_oldX, win->m_oldY, win->GetWidth(), win->GetHeight() );
+ DrawFrame( widget, win->m_oldX, win->m_oldY, win->m_width, win->m_height );
win->m_oldX = (int)gdk_event->x - win->m_diffX;
win->m_oldY = (int)gdk_event->y - win->m_diffY;
- DrawFrame( widget, win->m_oldX, win->m_oldY, win->GetWidth(), win->GetHeight() );
+ DrawFrame( widget, win->m_oldX, win->m_oldY, win->m_width, win->m_height );
return TRUE;
}
{
if (g_isIdle) wxapp_install_idle_handler();
- if ((win->GetX() == alloc->x) &&
- (win->GetY() == alloc->y) &&
- (win->GetWidth() == alloc->width) &&
- (win->GetHeight() == alloc->height))
+ if ((win->m_x == alloc->x) &&
+ (win->m_y == alloc->y) &&
+ (win->m_width == alloc->width) &&
+ (win->m_height == alloc->height))
{
return;
}
if (g_blockEventsOnDrag) return FALSE;
- if (!notebook->HasVMT()) return FALSE;
+ if (!notebook->m_hasVMT) return FALSE;
/* this code makes jumping down from the handles of the notebooks
to the actual items in the visible notebook page possible with
page->m_box = gtk_hbox_new (FALSE, 0);
gtk_container_border_width(GTK_CONTAINER(page->m_box), 2);
- GtkNotebook *notebook = GTK_NOTEBOOK(parent->GetWidget());
+ GtkNotebook *notebook = GTK_NOTEBOOK(parent->m_widget);
page->m_client = child;
- gtk_notebook_append_page( notebook, child->GetWidget(), page->m_box );
+ gtk_notebook_append_page( notebook, child->m_widget, page->m_box );
page->m_page = (GtkNotebookPage*) (g_list_last(notebook->children)->data);
page->m_parent = notebook;
- gtk_signal_connect( GTK_OBJECT(child->GetWidget()), "size_allocate",
+ gtk_signal_connect( GTK_OBJECT(child->m_widget), "size_allocate",
GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)child );
wxASSERT_MSG( page->m_page, _T("Notebook page creation error") );
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!rb->HasVMT()) return;
+ if (!rb->m_hasVMT) return;
if (g_blockEventsOnDrag) return;
if (rb->m_alreadySent)
gtk_signal_connect( GTK_OBJECT(m_radio), "clicked",
GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
- gtk_myfixed_put( GTK_MYFIXED(m_parent->GetWxWindow()),
+ gtk_myfixed_put( GTK_MYFIXED(m_parent->m_wxwindow),
GTK_WIDGET(m_radio),
m_x+10, m_y+10+(i*24), 10, 10 );
}
int len = 22+gdk_string_measure( font, label->label );
if (len > max_len) max_len = len;
- gtk_myfixed_move( GTK_MYFIXED(m_parent->GetWxWindow()), button, m_x+x, m_y+y );
+ gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), button, m_x+x, m_y+y );
y += 20;
node = node->Next();
{
GtkWidget *button = GTK_WIDGET( node->Data() );
- gtk_myfixed_resize( GTK_MYFIXED(m_parent->GetWxWindow()), button, max_len, 20 );
+ gtk_myfixed_resize( GTK_MYFIXED(m_parent->m_wxwindow), button, max_len, 20 );
node = node->Next();
if (!node) break;
{
GtkWidget *button = GTK_WIDGET( node->Data() );
- gtk_myfixed_set_size( GTK_MYFIXED(m_parent->GetWxWindow()), button, m_x+x, m_y+y, max, 20 );
+ gtk_myfixed_set_size( GTK_MYFIXED(m_parent->m_wxwindow), button, m_x+x, m_y+y, max, 20 );
x += max;
node = node->Next();
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!rb->HasVMT()) return;
+ if (!rb->m_hasVMT) return;
if (rb->m_blockFirstEvent)
{
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!win->HasVMT()) return;
+ if (!win->m_hasVMT) return;
if (g_blockEventsOnDrag) return;
float diff = win->m_adjust->value - win->m_oldPos;
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!win->HasVMT()) return;
+ if (!win->m_hasVMT) return;
if (g_blockEventsOnDrag) return;
float diff = win->m_adjust->value - win->m_oldPos;
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!win->HasVMT()) return;
+ if (!win->m_hasVMT) return;
if (g_blockEventsOnDrag) return;
float diff = win->m_adjust->value - win->m_oldPos;
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!win->HasVMT()) return;
+ if (!win->m_hasVMT) return;
win->SetModified();
win->CalculateScrollbar();
- if (!win->HasVMT()) return;
+ if (!win->m_hasVMT) return;
}
//-----------------------------------------------------------------------------
#endif // Debug
//-----------------------------------------------------------------------------
-// local code (see below)
+// idle system
//-----------------------------------------------------------------------------
-static void InitAdjustment(GtkAdjustment *adjust)
-{
- adjust->lower = 0.0;
- adjust->upper = 1.0;
- adjust->value = 0.0;
- adjust->step_increment = 1.0;
- adjust->page_increment = 1.0;
- adjust->page_size = 5.0;
- gtk_signal_emit_by_name( GTK_OBJECT(adjust), "changed" );
-}
+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->HasVMT())
+ if (!win->m_hasVMT)
return;
int dw = 0;
GTK_STATE_NORMAL,
GTK_SHADOW_OUT,
dx, dy,
- win->GetWidth()-dw, win->GetHeight()-dh );
+ win->m_width-dw, win->m_height-dh );
return;
}
GTK_STATE_NORMAL,
GTK_SHADOW_IN,
dx, dy,
- win->GetWidth()-dw, win->GetHeight()-dh );
+ win->m_width-dw, win->m_height-dh );
return;
}
}
static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExpose *gdk_event, wxWindow *win )
{
- if ( !win->HasVMT() )
+ if ( !win->m_hasVMT )
return;
win->GetUpdateRegion().Union( gdk_event->area.x,
static void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle *rect, wxWindow *win )
{
- if ( !win->HasVMT() )
+ if (g_isIdle)
+ wxapp_install_idle_handler();
+
+ if (!win->m_hasVMT)
return;
win->GetUpdateRegion().Union( rect->x, rect->y,
static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxWindow *win )
{
- if (!win->HasVMT()) return FALSE;
+ if (g_isIdle)
+ wxapp_install_idle_handler();
+
+ if (!win->m_hasVMT) return FALSE;
if (g_blockEventsOnDrag) return FALSE;
/*
Damn, I forgot why this didn't work, but it didn't work.
// win is a panel: up can be propagated to the panel
- if ((!ret) && (win->GetWxWindow()) && (win->m_parent) && (win->m_parent->AcceptsFocus()) &&
+ if ((!ret) && (win->m_wxwindow) && (win->m_parent) && (win->m_parent->AcceptsFocus()) &&
(gdk_event->keyval == GDK_Up))
{
win->m_parent->SetFocus();
}
// win is a panel: left/right can be propagated to the panel
- if ((!ret) && (win->GetWxWindow()) &&
+ if ((!ret) && (win->m_wxwindow) &&
((gdk_event->keyval == GDK_Right) || (gdk_event->keyval == GDK_Left) ||
(gdk_event->keyval == GDK_Up) || (gdk_event->keyval == GDK_Down)))
{
static gint gtk_window_key_release_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxWindow *win )
{
- if (!win->HasVMT()) return FALSE;
+ if (g_isIdle)
+ wxapp_install_idle_handler();
+
+ if (!win->m_hasVMT) return FALSE;
if (g_blockEventsOnDrag) return FALSE;
/*
static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
{
- if (!win->HasVMT()) return FALSE;
+ if (g_isIdle)
+ wxapp_install_idle_handler();
+
+/*
+ wxPrintf( _T("1) OnButtonPress from ") );
+ if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
+ wxPrintf( win->GetClassInfo()->GetClassName() );
+ wxPrintf( _T(".\n") );
+*/
+
+ if (!win->m_hasVMT) return FALSE;
if (g_blockEventsOnDrag) return TRUE;
if (g_blockEventsOnScroll) return TRUE;
if (!win->IsOwnGtkWindow( gdk_event->window )) return FALSE;
- if (win->GetWxWindow())
+ if (win->m_wxwindow)
{
- if (GTK_WIDGET_CAN_FOCUS(win->GetWxWindow()) && !GTK_WIDGET_HAS_FOCUS (win->GetWxWindow()) )
+ if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow) && !GTK_WIDGET_HAS_FOCUS (win->m_wxwindow) )
{
- gtk_widget_grab_focus (win->GetWxWindow());
+ gtk_widget_grab_focus (win->m_wxwindow);
/*
- printf( "GrabFocus from " );
+ wxPrintf( _T("GrabFocus from ") );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
- printf( win->GetClassInfo()->GetClassName() );
- printf( ".\n" );
+ wxPrintf( win->GetClassInfo()->GetClassName() );
+ wxPrintf( _T(".\n") );
*/
}
}
/*
- printf( "OnButtonPress from " );
+ wxPrintf( _T("2) OnButtonPress from ") );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
- printf( win->GetClassInfo()->GetClassName() );
- printf( ".\n" );
+ wxPrintf( win->GetClassInfo()->GetClassName() );
+ wxPrintf( _T(".\n") );
*/
wxEventType event_type = wxEVT_LEFT_DOWN;
{
wxWindow *child = (wxWindow*)node->Data();
- if ( child->IsStaticBox() )
+ if (child->m_isStaticBox)
{
// wxStaticBox is transparent in the box itself
- int x = event.m_x,
- y = event.m_y;
-
- wxRect rectChild(child->GetRect());
- int xx1 = rectChild.GetLeft(),
- yy1 = rectChild.GetTop(),
- xx2 = rectChild.GetRight(),
- yy2 = rectChild.GetBottom();
+ int x = event.m_x;
+ int y = event.m_y;
+ int xx1 = child->m_x;
+ int yy1 = child->m_y;
+ int xx2 = child->m_x + child->m_width;
+ int yy2 = child->m_x + child->m_height;
// left
if (((x >= xx1) && (x <= xx1+10) && (y >= yy1) && (y <= yy2)) ||
((x >= xx1) && (x <= xx2) && (y >= yy2-1) && (y <= yy2)))
{
win = child;
- event.m_x -= child->GetX();
- event.m_y -= child->GetY();
+ event.m_x -= child->m_x;
+ event.m_y -= child->m_y;
break;
}
}
else
{
- if ((child->GetWxWindow() == (GtkWidget*) NULL) &&
- (child->GetX() <= event.m_x) &&
- (child->GetY() <= event.m_y) &&
- (child->GetX()+child->GetWidth() >= event.m_x) &&
- (child->GetY()+child->GetHeight() >= event.m_y))
+ if ((child->m_wxwindow == (GtkWidget*) NULL) &&
+ (child->m_x <= event.m_x) &&
+ (child->m_y <= event.m_y) &&
+ (child->m_x+child->m_width >= event.m_x) &&
+ (child->m_y+child->m_height >= event.m_y))
{
win = child;
- event.m_x -= child->GetX();
- event.m_y -= child->GetY();
+ event.m_x -= child->m_x;
+ event.m_y -= child->m_y;
break;
}
}
static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
{
- if (!win->HasVMT()) return FALSE;
+ if (g_isIdle)
+ wxapp_install_idle_handler();
+
+ if (!win->m_hasVMT) return FALSE;
if (g_blockEventsOnDrag) return FALSE;
if (g_blockEventsOnScroll) return FALSE;
{
wxWindow *child = (wxWindow*)node->Data();
- if (child->IsStaticBox() )
+ if (child->m_isStaticBox)
{
// wxStaticBox is transparent in the box itself
int x = event.m_x;
int y = event.m_y;
- int xx1 = child->GetX();
- int yy1 = child->GetY();
- int xx2 = child->GetX() + child->GetWidth();
- int yy2 = child->GetX() + child->GetHeight();
+ int xx1 = child->m_x;
+ int yy1 = child->m_y;
+ int xx2 = child->m_x + child->m_width;
+ int yy2 = child->m_x + child->m_height;
// left
if (((x >= xx1) && (x <= xx1+10) && (y >= yy1) && (y <= yy2)) ||
((x >= xx1) && (x <= xx2) && (y >= yy2-1) && (y <= yy2)))
{
win = child;
- event.m_x -= child->GetX();
- event.m_y -= child->GetY();
+ event.m_x -= child->m_x;
+ event.m_y -= child->m_y;
break;
}
}
else
{
- if ((child->GetWxWindow() == (GtkWidget*) NULL) &&
- (child->GetX() <= event.m_x) &&
- (child->GetY() <= event.m_y) &&
- (child->GetX()+child->GetWidth() >= event.m_x) &&
- (child->GetY()+child->GetHeight() >= event.m_y))
+ if ((child->m_wxwindow == (GtkWidget*) NULL) &&
+ (child->m_x <= event.m_x) &&
+ (child->m_y <= event.m_y) &&
+ (child->m_x+child->m_width >= event.m_x) &&
+ (child->m_y+child->m_height >= event.m_y))
{
win = child;
- event.m_x -= child->GetX();
- event.m_y -= child->GetY();
+ event.m_x -= child->m_x;
+ event.m_y -= child->m_y;
break;
}
}
static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxWindow *win )
{
- if (!win->HasVMT()) return FALSE;
+ if (g_isIdle)
+ wxapp_install_idle_handler();
+
+ if (!win->m_hasVMT) return FALSE;
if (g_blockEventsOnDrag) return FALSE;
if (g_blockEventsOnScroll) return FALSE;
{
wxWindow *child = (wxWindow*)node->Data();
- if ( child->IsStaticBox() )
+ if (child->m_isStaticBox)
{
// wxStaticBox is transparent in the box itself
int x = event.m_x;
int y = event.m_y;
- int xx1 = child->GetX();
- int yy1 = child->GetY();
- int xx2 = child->GetX() + child->GetWidth();
- int yy2 = child->GetX() + child->GetHeight();
+ int xx1 = child->m_x;
+ int yy1 = child->m_y;
+ int xx2 = child->m_x + child->m_width;
+ int yy2 = child->m_x + child->m_height;
// left
if (((x >= xx1) && (x <= xx1+10) && (y >= yy1) && (y <= yy2)) ||
((x >= xx1) && (x <= xx2) && (y >= yy2-1) && (y <= yy2)))
{
win = child;
- event.m_x -= child->GetX();
- event.m_y -= child->GetY();
+ event.m_x -= child->m_x;
+ event.m_y -= child->m_y;
break;
}
}
else
{
- if ((child->GetWxWindow() == (GtkWidget*) NULL) &&
- (child->GetX() <= event.m_x) &&
- (child->GetY() <= event.m_y) &&
- (child->GetX()+child->GetWidth() >= event.m_x) &&
- (child->GetY()+child->GetHeight() >= event.m_y))
+ if ((child->m_wxwindow == (GtkWidget*) NULL) &&
+ (child->m_x <= event.m_x) &&
+ (child->m_y <= event.m_y) &&
+ (child->m_x+child->m_width >= event.m_x) &&
+ (child->m_y+child->m_height >= event.m_y))
{
win = child;
- event.m_x -= child->GetX();
- event.m_y -= child->GetY();
+ event.m_x -= child->m_x;
+ event.m_y -= child->m_y;
break;
}
}
static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win )
{
- if (!win->HasVMT()) return FALSE;
+ if (g_isIdle)
+ wxapp_install_idle_handler();
+
+ if (!win->m_hasVMT) return FALSE;
if (g_blockEventsOnDrag) return FALSE;
g_focusWindow = win;
- if (win->GetWxWindow())
+ if (win->m_wxwindow)
{
- if (GTK_WIDGET_CAN_FOCUS(win->GetWxWindow()))
+ if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow))
{
- GTK_WIDGET_SET_FLAGS (win->GetWxWindow(), GTK_HAS_FOCUS);
+ GTK_WIDGET_SET_FLAGS (win->m_wxwindow, GTK_HAS_FOCUS);
/*
printf( "SetFocus flag from " );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win )
{
- if (!win->HasVMT()) return FALSE;
+ if (g_isIdle)
+ wxapp_install_idle_handler();
+
+ if (!win->m_hasVMT) return FALSE;
if (g_blockEventsOnDrag) return FALSE;
- if (win->GetWxWindow())
+ if (win->m_wxwindow)
{
- if (GTK_WIDGET_CAN_FOCUS(win->GetWxWindow()))
- GTK_WIDGET_UNSET_FLAGS (win->GetWxWindow(), GTK_HAS_FOCUS);
+ if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow))
+ GTK_WIDGET_UNSET_FLAGS (win->m_wxwindow, GTK_HAS_FOCUS);
}
/*
static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
{
- if ( !win->HasVMT() || g_blockEventsOnDrag )
- return FALSE;
+ if (g_isIdle)
+ wxapp_install_idle_handler();
- GdkWindow *window = widget->window;
- if ( window != gdk_event->window )
- return FALSE;
+ if (!win->m_hasVMT) return FALSE;
+ if (g_blockEventsOnDrag) return FALSE;
- if ( window && win->GetCursor().Ok() )
- gdk_window_set_cursor( window, win->GetCursor().GetCursor() );
+ if (!win->IsOwnGtkWindow( gdk_event->window )) return FALSE;
-/*
- printf( "OnEnter from " );
- if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
- printf( win->GetClassInfo()->GetClassName() );
- printf( ".\n" );
-*/
+ if (widget->window && win->GetCursor().Ok() )
+ gdk_window_set_cursor( widget->window, win->GetCursor().GetCursor() );
wxMouseEvent event( wxEVT_ENTER_WINDOW );
event.SetEventObject( win );
int y = 0;
GdkModifierType state = (GdkModifierType)0;
- gdk_window_get_pointer( window, &x, &y, &state );
+ gdk_window_get_pointer( widget->window, &x, &y, &state );
event.m_shiftDown = (state & GDK_SHIFT_MASK);
event.m_controlDown = (state & GDK_CONTROL_MASK);
static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
{
- if ( !win->HasVMT() || g_blockEventsOnDrag )
- return FALSE;
+ if (g_isIdle)
+ wxapp_install_idle_handler();
- GdkWindow *window = widget->window;
- if ( window != gdk_event->window )
- return FALSE;
-
- if ( window && win->GetCursor().Ok() )
- gdk_window_set_cursor( window, wxSTANDARD_CURSOR->GetCursor() );
+ if (!win->m_hasVMT) return FALSE;
+ if (g_blockEventsOnDrag) return FALSE;
-/*
- printf( "OnLeave from " );
- if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
- printf( win->GetClassInfo()->GetClassName() );
- printf( ".\n" );
-*/
+ if (!win->IsOwnGtkWindow( gdk_event->window )) return FALSE;
+
+ if (widget->window && win->GetCursor().Ok() )
+ gdk_window_set_cursor( widget->window, wxSTANDARD_CURSOR->GetCursor() );
wxMouseEvent event( wxEVT_LEAVE_WINDOW );
event.SetEventObject( win );
static void gtk_window_vscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow *win )
{
- if (g_blockEventsOnDrag) return;
+ if (g_isIdle)
+ wxapp_install_idle_handler();
-/*
- printf( "OnVScroll from " );
- if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
- printf( win->GetClassInfo()->GetClassName() );
- printf( ".\n" );
-*/
+ if (g_blockEventsOnDrag) return;
- if (!win->HasVMT()) return;
+ if (!win->m_hasVMT) return;
- float diff = win->GetVAdjust()->value - win->GetOldVerticalPos();
+ float diff = win->m_vAdjust->value - win->m_oldVerticalPos;
if (fabs(diff) < 0.2) return;
- win->SetOldVerticalPos(win->GetVAdjust()->value);
+ win->m_oldVerticalPos = win->m_vAdjust->value;
wxEventType command = wxEVT_NULL;
- float line_step = win->GetVAdjust()->step_increment;
- float page_step = win->GetVAdjust()->page_increment;
+ float line_step = win->m_vAdjust->step_increment;
+ float page_step = win->m_vAdjust->page_increment;
if (win->IsScrolling())
{
}
else
{
- if (fabs(win->GetVAdjust()->value-win->GetVAdjust()->lower) < 0.2) command = wxEVT_SCROLL_BOTTOM;
- else if (fabs(win->GetVAdjust()->value-win->GetVAdjust()->upper) < 0.2) command = wxEVT_SCROLL_TOP;
+ if (fabs(win->m_vAdjust->value-win->m_vAdjust->lower) < 0.2) command = wxEVT_SCROLL_BOTTOM;
+ else if (fabs(win->m_vAdjust->value-win->m_vAdjust->upper) < 0.2) command = wxEVT_SCROLL_TOP;
else if (fabs(diff-line_step) < 0.2) command = wxEVT_SCROLL_LINEDOWN;
else if (fabs(diff+line_step) < 0.2) command = wxEVT_SCROLL_LINEUP;
else if (fabs(diff-page_step) < 0.2) command = wxEVT_SCROLL_PAGEDOWN;
else command = wxEVT_SCROLL_THUMBTRACK;
}
- int value = (int)(win->GetVAdjust()->value+0.5);
+ int value = (int)(win->m_vAdjust->value+0.5);
wxScrollEvent event( command, win->GetId(), value, wxVERTICAL );
event.SetEventObject( win );
static void gtk_window_hscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow *win )
{
- if (g_blockEventsOnDrag) return;
-
-/*
- printf( "OnHScroll from " );
- if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
- printf( win->GetClassInfo()->GetClassName() );
- printf( ".\n" );
-*/
+ if (g_isIdle)
+ wxapp_install_idle_handler();
- if (!win->HasVMT()) return;
+ if (g_blockEventsOnDrag) return;
+ if (!win->m_hasVMT) return;
- float diff = win->GetHAdjust()->value - win->GetOldHorizontalPos();
+ float diff = win->m_hAdjust->value - win->m_oldHorizontalPos;
if (fabs(diff) < 0.2) return;
- win->SetOldHorizontalPos( win->GetHAdjust()->value );
+ win->m_oldHorizontalPos = win->m_hAdjust->value;
wxEventType command = wxEVT_NULL;
- float line_step = win->GetHAdjust()->step_increment;
- float page_step = win->GetHAdjust()->page_increment;
+ float line_step = win->m_hAdjust->step_increment;
+ float page_step = win->m_hAdjust->page_increment;
if (win->IsScrolling())
{
}
else
{
- if (fabs(win->GetHAdjust()->value-win->GetHAdjust()->lower) < 0.2) command = wxEVT_SCROLL_BOTTOM;
- else if (fabs(win->GetHAdjust()->value-win->GetHAdjust()->upper) < 0.2) command = wxEVT_SCROLL_TOP;
+ if (fabs(win->m_hAdjust->value-win->m_hAdjust->lower) < 0.2) command = wxEVT_SCROLL_BOTTOM;
+ else if (fabs(win->m_hAdjust->value-win->m_hAdjust->upper) < 0.2) command = wxEVT_SCROLL_TOP;
else if (fabs(diff-line_step) < 0.2) command = wxEVT_SCROLL_LINEDOWN;
else if (fabs(diff+line_step) < 0.2) command = wxEVT_SCROLL_LINEUP;
else if (fabs(diff-page_step) < 0.2) command = wxEVT_SCROLL_PAGEDOWN;
else command = wxEVT_SCROLL_THUMBTRACK;
}
- int value = (int)(win->GetHAdjust()->value+0.5);
+ int value = (int)(win->m_hAdjust->value+0.5);
wxScrollEvent event( command, win->GetId(), value, wxHORIZONTAL );
event.SetEventObject( win );
static void gtk_window_vscroll_change_callback( GtkWidget *WXUNUSED(widget), wxWindow *win )
{
- if (g_blockEventsOnDrag) return;
+ if (g_isIdle)
+ wxapp_install_idle_handler();
-/*
- printf( "OnVScroll change from " );
- if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
- printf( win->GetClassInfo()->GetClassName() );
- printf( ".\n" );
-*/
-
- if (!win->HasVMT()) return;
+ if (g_blockEventsOnDrag) return;
+ if (!win->m_hasVMT) return;
wxEventType command = wxEVT_SCROLL_THUMBTRACK;
- int value = (int)(win->GetVAdjust()->value+0.5);
+ int value = (int)(win->m_vAdjust->value+0.5);
wxScrollEvent event( command, win->GetId(), value, wxVERTICAL );
event.SetEventObject( win );
static void gtk_window_hscroll_change_callback( GtkWidget *WXUNUSED(widget), wxWindow *win )
{
- if (g_blockEventsOnDrag) return;
-
-/*
- printf( "OnHScroll change from " );
- if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
- printf( win->GetClassInfo()->GetClassName() );
- printf( ".\n" );
-*/
+ if (g_isIdle)
+ wxapp_install_idle_handler();
- if (!win->HasVMT()) return;
+ if (g_blockEventsOnDrag) return;
+ if (!win->m_hasVMT) return;
wxEventType command = wxEVT_SCROLL_THUMBTRACK;
- int value = (int)(win->GetHAdjust()->value+0.5);
+ int value = (int)(win->m_hAdjust->value+0.5);
wxScrollEvent event( command, win->GetId(), value, wxHORIZONTAL );
event.SetEventObject( win );
GdkEventButton *WXUNUSED(gdk_event),
wxWindow *win )
{
+ if (g_isIdle)
+ wxapp_install_idle_handler();
+
// don't test here as we can release the mouse while being over
// a different window then the slider
//
//
// if (gdk_event->window != widget->slider) return FALSE;
- GtkScrolledWindow *scrolledWindow = GTK_SCROLLED_WINDOW(win->GetHandle());
+ GtkScrolledWindow *scrolledWindow = GTK_SCROLLED_WINDOW(win->m_widget);
if (widget == GTK_RANGE(scrolledWindow->vscrollbar))
- gtk_signal_emit_by_name( GTK_OBJECT(win->GetHAdjust()), "value_changed" );
+ gtk_signal_emit_by_name( GTK_OBJECT(win->m_hAdjust), "value_changed" );
else
- gtk_signal_emit_by_name( GTK_OBJECT(win->GetVAdjust()), "value_changed" );
+ gtk_signal_emit_by_name( GTK_OBJECT(win->m_vAdjust), "value_changed" );
win->SetScrolling( FALSE );
return g_focusWindow;
}
+//-----------------------------------------------------------------------------
+// "realize" from m_widget
+//-----------------------------------------------------------------------------
+
+/* we cannot set colours, fonts and cursors before the widget has
+ been realized, so we do this directly after realization */
+
+static gint
+gtk_window_realized_callback( GtkWidget *widget, wxWindow *win )
+{
+ if (g_isIdle)
+ wxapp_install_idle_handler();
+
+ if (win->m_font != *wxSWISS_FONT)
+ {
+ wxFont font( win->m_font );
+ win->m_font = wxNullFont;
+ win->SetFont( font );
+ }
+
+ if (win->m_backgroundColour != wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE ))
+ {
+ wxColour bg( win->m_backgroundColour );
+ win->m_backgroundColour = wxNullColour;
+ win->SetBackgroundColour( bg );
+ }
+
+ if (win->m_foregroundColour != *wxBLACK)
+ {
+ wxColour fg( win->m_foregroundColour );
+ win->m_foregroundColour = wxNullColour;
+ win->SetForegroundColour( fg );
+ }
+
+ wxCursor cursor( win->m_cursor );
+ win->m_cursor = wxNullCursor;
+ win->SetCursor( cursor );
+
+ return FALSE;
+}
+
//-----------------------------------------------------------------------------
// InsertChild for wxWindow.
//-----------------------------------------------------------------------------
static void wxInsertChildInWindow( wxWindow* parent, wxWindow* child )
{
- gtk_myfixed_put( GTK_MYFIXED(parent->GetWxWindow()),
- GTK_WIDGET(child->GetHandle()),
- child->GetX(),
- child->GetY(),
- child->GetWidth(),
- child->GetHeight() );
-
- gtk_widget_set_usize( GTK_WIDGET(child->GetHandle()),
- child->GetWidth(),
- child->GetHeight() );
+ gtk_myfixed_put( GTK_MYFIXED(parent->m_wxwindow),
+ GTK_WIDGET(child->m_widget),
+ child->m_x,
+ child->m_y,
+ child->m_width,
+ child->m_height );
if (parent->HasFlag(wxTAB_TRAVERSAL))
{
/* we now allow a window to get the focus as long as it
doesn't have any children. */
- GTK_WIDGET_UNSET_FLAGS( parent->GetWxWindow(), GTK_CAN_FOCUS );
+ GTK_WIDGET_UNSET_FLAGS( parent->m_wxwindow, GTK_CAN_FOCUS );
}
}
InitBase();
// GTK specific
+ m_widget = (GtkWidget *) NULL;
m_wxwindow = (GtkWidget *) NULL;
// position/size
- m_x =
- m_y =
- m_width =
+ m_x = 0;
+ m_y = 0;
+ m_width = 0;
m_height = 0;
m_font = *wxSWISS_FONT;
m_hasVMT = FALSE;
m_needParent = TRUE;
- m_hasScrolling =
+ m_hasScrolling = FALSE;
m_isScrolling = FALSE;
- m_hAdjust =
+ m_hAdjust = (GtkAdjustment*) NULL;
m_vAdjust = (GtkAdjustment*) NULL;
- m_oldHorizontalPos =
+ m_oldHorizontalPos = 0.0;
m_oldVerticalPos = 0.0;
m_resizing = FALSE;
#endif // GTK_MINOR_VERSION == 0
// I _really_ don't want scrollbars in the beginning
- InitAdjustment(m_vAdjust);
- InitAdjustment(m_hAdjust);
+ m_vAdjust->lower = 0.0;
+ m_vAdjust->upper = 1.0;
+ m_vAdjust->value = 0.0;
+ m_vAdjust->step_increment = 1.0;
+ m_vAdjust->page_increment = 1.0;
+ m_vAdjust->page_size = 5.0;
+ gtk_signal_emit_by_name( GTK_OBJECT(m_vAdjust), "changed" );
+ m_hAdjust->lower = 0.0;
+ m_hAdjust->upper = 1.0;
+ m_hAdjust->value = 0.0;
+ m_hAdjust->step_increment = 1.0;
+ m_hAdjust->page_increment = 1.0;
+ m_hAdjust->page_size = 5.0;
+ gtk_signal_emit_by_name( GTK_OBJECT(m_hAdjust), "changed" );
// these handlers block mouse events to any window during scrolling such as
// motion events and prevent GTK and wxWindows from fighting over where the
if (m_widget)
Show( FALSE );
+ DestroyChildren();
+
if (m_parent)
m_parent->RemoveChild( this );
if (m_widgetStyle)
+ {
gtk_style_unref( m_widgetStyle );
+ m_widgetStyle = (GtkStyle*) NULL;
+ }
if (m_scrollGC)
+ {
gdk_gc_unref( m_scrollGC );
+ m_scrollGC = (GdkGC*) NULL;
+ }
if (m_wxwindow)
+ {
gtk_widget_destroy( m_wxwindow );
+ m_wxwindow = (GtkWidget*) NULL;
+ }
if (m_widget)
+ {
gtk_widget_destroy( m_widget );
+ m_widget = (GtkWidget*) NULL;
+ }
}
void wxWindow::PreCreation( wxWindow *parent,
#endif
}
- ConnectWidget( GetConnectWidget() );
-
- /* we force the creation of wxFrame and wxDialog in the respective code */
- if (m_parent)
- gtk_widget_realize( m_widget );
+ GtkWidget *connect_widget = GetConnectWidget();
- if (m_wxwindow)
- gtk_widget_realize( m_wxwindow );
+ ConnectWidget( connect_widget );
- SetCursor( *wxSTANDARD_CURSOR );
+ /* we cannot set colours, fonts and cursors before the widget has
+ been realized, so we do this directly after realization */
+ gtk_signal_connect( GTK_OBJECT(connect_widget), "realize",
+ GTK_SIGNAL_FUNC(gtk_window_realized_callback), (gpointer) this );
m_hasVMT = TRUE;
}
if (m_resizing) return; /* I don't like recursions */
m_resizing = TRUE;
- if (m_parent->GetWxWindow() == NULL) /* i.e. wxNotebook */
+ if (m_parent->m_wxwindow == NULL) /* i.e. wxNotebook */
{
/* don't set the size for children of wxNotebook, just take the values. */
m_x = x;
}
else
{
- int old_width = m_width;
- int old_height = m_height;
-
if ((sizeFlags & wxSIZE_USE_EXISTING) == wxSIZE_USE_EXISTING)
{
if (x != -1) m_x = x;
if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_maxWidth;
if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight;
- if (GTK_WIDGET_HAS_DEFAULT(m_widget))
- {
- /* the default button has a border around it */
- int border = 5;
-
- gtk_myfixed_move( GTK_MYFIXED(m_parent->GetWxWindow()), m_widget, m_x-border, m_y-border );
-
- gtk_widget_set_usize( m_widget, m_width+2*border, m_height+2*border );
- }
- else
- {
- gtk_myfixed_move( GTK_MYFIXED(m_parent->GetWxWindow()), m_widget, m_x, m_y );
+ int border = 0;
- if ((old_width != m_width) || (old_height != m_height))
- gtk_widget_set_usize( m_widget, m_width, m_height );
- }
+ if (GTK_WIDGET_HAS_DEFAULT(m_widget))
+ {
+ /* the default button has a border around it */
+ border = 5;
+ }
+
+ /* this is the result of hours of debugging: the following code
+ means that if we have a m_wxwindow and we set the size of
+ m_widget, m_widget (which is a GtkScrolledWindow) does NOT
+ automatically propagate its size down to its m_wxwindow,
+ which is its client area. therefore, we have to tell the
+ client area directly that it has to resize itself.
+ this will lead to that m_widget (GtkScrolledWindow) will
+ calculate how much size it needs for scrollbars etc and
+ it will then call XXX_size_allocate of its child, which
+ is m_wxwindow. m_wxwindow in turn will do the same with its
+ children and so on. problems can arise if this happens
+ before all the children have been realized as some widgets
+ stupidy need to be realized during XXX_size_allocate (e.g.
+ GtkNotebook) and they will segv if called otherwise. this
+ emergency is tested in gtk_myfixed_size_allocate. Normally
+ this shouldn't be needed and only gtk_widget_queue_resize()
+ should be enough to provoke a resize at the next appropriate
+ moment, but this seems to fail, e.g. when a wxNotebook contains
+ a wxSplitterWindow: the splitter window's children won't
+ show up properly resized then. */
+
+ gtk_myfixed_set_size( GTK_MYFIXED(m_parent->m_wxwindow),
+ m_widget,
+ m_x-border,
+ m_y-border,
+ m_width+2*border,
+ m_height+2*border );
}
m_sizeSet = TRUE;
{
wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
+ if (!m_widget->window) return;
+
GdkWindow *source = (GdkWindow *) NULL;
if (m_wxwindow)
source = m_wxwindow->window;
{
wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
+ if (!m_widget->window) return;
+
GdkWindow *source = (GdkWindow *) NULL;
if (m_wxwindow)
source = m_wxwindow->window;
{
wxCHECK_MSG( (m_widget != NULL), (wxWindow*) NULL, _T("invalid window") );
+ gtk_widget_unparent( m_widget );
+
if ( !wxWindowBase::Reparent(newParent) )
return FALSE;
- gtk_widget_unparent( m_widget );
-
return TRUE;
}
{
wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
+ if (!m_widget->window) return;
+
gdk_window_raise( m_widget->window );
}
{
wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
+ if (!m_widget->window) return;
+
gdk_window_lower( m_widget->window );
}
if ( wxWindowBase::SetCursor(cursor) )
{
+ if (!m_widget->window) return TRUE;
+
if ((m_widget) && (m_widget->window))
gdk_window_set_cursor( m_widget->window, GetCursor().GetCursor() );
{
wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
+ if (!m_widget->window) return;
+
if (eraseBackground && m_wxwindow && m_wxwindow->window)
{
if (rect)
{
wxCHECK_RET( m_widget != NULL, _T("invalid window") );
+ if (!m_widget->window) return;
+
if (m_wxwindow && m_wxwindow->window)
{
gdk_window_clear( m_wxwindow->window );
{
wxCHECK_MSG( m_widget != NULL, FALSE, _T("invalid window") );
- if ( !wxWindowBase::SetBackgroundColour(colour) )
- return FALSE;
+ if (!colour.Ok()) return FALSE;
+ if (m_backgroundColour == colour) return FALSE;
+
+ GtkWidget *connect_widget = GetConnectWidget();
+ if (!connect_widget->window) return TRUE;
if (m_wxwindow && m_wxwindow->window)
{
- // wxMSW doesn't clear the window here. I don't do that either to
- // provide compatibility. call Clear() to do the job.
+ /* 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() );
{
wxCHECK_MSG( m_widget != NULL, FALSE, _T("invalid window") );
- if ( !wxWindowBase::SetForegroundColour(colour) )
- return FALSE;
+ if (!colour.Ok()) return FALSE;
+ if (m_backgroundColour == colour) return FALSE;
+
+ GtkWidget *connect_widget = GetConnectWidget();
+ if (!connect_widget->window) return TRUE;
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
if ( sysbg == m_foregroundColour )
bool wxWindow::SetFont( const wxFont &font )
{
- wxCHECK_MSG( m_widget != NULL, FALSE, _T("invalid window") );
+ wxCHECK_MSG( m_widget != NULL, FALSE, _T( "invalid window") );
- if ( !wxWindowBase::SetFont(font) )
- {
- // nothing to do
- return FALSE;
- }
+ if (!font.Ok()) return FALSE;
+ if (m_font == font) return FALSE;
+
+ GtkWidget *connect_widget = GetConnectWidget();
+ if (!connect_widget->window) return TRUE;
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
if ( sysbg == m_backgroundColour )
wxCHECK_RET( g_capturing == FALSE, _T("CaptureMouse called twice") );
GtkWidget *connect_widget = GetConnectWidget();
+ if (!connect_widget->window) return;
+
gtk_grab_add( connect_widget );
gdk_pointer_grab( connect_widget->window, FALSE,
(GdkEventMask)
wxCHECK_RET( g_capturing == TRUE, _T("ReleaseMouse called twice") );
GtkWidget *connect_widget = GetConnectWidget();
+ if (!connect_widget->window) return;
+
gtk_grab_remove( connect_widget );
gdk_pointer_ungrab ( GDK_CURRENT_TIME );
g_capturing = FALSE;
wxCHECK_RET( m_wxwindow != NULL, _T("window needs client area for scrolling") );
- wxNode *node = m_children.First();
- while (node)
+ if (!m_scrollGC)
{
- wxWindow *child = (wxWindow*) node->Data();
- child->Move( child->GetX() + dx, child->GetY() + dy );
- node = node->Next();
+ m_scrollGC = gdk_gc_new( m_wxwindow->window );
+ gdk_gc_set_exposures( m_scrollGC, TRUE );
}
int cw = 0;
int ch = 0;
GetClientSize( &cw, &ch );
-
int w = cw - abs(dx);
int h = ch - abs(dy);
+
if ((h < 0) || (w < 0))
{
Refresh();
- return;
}
- int s_x = 0;
- int s_y = 0;
- if (dx < 0) s_x = -dx;
- if (dy < 0) s_y = -dy;
- int d_x = 0;
- int d_y = 0;
- if (dx > 0) d_x = dx;
- if (dy > 0) d_y = dy;
-
- if (!m_scrollGC)
+ else
{
- m_scrollGC = gdk_gc_new( m_wxwindow->window );
- gdk_gc_set_exposures( m_scrollGC, TRUE );
- }
+ int s_x = 0;
+ int s_y = 0;
+ if (dx < 0) s_x = -dx;
+ if (dy < 0) s_y = -dy;
+ int d_x = 0;
+ int d_y = 0;
+ if (dx > 0) d_x = dx;
+ if (dy > 0) d_y = dy;
- gdk_window_copy_area( m_wxwindow->window, m_scrollGC, d_x, d_y,
- m_wxwindow->window, s_x, s_y, w, h );
+ gdk_window_copy_area( m_wxwindow->window, m_scrollGC, d_x, d_y,
+ m_wxwindow->window, s_x, s_y, w, h );
- wxRect rect;
- if (dx < 0) rect.x = cw+dx; else rect.x = 0;
- if (dy < 0) rect.y = ch+dy; else rect.y = 0;
- if (dy != 0) rect.width = cw; else rect.width = abs(dx);
- if (dx != 0) rect.height = ch; else rect.height = abs(dy);
+ wxRect rect;
+ if (dx < 0) rect.x = cw+dx; else rect.x = 0;
+ if (dy < 0) rect.y = ch+dy; else rect.y = 0;
+ if (dy != 0) rect.width = cw; else rect.width = abs(dx);
+ if (dx != 0) rect.height = ch; else rect.height = abs(dy);
- Refresh( TRUE, &rect );
+ Refresh( TRUE, &rect );
+ }
+
+ wxNode *node = m_children.First();
+ while (node)
+ {
+ wxWindow *child = (wxWindow*) node->Data();
+ child->Move( child->m_x + dx, child->m_y + dy );
+ node = node->Next();
+ }
}
void wxWindow::SetScrolling(bool scroll)
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!button->HasVMT()) return;
+ if (!button->m_hasVMT) return;
if (g_blockEventsOnDrag) return;
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
static void gtk_bmpbutton_enter_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button )
{
- if (!button->HasVMT()) return;
+ if (!button->m_hasVMT) return;
if (g_blockEventsOnDrag) return;
button->HasFocus();
static void gtk_bmpbutton_leave_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button )
{
- if (!button->HasVMT()) return;
+ if (!button->m_hasVMT) return;
if (g_blockEventsOnDrag) return;
button->NotFocus();
static void gtk_bmpbutton_press_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button )
{
- if (!button->HasVMT()) return;
+ if (!button->m_hasVMT) return;
if (g_blockEventsOnDrag) return;
button->StartSelect();
static void gtk_bmpbutton_release_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button )
{
- if (!button->HasVMT()) return;
+ if (!button->m_hasVMT) return;
if (g_blockEventsOnDrag) return;
button->EndSelect();
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!button->HasVMT()) return;
+ if (!button->m_hasVMT) return;
if (g_blockEventsOnDrag) return;
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!cb->HasVMT()) return;
+ if (!cb->m_hasVMT) return;
if (cb->m_blockFirstEvent)
{
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!choice->HasVMT()) return;
+ if (!choice->m_hasVMT) return;
if (g_blockEventsOnDrag) return;
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!combo->HasVMT()) return;
+ if (!combo->m_hasVMT) return;
if (g_blockEventsOnDrag) return;
{
if (g_isIdle) wxapp_install_idle_handler();
+ if (!combo->m_hasVMT) return;
+
wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, combo->GetId() );
event.SetString( combo->GetValue() );
event.SetEventObject( combo );
if (!window) return;
- GtkWidget *widget = window->GetWxWindow();
+ GtkWidget *widget = window->m_wxwindow;
if (!widget)
return;
/* still not realized ? */
if (!m_window) return;
- if (window->GetWxWindow())
- m_cmap = gtk_widget_get_colormap( window->GetWxWindow() );
+ if (window->m_wxwindow)
+ m_cmap = gtk_widget_get_colormap( window->m_wxwindow );
else
- m_cmap = gtk_widget_get_colormap( window->GetHandle() );
+ m_cmap = gtk_widget_get_colormap( window->m_widget );
m_isMemDC = FALSE;
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!win->HasVMT()) return;
+ if (!win->m_hasVMT) return;
/*
printf( "OnDialogResize from " );
printf( ".\n" );
*/
- if ((win->GetWidth() != alloc->width) || (win->GetHeight() != alloc->height))
+ if ((win->m_width != alloc->width) || (win->m_height != alloc->height))
{
win->InternalSetSize( alloc->width, alloc->height );
}
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!win->HasVMT()) return FALSE;
+ if (!win->m_hasVMT) return FALSE;
win->InternalSetPosition(event->x, event->y);
- wxMoveEvent mevent( wxPoint(win->GetX(),win->GetY()), win->GetId() );
+ wxMoveEvent mevent( wxPoint(win->m_x,win->m_y), win->GetId() );
mevent.SetEventObject( win );
win->GetEventHandler()->ProcessEvent( mevent );
{
/* I haven''t been able to set the position of
the dialog before it is shown, so I do it here */
- gtk_widget_set_uposition( widget, win->GetX(), win->GetY() );
+ gtk_widget_set_uposition( widget, win->m_x, win->m_y );
/* all this is for Motif Window Manager "hints" and is supposed to be
recognized by other WM as well. not tested. */
func |= GDK_FUNC_RESIZE;
decor |= GDK_DECOR_RESIZEH;
}
- gdk_window_set_decorations( win->GetHandle()->window, (GdkWMDecoration)decor);
- gdk_window_set_functions( win->GetHandle()->window, (GdkWMFunction)func);
+ gdk_window_set_decorations( win->m_widget->window, (GdkWMDecoration)decor);
+ gdk_window_set_functions( win->m_widget->window, (GdkWMFunction)func);
/* GTK's shrinking/growing policy */
if ((win->GetWindowStyle() & wxRESIZE_BORDER) == 0)
- gtk_window_set_policy(GTK_WINDOW(win->GetHandle()), 0, 0, 1);
+ gtk_window_set_policy(GTK_WINDOW(win->m_widget), 0, 0, 1);
else
- gtk_window_set_policy(GTK_WINDOW(win->GetHandle()), 1, 1, 1);
+ gtk_window_set_policy(GTK_WINDOW(win->m_widget), 1, 1, 1);
return FALSE;
}
m_waiting = TRUE;
m_window = win;
- m_widget = win->GetWidget();
- if (win->GetWxWindow()) m_widget = win->GetWxWindow();
+ m_widget = win->m_widget;
+ if (win->m_wxwindow) m_widget = win->m_wxwindow;
m_data = (wxDataBroker*) NULL;
m_retValue = wxDragCancel;
m_waiting = TRUE;
m_window = win;
- m_widget = win->GetWidget();
- if (win->GetWxWindow()) m_widget = win->GetWxWindow();
+ m_widget = win->m_widget;
+ if (win->m_wxwindow) m_widget = win->m_wxwindow;
m_retValue = wxDragCancel;
if (data)
wxDropSource::wxDropSource( wxDataBroker *data, wxWindow *win )
{
m_window = win;
- m_widget = win->GetWidget();
- if (win->GetWxWindow()) m_widget = win->GetWxWindow();
+ m_widget = win->m_widget;
+ if (win->m_wxwindow) m_widget = win->m_wxwindow;
m_retValue = wxDragCancel;
m_data = data;
int style = dialog->GetStyle();
- GtkFileSelection *filedlg = GTK_FILE_SELECTION(dialog->GetHandle());
+ GtkFileSelection *filedlg = GTK_FILE_SELECTION(dialog->m_widget);
char *filename = gtk_file_selection_get_filename(filedlg);
if ( (style & wxSAVE) && ( style & wxOVERWRITE_PROMPT ) )
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!win->HasVMT()) return;
+ if (!win->m_hasVMT) return;
/*
printf( "OnFrameResize from " );
printf( ".\n" );
*/
- if ((win->GetWidth() != alloc->width) || (win->GetHeight() != alloc->height))
+ if ((win->m_width != alloc->width) || (win->m_height != alloc->height))
{
win->InternalSetSize( alloc->width, alloc->height );
}
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!win->HasVMT()) return;
+ if (!win->m_hasVMT) return;
win->m_menuBarDetached = FALSE;
win->UpdateSize();
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!win->HasVMT()) return;
+ if (!win->m_hasVMT) return;
win->m_menuBarDetached = TRUE;
win->UpdateSize();
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!win->HasVMT()) return;
+ if (!win->m_hasVMT) return;
win->m_toolBarDetached = FALSE;
win->UpdateSize();
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!win->HasVMT()) return;
+ if (!win->m_hasVMT) return;
win->m_toolBarDetached = TRUE;
win->UpdateSize();
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!win->HasVMT()) return FALSE;
+ if (!win->m_hasVMT) return FALSE;
win->InternalSetPosition(event->x, event->y);
- wxMoveEvent mevent( wxPoint(win->GetX(),win->GetY()), win->GetId() );
+ wxMoveEvent mevent( wxPoint(win->m_x,win->m_y), win->GetId() );
mevent.SetEventObject( win );
win->GetEventHandler()->ProcessEvent( mevent );
}
- gdk_window_set_decorations( win->GetHandle()->window, (GdkWMDecoration)decor);
- gdk_window_set_functions( win->GetHandle()->window, (GdkWMFunction)func);
+ gdk_window_set_decorations( win->m_widget->window, (GdkWMDecoration)decor);
+ gdk_window_set_functions( win->m_widget->window, (GdkWMFunction)func);
/* GTK's shrinking/growing policy */
if ((win->GetWindowStyle() & wxRESIZE_BORDER) == 0)
- gtk_window_set_policy(GTK_WINDOW(win->GetHandle()), 0, 0, 1);
+ gtk_window_set_policy(GTK_WINDOW(win->m_widget), 0, 0, 1);
else
- gtk_window_set_policy(GTK_WINDOW(win->GetHandle()), 1, 1, 1);
+ gtk_window_set_policy(GTK_WINDOW(win->m_widget), 1, 1, 1);
/* reset the icon */
if (win->m_icon != wxNullIcon)
/* these are outside the client area */
wxFrame* frame = (wxFrame*) parent;
gtk_myfixed_put( GTK_MYFIXED(frame->m_mainWidget),
- GTK_WIDGET(child->GetHandle()),
- child->GetX(),
- child->GetY(),
- child->GetWidth(),
- child->GetHeight() );
+ GTK_WIDGET(child->m_widget),
+ child->m_x,
+ child->m_y,
+ child->m_width,
+ child->m_height );
/* we connect to these events for recalculating the client area
space when the toolbar is floating */
wxToolBar *toolBar = (wxToolBar*) child;
if (toolBar->GetWindowStyle() & wxTB_DOCKABLE)
{
- gtk_signal_connect( GTK_OBJECT(toolBar->GetHandle()), "child_attached",
+ gtk_signal_connect( GTK_OBJECT(toolBar->m_widget), "child_attached",
GTK_SIGNAL_FUNC(gtk_toolbar_attached_callback), (gpointer)parent );
- gtk_signal_connect( GTK_OBJECT(toolBar->GetHandle()), "child_detached",
+ gtk_signal_connect( GTK_OBJECT(toolBar->m_widget), "child_detached",
GTK_SIGNAL_FUNC(gtk_toolbar_detached_callback), (gpointer)parent );
}
}
else
{
/* these are inside the client area */
- gtk_myfixed_put( GTK_MYFIXED(parent->GetWxWindow()),
- GTK_WIDGET(child->GetHandle()),
- child->GetX(),
- child->GetY(),
- child->GetWidth(),
- child->GetHeight() );
+ gtk_myfixed_put( GTK_MYFIXED(parent->m_wxwindow),
+ GTK_WIDGET(child->m_widget),
+ child->m_x,
+ child->m_y,
+ child->m_width,
+ child->m_height );
}
/* resize on OnInternalIdle */
m_frameMenuBar->InternalSetPosition(xx, yy);
m_frameMenuBar->InternalSetSize(ww, hh);
gtk_myfixed_set_size( GTK_MYFIXED(m_mainWidget),
- m_frameMenuBar->GetHandle(),
+ m_frameMenuBar->m_widget,
xx, yy, ww, hh );
client_area_y_offset += hh;
}
yy += wxPLACE_HOLDER;
}
int ww = m_width - 2*m_miniEdge;
- int hh = m_frameToolBar->GetHeight();
+ int hh = m_frameToolBar->m_height;
// VZ: according to earlier comments in this file, the tbar height
// shouldn't be changed, so I comment out the next line
// (09.05.99)
m_frameToolBar->InternalSetSize(ww, hh);
gtk_myfixed_set_size( GTK_MYFIXED(m_mainWidget),
- m_frameToolBar->GetHandle(),
+ m_frameToolBar->m_widget,
xx, yy, ww, hh );
client_area_y_offset += hh;
}
m_frameStatusBar->InternalSetPosition(xx, yy);
m_frameStatusBar->InternalSetSize(ww, hh);
gtk_myfixed_set_size( GTK_MYFIXED(m_wxwindow),
- m_frameStatusBar->GetHandle(),
+ m_frameStatusBar->m_widget,
xx, yy, ww, hh );
}
/* send size event to status bar */
if (m_frameStatusBar)
{
- wxSizeEvent event2( wxSize(m_frameStatusBar->GetWidth(),m_frameStatusBar->GetHeight()), m_frameStatusBar->GetId() );
+ wxSizeEvent event2( wxSize(m_frameStatusBar->m_width,m_frameStatusBar->m_height), m_frameStatusBar->GetId() );
event2.SetEventObject( m_frameStatusBar );
m_frameStatusBar->GetEventHandler()->ProcessEvent( event2 );
}
#if (GTK_MINOR_VERSION > 0)
/* support for native hot keys */
- gtk_accel_group_attach( menu->m_accel, GTK_OBJECT(win->GetHandle()));
+ gtk_accel_group_attach( menu->m_accel, GTK_OBJECT(win->m_widget));
#endif
wxNode *node = menu->GetItems().First();
{
m_frameMenuBar->SetParent(this);
gtk_myfixed_put( GTK_MYFIXED(m_mainWidget),
- m_frameMenuBar->GetHandle(),
- m_frameMenuBar->GetX(),
- m_frameMenuBar->GetY(),
- m_frameMenuBar->GetWidth(),
- m_frameMenuBar->GetHeight() );
+ m_frameMenuBar->m_widget,
+ m_frameMenuBar->m_x,
+ m_frameMenuBar->m_y,
+ m_frameMenuBar->m_width,
+ m_frameMenuBar->m_height );
if (menuBar->GetWindowStyle() & wxMB_DOCKABLE)
{
- gtk_signal_connect( GTK_OBJECT(menuBar->GetHandle()), "child_attached",
+ gtk_signal_connect( GTK_OBJECT(menuBar->m_widget), "child_attached",
GTK_SIGNAL_FUNC(gtk_menu_attached_callback), (gpointer)this );
- gtk_signal_connect( GTK_OBJECT(menuBar->GetHandle()), "child_detached",
+ gtk_signal_connect( GTK_OBJECT(menuBar->m_widget), "child_detached",
GTK_SIGNAL_FUNC(gtk_menu_detached_callback), (gpointer)this );
}
}
if (g_blockEventsOnDrag) return FALSE;
if (g_blockEventsOnScroll) return FALSE;
- if (!listbox->HasVMT()) return FALSE;
+ if (!listbox->m_hasVMT) return FALSE;
int sel = listbox->GetIndex( widget );
if (g_blockEventsOnDrag) return FALSE;
- if (!listbox->HasVMT()) return FALSE;
+ if (!listbox->m_hasVMT) return FALSE;
if (gdk_event->keyval != ' ') return FALSE;
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!listbox->HasVMT()) return;
+ if (!listbox->m_hasVMT) return;
if (g_blockEventsOnDrag) return;
wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, listbox->GetId() );
wxMenuBar *menu_bar = child_frame->m_menuBar;
if (!menu_bar) return;
- if (!menu_bar->GetHandle()) return;
+ if (!menu_bar->m_widget) return;
menu_bar->InternalSetPosition(0, 0);
menu_bar->InternalSetSize(m_width, wxMENU_HEIGHT);
gtk_myfixed_set_size( GTK_MYFIXED(m_mainWidget),
- menu_bar->GetHandle(),
+ menu_bar->m_widget,
0, 0, m_width, wxMENU_HEIGHT );
}
if (m_justInserted)
{
- GtkNotebook *notebook = GTK_NOTEBOOK(m_clientWindow->GetHandle());
+ GtkNotebook *notebook = GTK_NOTEBOOK(m_clientWindow->m_widget);
gtk_notebook_set_page( notebook, g_list_length( notebook->children ) - 1 );
m_justInserted = FALSE;
{
if (child_frame == active_child_frame)
{
- gtk_widget_show( child_frame->m_menuBar->GetHandle() );
+ gtk_widget_show( child_frame->m_menuBar->m_widget );
visible_child_menu = TRUE;
}
else
- gtk_widget_hide( child_frame->m_menuBar->GetHandle() );
+ gtk_widget_hide( child_frame->m_menuBar->m_widget );
}
node = node->Next();
}
{
if (!m_clientWindow) return (wxMDIChildFrame*) NULL;
- GtkNotebook *notebook = GTK_NOTEBOOK(m_clientWindow->GetHandle());
+ GtkNotebook *notebook = GTK_NOTEBOOK(m_clientWindow->m_widget);
if (!notebook) return (wxMDIChildFrame*) NULL;
#if (GTK_MINOR_VERSION > 0)
void wxMDIParentFrame::ActivateNext()
{
if (m_clientWindow)
- gtk_notebook_next_page( GTK_NOTEBOOK(m_clientWindow->GetHandle()) );
+ gtk_notebook_next_page( GTK_NOTEBOOK(m_clientWindow->m_widget) );
}
void wxMDIParentFrame::ActivatePrevious()
{
if (m_clientWindow)
- gtk_notebook_prev_page( GTK_NOTEBOOK(m_clientWindow->GetHandle()) );
+ gtk_notebook_prev_page( GTK_NOTEBOOK(m_clientWindow->m_widget) );
}
void wxMDIParentFrame::OnActivate( wxActivateEvent& WXUNUSED(event) )
}
/* the menu bar of the child window is shown in idle time as needed */
- gtk_widget_hide( m_menuBar->GetHandle() );
+ gtk_widget_hide( m_menuBar->m_widget );
/* insert the invisible menu bar into the _parent_ mdi frame */
gtk_myfixed_put( GTK_MYFIXED(mdi_frame->m_mainWidget),
- m_menuBar->GetHandle(),
- 0, 0, mdi_frame->GetWidth(), wxMENU_HEIGHT );
+ m_menuBar->m_widget,
+ 0, 0, mdi_frame->m_width, wxMENU_HEIGHT );
}
}
{
if (g_isIdle) wxapp_install_idle_handler();
- if ((win->GetX() == alloc->x) &&
- (win->GetY() == alloc->y) &&
- (win->GetWidth() == alloc->width) &&
- (win->GetHeight() == alloc->height) &&
- (win->IsSizeSet()))
+ if ((win->m_x == alloc->x) &&
+ (win->m_y == alloc->y) &&
+ (win->m_width == alloc->width) &&
+ (win->m_height == alloc->height) &&
+ (win->m_sizeSet))
{
return;
}
GtkWidget *label_widget = gtk_label_new( s.mbc_str() );
gtk_misc_set_alignment( GTK_MISC(label_widget), 0.0, 0.5 );
- gtk_signal_connect( GTK_OBJECT(child->GetHandle()), "size_allocate",
+ gtk_signal_connect( GTK_OBJECT(child->m_widget), "size_allocate",
GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)child );
- GtkNotebook *notebook = GTK_NOTEBOOK(parent->GetHandle());
+ GtkNotebook *notebook = GTK_NOTEBOOK(parent->m_widget);
- gtk_notebook_append_page( notebook, child->GetHandle(), label_widget );
+ gtk_notebook_append_page( notebook, child->m_widget, label_widget );
child->m_page = (GtkNotebookPage*) (g_list_last(notebook->children)->data);
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!win->HasVMT()) return;
+ if (!win->m_hasVMT) return;
if (gdk_event->count > 0) return;
gtk_draw_shadow( widget->style,
GTK_STATE_NORMAL,
GTK_SHADOW_OUT,
0, 0,
- win->GetWidth(), win->GetHeight() );
+ win->m_width, win->m_height );
if (!win->m_title.IsEmpty() &&
((win->GetWindowStyle() & wxCAPTION) ||
gdk_draw_rectangle( widget->window, gc, TRUE,
x,
3,
- win->GetWidth() - 4 - x,
+ win->m_width - 4 - x,
font->ascent + font->descent+1 );
gdk_gc_set_foreground( gc, &widget->style->white );
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!win->HasVMT()) return;
+ if (!win->m_hasVMT) return;
gtk_draw_shadow( widget->style,
widget->window,
GTK_STATE_NORMAL,
GTK_SHADOW_OUT,
0, 0,
- win->GetWidth(), win->GetHeight() );
+ win->m_width, win->m_height );
if (!win->m_title.IsEmpty() &&
((win->GetWindowStyle() & wxCAPTION) ||
gdk_draw_rectangle( widget->window, gc, TRUE,
x,
3,
- win->GetWidth() - 4 - x,
+ win->m_width - 4 - x,
font->ascent + font->descent+1 );
gdk_gc_set_foreground( gc, &widget->style->white );
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!win->HasVMT()) return FALSE;
+ if (!win->m_hasVMT) return FALSE;
if (g_blockEventsOnDrag) return TRUE;
if (g_blockEventsOnScroll) return TRUE;
win->m_diffX = (int)gdk_event->x;
win->m_diffY = (int)gdk_event->y;
- DrawFrame( widget, 0, 0, win->GetWidth(), win->GetHeight() );
+ DrawFrame( widget, 0, 0, win->m_width, win->m_height );
win->m_oldX = 0;
win->m_oldY = 0;
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!win->HasVMT()) return FALSE;
+ if (!win->m_hasVMT) return FALSE;
if (g_blockEventsOnDrag) return TRUE;
if (g_blockEventsOnScroll) return TRUE;
int x = (int)gdk_event->x;
int y = (int)gdk_event->y;
- DrawFrame( widget, win->m_oldX, win->m_oldY, win->GetWidth(), win->GetHeight() );
+ DrawFrame( widget, win->m_oldX, win->m_oldY, win->m_width, win->m_height );
gdk_pointer_ungrab ( GDK_CURRENT_TIME );
int org_x = 0;
int org_y = 0;
x += org_x - win->m_diffX;
y += org_y - win->m_diffY;
win->InternalSetPosition(x, y);
- gtk_widget_set_uposition( win->GetWidget(), x, y );
+ gtk_widget_set_uposition( win->m_widget, x, y );
return TRUE;
}
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!win->HasVMT()) return FALSE;
+ if (!win->m_hasVMT) return FALSE;
if (g_blockEventsOnDrag) return TRUE;
if (g_blockEventsOnScroll) return TRUE;
gdk_event->state = state;
}
- DrawFrame( widget, win->m_oldX, win->m_oldY, win->GetWidth(), win->GetHeight() );
+ DrawFrame( widget, win->m_oldX, win->m_oldY, win->m_width, win->m_height );
win->m_oldX = (int)gdk_event->x - win->m_diffX;
win->m_oldY = (int)gdk_event->y - win->m_diffY;
- DrawFrame( widget, win->m_oldX, win->m_oldY, win->GetWidth(), win->GetHeight() );
+ DrawFrame( widget, win->m_oldX, win->m_oldY, win->m_width, win->m_height );
return TRUE;
}
{
if (g_isIdle) wxapp_install_idle_handler();
- if ((win->GetX() == alloc->x) &&
- (win->GetY() == alloc->y) &&
- (win->GetWidth() == alloc->width) &&
- (win->GetHeight() == alloc->height))
+ if ((win->m_x == alloc->x) &&
+ (win->m_y == alloc->y) &&
+ (win->m_width == alloc->width) &&
+ (win->m_height == alloc->height))
{
return;
}
if (g_blockEventsOnDrag) return FALSE;
- if (!notebook->HasVMT()) return FALSE;
+ if (!notebook->m_hasVMT) return FALSE;
/* this code makes jumping down from the handles of the notebooks
to the actual items in the visible notebook page possible with
page->m_box = gtk_hbox_new (FALSE, 0);
gtk_container_border_width(GTK_CONTAINER(page->m_box), 2);
- GtkNotebook *notebook = GTK_NOTEBOOK(parent->GetWidget());
+ GtkNotebook *notebook = GTK_NOTEBOOK(parent->m_widget);
page->m_client = child;
- gtk_notebook_append_page( notebook, child->GetWidget(), page->m_box );
+ gtk_notebook_append_page( notebook, child->m_widget, page->m_box );
page->m_page = (GtkNotebookPage*) (g_list_last(notebook->children)->data);
page->m_parent = notebook;
- gtk_signal_connect( GTK_OBJECT(child->GetWidget()), "size_allocate",
+ gtk_signal_connect( GTK_OBJECT(child->m_widget), "size_allocate",
GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)child );
wxASSERT_MSG( page->m_page, _T("Notebook page creation error") );
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!rb->HasVMT()) return;
+ if (!rb->m_hasVMT) return;
if (g_blockEventsOnDrag) return;
if (rb->m_alreadySent)
gtk_signal_connect( GTK_OBJECT(m_radio), "clicked",
GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
- gtk_myfixed_put( GTK_MYFIXED(m_parent->GetWxWindow()),
+ gtk_myfixed_put( GTK_MYFIXED(m_parent->m_wxwindow),
GTK_WIDGET(m_radio),
m_x+10, m_y+10+(i*24), 10, 10 );
}
int len = 22+gdk_string_measure( font, label->label );
if (len > max_len) max_len = len;
- gtk_myfixed_move( GTK_MYFIXED(m_parent->GetWxWindow()), button, m_x+x, m_y+y );
+ gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), button, m_x+x, m_y+y );
y += 20;
node = node->Next();
{
GtkWidget *button = GTK_WIDGET( node->Data() );
- gtk_myfixed_resize( GTK_MYFIXED(m_parent->GetWxWindow()), button, max_len, 20 );
+ gtk_myfixed_resize( GTK_MYFIXED(m_parent->m_wxwindow), button, max_len, 20 );
node = node->Next();
if (!node) break;
{
GtkWidget *button = GTK_WIDGET( node->Data() );
- gtk_myfixed_set_size( GTK_MYFIXED(m_parent->GetWxWindow()), button, m_x+x, m_y+y, max, 20 );
+ gtk_myfixed_set_size( GTK_MYFIXED(m_parent->m_wxwindow), button, m_x+x, m_y+y, max, 20 );
x += max;
node = node->Next();
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!rb->HasVMT()) return;
+ if (!rb->m_hasVMT) return;
if (rb->m_blockFirstEvent)
{
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!win->HasVMT()) return;
+ if (!win->m_hasVMT) return;
if (g_blockEventsOnDrag) return;
float diff = win->m_adjust->value - win->m_oldPos;
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!win->HasVMT()) return;
+ if (!win->m_hasVMT) return;
if (g_blockEventsOnDrag) return;
float diff = win->m_adjust->value - win->m_oldPos;
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!win->HasVMT()) return;
+ if (!win->m_hasVMT) return;
if (g_blockEventsOnDrag) return;
float diff = win->m_adjust->value - win->m_oldPos;
{
if (g_isIdle) wxapp_install_idle_handler();
- if (!win->HasVMT()) return;
+ if (!win->m_hasVMT) return;
win->SetModified();
win->CalculateScrollbar();
- if (!win->HasVMT()) return;
+ if (!win->m_hasVMT) return;
}
//-----------------------------------------------------------------------------
#endif // Debug
//-----------------------------------------------------------------------------
-// local code (see below)
+// idle system
//-----------------------------------------------------------------------------
-static void InitAdjustment(GtkAdjustment *adjust)
-{
- adjust->lower = 0.0;
- adjust->upper = 1.0;
- adjust->value = 0.0;
- adjust->step_increment = 1.0;
- adjust->page_increment = 1.0;
- adjust->page_size = 5.0;
- gtk_signal_emit_by_name( GTK_OBJECT(adjust), "changed" );
-}
+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->HasVMT())
+ if (!win->m_hasVMT)
return;
int dw = 0;
GTK_STATE_NORMAL,
GTK_SHADOW_OUT,
dx, dy,
- win->GetWidth()-dw, win->GetHeight()-dh );
+ win->m_width-dw, win->m_height-dh );
return;
}
GTK_STATE_NORMAL,
GTK_SHADOW_IN,
dx, dy,
- win->GetWidth()-dw, win->GetHeight()-dh );
+ win->m_width-dw, win->m_height-dh );
return;
}
}
static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExpose *gdk_event, wxWindow *win )
{
- if ( !win->HasVMT() )
+ if ( !win->m_hasVMT )
return;
win->GetUpdateRegion().Union( gdk_event->area.x,
static void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle *rect, wxWindow *win )
{
- if ( !win->HasVMT() )
+ if (g_isIdle)
+ wxapp_install_idle_handler();
+
+ if (!win->m_hasVMT)
return;
win->GetUpdateRegion().Union( rect->x, rect->y,
static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxWindow *win )
{
- if (!win->HasVMT()) return FALSE;
+ if (g_isIdle)
+ wxapp_install_idle_handler();
+
+ if (!win->m_hasVMT) return FALSE;
if (g_blockEventsOnDrag) return FALSE;
/*
Damn, I forgot why this didn't work, but it didn't work.
// win is a panel: up can be propagated to the panel
- if ((!ret) && (win->GetWxWindow()) && (win->m_parent) && (win->m_parent->AcceptsFocus()) &&
+ if ((!ret) && (win->m_wxwindow) && (win->m_parent) && (win->m_parent->AcceptsFocus()) &&
(gdk_event->keyval == GDK_Up))
{
win->m_parent->SetFocus();
}
// win is a panel: left/right can be propagated to the panel
- if ((!ret) && (win->GetWxWindow()) &&
+ if ((!ret) && (win->m_wxwindow) &&
((gdk_event->keyval == GDK_Right) || (gdk_event->keyval == GDK_Left) ||
(gdk_event->keyval == GDK_Up) || (gdk_event->keyval == GDK_Down)))
{
static gint gtk_window_key_release_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxWindow *win )
{
- if (!win->HasVMT()) return FALSE;
+ if (g_isIdle)
+ wxapp_install_idle_handler();
+
+ if (!win->m_hasVMT) return FALSE;
if (g_blockEventsOnDrag) return FALSE;
/*
static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
{
- if (!win->HasVMT()) return FALSE;
+ if (g_isIdle)
+ wxapp_install_idle_handler();
+
+/*
+ wxPrintf( _T("1) OnButtonPress from ") );
+ if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
+ wxPrintf( win->GetClassInfo()->GetClassName() );
+ wxPrintf( _T(".\n") );
+*/
+
+ if (!win->m_hasVMT) return FALSE;
if (g_blockEventsOnDrag) return TRUE;
if (g_blockEventsOnScroll) return TRUE;
if (!win->IsOwnGtkWindow( gdk_event->window )) return FALSE;
- if (win->GetWxWindow())
+ if (win->m_wxwindow)
{
- if (GTK_WIDGET_CAN_FOCUS(win->GetWxWindow()) && !GTK_WIDGET_HAS_FOCUS (win->GetWxWindow()) )
+ if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow) && !GTK_WIDGET_HAS_FOCUS (win->m_wxwindow) )
{
- gtk_widget_grab_focus (win->GetWxWindow());
+ gtk_widget_grab_focus (win->m_wxwindow);
/*
- printf( "GrabFocus from " );
+ wxPrintf( _T("GrabFocus from ") );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
- printf( win->GetClassInfo()->GetClassName() );
- printf( ".\n" );
+ wxPrintf( win->GetClassInfo()->GetClassName() );
+ wxPrintf( _T(".\n") );
*/
}
}
/*
- printf( "OnButtonPress from " );
+ wxPrintf( _T("2) OnButtonPress from ") );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
- printf( win->GetClassInfo()->GetClassName() );
- printf( ".\n" );
+ wxPrintf( win->GetClassInfo()->GetClassName() );
+ wxPrintf( _T(".\n") );
*/
wxEventType event_type = wxEVT_LEFT_DOWN;
{
wxWindow *child = (wxWindow*)node->Data();
- if ( child->IsStaticBox() )
+ if (child->m_isStaticBox)
{
// wxStaticBox is transparent in the box itself
- int x = event.m_x,
- y = event.m_y;
-
- wxRect rectChild(child->GetRect());
- int xx1 = rectChild.GetLeft(),
- yy1 = rectChild.GetTop(),
- xx2 = rectChild.GetRight(),
- yy2 = rectChild.GetBottom();
+ int x = event.m_x;
+ int y = event.m_y;
+ int xx1 = child->m_x;
+ int yy1 = child->m_y;
+ int xx2 = child->m_x + child->m_width;
+ int yy2 = child->m_x + child->m_height;
// left
if (((x >= xx1) && (x <= xx1+10) && (y >= yy1) && (y <= yy2)) ||
((x >= xx1) && (x <= xx2) && (y >= yy2-1) && (y <= yy2)))
{
win = child;
- event.m_x -= child->GetX();
- event.m_y -= child->GetY();
+ event.m_x -= child->m_x;
+ event.m_y -= child->m_y;
break;
}
}
else
{
- if ((child->GetWxWindow() == (GtkWidget*) NULL) &&
- (child->GetX() <= event.m_x) &&
- (child->GetY() <= event.m_y) &&
- (child->GetX()+child->GetWidth() >= event.m_x) &&
- (child->GetY()+child->GetHeight() >= event.m_y))
+ if ((child->m_wxwindow == (GtkWidget*) NULL) &&
+ (child->m_x <= event.m_x) &&
+ (child->m_y <= event.m_y) &&
+ (child->m_x+child->m_width >= event.m_x) &&
+ (child->m_y+child->m_height >= event.m_y))
{
win = child;
- event.m_x -= child->GetX();
- event.m_y -= child->GetY();
+ event.m_x -= child->m_x;
+ event.m_y -= child->m_y;
break;
}
}
static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
{
- if (!win->HasVMT()) return FALSE;
+ if (g_isIdle)
+ wxapp_install_idle_handler();
+
+ if (!win->m_hasVMT) return FALSE;
if (g_blockEventsOnDrag) return FALSE;
if (g_blockEventsOnScroll) return FALSE;
{
wxWindow *child = (wxWindow*)node->Data();
- if (child->IsStaticBox() )
+ if (child->m_isStaticBox)
{
// wxStaticBox is transparent in the box itself
int x = event.m_x;
int y = event.m_y;
- int xx1 = child->GetX();
- int yy1 = child->GetY();
- int xx2 = child->GetX() + child->GetWidth();
- int yy2 = child->GetX() + child->GetHeight();
+ int xx1 = child->m_x;
+ int yy1 = child->m_y;
+ int xx2 = child->m_x + child->m_width;
+ int yy2 = child->m_x + child->m_height;
// left
if (((x >= xx1) && (x <= xx1+10) && (y >= yy1) && (y <= yy2)) ||
((x >= xx1) && (x <= xx2) && (y >= yy2-1) && (y <= yy2)))
{
win = child;
- event.m_x -= child->GetX();
- event.m_y -= child->GetY();
+ event.m_x -= child->m_x;
+ event.m_y -= child->m_y;
break;
}
}
else
{
- if ((child->GetWxWindow() == (GtkWidget*) NULL) &&
- (child->GetX() <= event.m_x) &&
- (child->GetY() <= event.m_y) &&
- (child->GetX()+child->GetWidth() >= event.m_x) &&
- (child->GetY()+child->GetHeight() >= event.m_y))
+ if ((child->m_wxwindow == (GtkWidget*) NULL) &&
+ (child->m_x <= event.m_x) &&
+ (child->m_y <= event.m_y) &&
+ (child->m_x+child->m_width >= event.m_x) &&
+ (child->m_y+child->m_height >= event.m_y))
{
win = child;
- event.m_x -= child->GetX();
- event.m_y -= child->GetY();
+ event.m_x -= child->m_x;
+ event.m_y -= child->m_y;
break;
}
}
static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxWindow *win )
{
- if (!win->HasVMT()) return FALSE;
+ if (g_isIdle)
+ wxapp_install_idle_handler();
+
+ if (!win->m_hasVMT) return FALSE;
if (g_blockEventsOnDrag) return FALSE;
if (g_blockEventsOnScroll) return FALSE;
{
wxWindow *child = (wxWindow*)node->Data();
- if ( child->IsStaticBox() )
+ if (child->m_isStaticBox)
{
// wxStaticBox is transparent in the box itself
int x = event.m_x;
int y = event.m_y;
- int xx1 = child->GetX();
- int yy1 = child->GetY();
- int xx2 = child->GetX() + child->GetWidth();
- int yy2 = child->GetX() + child->GetHeight();
+ int xx1 = child->m_x;
+ int yy1 = child->m_y;
+ int xx2 = child->m_x + child->m_width;
+ int yy2 = child->m_x + child->m_height;
// left
if (((x >= xx1) && (x <= xx1+10) && (y >= yy1) && (y <= yy2)) ||
((x >= xx1) && (x <= xx2) && (y >= yy2-1) && (y <= yy2)))
{
win = child;
- event.m_x -= child->GetX();
- event.m_y -= child->GetY();
+ event.m_x -= child->m_x;
+ event.m_y -= child->m_y;
break;
}
}
else
{
- if ((child->GetWxWindow() == (GtkWidget*) NULL) &&
- (child->GetX() <= event.m_x) &&
- (child->GetY() <= event.m_y) &&
- (child->GetX()+child->GetWidth() >= event.m_x) &&
- (child->GetY()+child->GetHeight() >= event.m_y))
+ if ((child->m_wxwindow == (GtkWidget*) NULL) &&
+ (child->m_x <= event.m_x) &&
+ (child->m_y <= event.m_y) &&
+ (child->m_x+child->m_width >= event.m_x) &&
+ (child->m_y+child->m_height >= event.m_y))
{
win = child;
- event.m_x -= child->GetX();
- event.m_y -= child->GetY();
+ event.m_x -= child->m_x;
+ event.m_y -= child->m_y;
break;
}
}
static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win )
{
- if (!win->HasVMT()) return FALSE;
+ if (g_isIdle)
+ wxapp_install_idle_handler();
+
+ if (!win->m_hasVMT) return FALSE;
if (g_blockEventsOnDrag) return FALSE;
g_focusWindow = win;
- if (win->GetWxWindow())
+ if (win->m_wxwindow)
{
- if (GTK_WIDGET_CAN_FOCUS(win->GetWxWindow()))
+ if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow))
{
- GTK_WIDGET_SET_FLAGS (win->GetWxWindow(), GTK_HAS_FOCUS);
+ GTK_WIDGET_SET_FLAGS (win->m_wxwindow, GTK_HAS_FOCUS);
/*
printf( "SetFocus flag from " );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win )
{
- if (!win->HasVMT()) return FALSE;
+ if (g_isIdle)
+ wxapp_install_idle_handler();
+
+ if (!win->m_hasVMT) return FALSE;
if (g_blockEventsOnDrag) return FALSE;
- if (win->GetWxWindow())
+ if (win->m_wxwindow)
{
- if (GTK_WIDGET_CAN_FOCUS(win->GetWxWindow()))
- GTK_WIDGET_UNSET_FLAGS (win->GetWxWindow(), GTK_HAS_FOCUS);
+ if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow))
+ GTK_WIDGET_UNSET_FLAGS (win->m_wxwindow, GTK_HAS_FOCUS);
}
/*
static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
{
- if ( !win->HasVMT() || g_blockEventsOnDrag )
- return FALSE;
+ if (g_isIdle)
+ wxapp_install_idle_handler();
- GdkWindow *window = widget->window;
- if ( window != gdk_event->window )
- return FALSE;
+ if (!win->m_hasVMT) return FALSE;
+ if (g_blockEventsOnDrag) return FALSE;
- if ( window && win->GetCursor().Ok() )
- gdk_window_set_cursor( window, win->GetCursor().GetCursor() );
+ if (!win->IsOwnGtkWindow( gdk_event->window )) return FALSE;
-/*
- printf( "OnEnter from " );
- if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
- printf( win->GetClassInfo()->GetClassName() );
- printf( ".\n" );
-*/
+ if (widget->window && win->GetCursor().Ok() )
+ gdk_window_set_cursor( widget->window, win->GetCursor().GetCursor() );
wxMouseEvent event( wxEVT_ENTER_WINDOW );
event.SetEventObject( win );
int y = 0;
GdkModifierType state = (GdkModifierType)0;
- gdk_window_get_pointer( window, &x, &y, &state );
+ gdk_window_get_pointer( widget->window, &x, &y, &state );
event.m_shiftDown = (state & GDK_SHIFT_MASK);
event.m_controlDown = (state & GDK_CONTROL_MASK);
static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
{
- if ( !win->HasVMT() || g_blockEventsOnDrag )
- return FALSE;
+ if (g_isIdle)
+ wxapp_install_idle_handler();
- GdkWindow *window = widget->window;
- if ( window != gdk_event->window )
- return FALSE;
-
- if ( window && win->GetCursor().Ok() )
- gdk_window_set_cursor( window, wxSTANDARD_CURSOR->GetCursor() );
+ if (!win->m_hasVMT) return FALSE;
+ if (g_blockEventsOnDrag) return FALSE;
-/*
- printf( "OnLeave from " );
- if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
- printf( win->GetClassInfo()->GetClassName() );
- printf( ".\n" );
-*/
+ if (!win->IsOwnGtkWindow( gdk_event->window )) return FALSE;
+
+ if (widget->window && win->GetCursor().Ok() )
+ gdk_window_set_cursor( widget->window, wxSTANDARD_CURSOR->GetCursor() );
wxMouseEvent event( wxEVT_LEAVE_WINDOW );
event.SetEventObject( win );
static void gtk_window_vscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow *win )
{
- if (g_blockEventsOnDrag) return;
+ if (g_isIdle)
+ wxapp_install_idle_handler();
-/*
- printf( "OnVScroll from " );
- if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
- printf( win->GetClassInfo()->GetClassName() );
- printf( ".\n" );
-*/
+ if (g_blockEventsOnDrag) return;
- if (!win->HasVMT()) return;
+ if (!win->m_hasVMT) return;
- float diff = win->GetVAdjust()->value - win->GetOldVerticalPos();
+ float diff = win->m_vAdjust->value - win->m_oldVerticalPos;
if (fabs(diff) < 0.2) return;
- win->SetOldVerticalPos(win->GetVAdjust()->value);
+ win->m_oldVerticalPos = win->m_vAdjust->value;
wxEventType command = wxEVT_NULL;
- float line_step = win->GetVAdjust()->step_increment;
- float page_step = win->GetVAdjust()->page_increment;
+ float line_step = win->m_vAdjust->step_increment;
+ float page_step = win->m_vAdjust->page_increment;
if (win->IsScrolling())
{
}
else
{
- if (fabs(win->GetVAdjust()->value-win->GetVAdjust()->lower) < 0.2) command = wxEVT_SCROLL_BOTTOM;
- else if (fabs(win->GetVAdjust()->value-win->GetVAdjust()->upper) < 0.2) command = wxEVT_SCROLL_TOP;
+ if (fabs(win->m_vAdjust->value-win->m_vAdjust->lower) < 0.2) command = wxEVT_SCROLL_BOTTOM;
+ else if (fabs(win->m_vAdjust->value-win->m_vAdjust->upper) < 0.2) command = wxEVT_SCROLL_TOP;
else if (fabs(diff-line_step) < 0.2) command = wxEVT_SCROLL_LINEDOWN;
else if (fabs(diff+line_step) < 0.2) command = wxEVT_SCROLL_LINEUP;
else if (fabs(diff-page_step) < 0.2) command = wxEVT_SCROLL_PAGEDOWN;
else command = wxEVT_SCROLL_THUMBTRACK;
}
- int value = (int)(win->GetVAdjust()->value+0.5);
+ int value = (int)(win->m_vAdjust->value+0.5);
wxScrollEvent event( command, win->GetId(), value, wxVERTICAL );
event.SetEventObject( win );
static void gtk_window_hscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow *win )
{
- if (g_blockEventsOnDrag) return;
-
-/*
- printf( "OnHScroll from " );
- if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
- printf( win->GetClassInfo()->GetClassName() );
- printf( ".\n" );
-*/
+ if (g_isIdle)
+ wxapp_install_idle_handler();
- if (!win->HasVMT()) return;
+ if (g_blockEventsOnDrag) return;
+ if (!win->m_hasVMT) return;
- float diff = win->GetHAdjust()->value - win->GetOldHorizontalPos();
+ float diff = win->m_hAdjust->value - win->m_oldHorizontalPos;
if (fabs(diff) < 0.2) return;
- win->SetOldHorizontalPos( win->GetHAdjust()->value );
+ win->m_oldHorizontalPos = win->m_hAdjust->value;
wxEventType command = wxEVT_NULL;
- float line_step = win->GetHAdjust()->step_increment;
- float page_step = win->GetHAdjust()->page_increment;
+ float line_step = win->m_hAdjust->step_increment;
+ float page_step = win->m_hAdjust->page_increment;
if (win->IsScrolling())
{
}
else
{
- if (fabs(win->GetHAdjust()->value-win->GetHAdjust()->lower) < 0.2) command = wxEVT_SCROLL_BOTTOM;
- else if (fabs(win->GetHAdjust()->value-win->GetHAdjust()->upper) < 0.2) command = wxEVT_SCROLL_TOP;
+ if (fabs(win->m_hAdjust->value-win->m_hAdjust->lower) < 0.2) command = wxEVT_SCROLL_BOTTOM;
+ else if (fabs(win->m_hAdjust->value-win->m_hAdjust->upper) < 0.2) command = wxEVT_SCROLL_TOP;
else if (fabs(diff-line_step) < 0.2) command = wxEVT_SCROLL_LINEDOWN;
else if (fabs(diff+line_step) < 0.2) command = wxEVT_SCROLL_LINEUP;
else if (fabs(diff-page_step) < 0.2) command = wxEVT_SCROLL_PAGEDOWN;
else command = wxEVT_SCROLL_THUMBTRACK;
}
- int value = (int)(win->GetHAdjust()->value+0.5);
+ int value = (int)(win->m_hAdjust->value+0.5);
wxScrollEvent event( command, win->GetId(), value, wxHORIZONTAL );
event.SetEventObject( win );
static void gtk_window_vscroll_change_callback( GtkWidget *WXUNUSED(widget), wxWindow *win )
{
- if (g_blockEventsOnDrag) return;
+ if (g_isIdle)
+ wxapp_install_idle_handler();
-/*
- printf( "OnVScroll change from " );
- if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
- printf( win->GetClassInfo()->GetClassName() );
- printf( ".\n" );
-*/
-
- if (!win->HasVMT()) return;
+ if (g_blockEventsOnDrag) return;
+ if (!win->m_hasVMT) return;
wxEventType command = wxEVT_SCROLL_THUMBTRACK;
- int value = (int)(win->GetVAdjust()->value+0.5);
+ int value = (int)(win->m_vAdjust->value+0.5);
wxScrollEvent event( command, win->GetId(), value, wxVERTICAL );
event.SetEventObject( win );
static void gtk_window_hscroll_change_callback( GtkWidget *WXUNUSED(widget), wxWindow *win )
{
- if (g_blockEventsOnDrag) return;
-
-/*
- printf( "OnHScroll change from " );
- if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
- printf( win->GetClassInfo()->GetClassName() );
- printf( ".\n" );
-*/
+ if (g_isIdle)
+ wxapp_install_idle_handler();
- if (!win->HasVMT()) return;
+ if (g_blockEventsOnDrag) return;
+ if (!win->m_hasVMT) return;
wxEventType command = wxEVT_SCROLL_THUMBTRACK;
- int value = (int)(win->GetHAdjust()->value+0.5);
+ int value = (int)(win->m_hAdjust->value+0.5);
wxScrollEvent event( command, win->GetId(), value, wxHORIZONTAL );
event.SetEventObject( win );
GdkEventButton *WXUNUSED(gdk_event),
wxWindow *win )
{
+ if (g_isIdle)
+ wxapp_install_idle_handler();
+
// don't test here as we can release the mouse while being over
// a different window then the slider
//
//
// if (gdk_event->window != widget->slider) return FALSE;
- GtkScrolledWindow *scrolledWindow = GTK_SCROLLED_WINDOW(win->GetHandle());
+ GtkScrolledWindow *scrolledWindow = GTK_SCROLLED_WINDOW(win->m_widget);
if (widget == GTK_RANGE(scrolledWindow->vscrollbar))
- gtk_signal_emit_by_name( GTK_OBJECT(win->GetHAdjust()), "value_changed" );
+ gtk_signal_emit_by_name( GTK_OBJECT(win->m_hAdjust), "value_changed" );
else
- gtk_signal_emit_by_name( GTK_OBJECT(win->GetVAdjust()), "value_changed" );
+ gtk_signal_emit_by_name( GTK_OBJECT(win->m_vAdjust), "value_changed" );
win->SetScrolling( FALSE );
return g_focusWindow;
}
+//-----------------------------------------------------------------------------
+// "realize" from m_widget
+//-----------------------------------------------------------------------------
+
+/* we cannot set colours, fonts and cursors before the widget has
+ been realized, so we do this directly after realization */
+
+static gint
+gtk_window_realized_callback( GtkWidget *widget, wxWindow *win )
+{
+ if (g_isIdle)
+ wxapp_install_idle_handler();
+
+ if (win->m_font != *wxSWISS_FONT)
+ {
+ wxFont font( win->m_font );
+ win->m_font = wxNullFont;
+ win->SetFont( font );
+ }
+
+ if (win->m_backgroundColour != wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE ))
+ {
+ wxColour bg( win->m_backgroundColour );
+ win->m_backgroundColour = wxNullColour;
+ win->SetBackgroundColour( bg );
+ }
+
+ if (win->m_foregroundColour != *wxBLACK)
+ {
+ wxColour fg( win->m_foregroundColour );
+ win->m_foregroundColour = wxNullColour;
+ win->SetForegroundColour( fg );
+ }
+
+ wxCursor cursor( win->m_cursor );
+ win->m_cursor = wxNullCursor;
+ win->SetCursor( cursor );
+
+ return FALSE;
+}
+
//-----------------------------------------------------------------------------
// InsertChild for wxWindow.
//-----------------------------------------------------------------------------
static void wxInsertChildInWindow( wxWindow* parent, wxWindow* child )
{
- gtk_myfixed_put( GTK_MYFIXED(parent->GetWxWindow()),
- GTK_WIDGET(child->GetHandle()),
- child->GetX(),
- child->GetY(),
- child->GetWidth(),
- child->GetHeight() );
-
- gtk_widget_set_usize( GTK_WIDGET(child->GetHandle()),
- child->GetWidth(),
- child->GetHeight() );
+ gtk_myfixed_put( GTK_MYFIXED(parent->m_wxwindow),
+ GTK_WIDGET(child->m_widget),
+ child->m_x,
+ child->m_y,
+ child->m_width,
+ child->m_height );
if (parent->HasFlag(wxTAB_TRAVERSAL))
{
/* we now allow a window to get the focus as long as it
doesn't have any children. */
- GTK_WIDGET_UNSET_FLAGS( parent->GetWxWindow(), GTK_CAN_FOCUS );
+ GTK_WIDGET_UNSET_FLAGS( parent->m_wxwindow, GTK_CAN_FOCUS );
}
}
InitBase();
// GTK specific
+ m_widget = (GtkWidget *) NULL;
m_wxwindow = (GtkWidget *) NULL;
// position/size
- m_x =
- m_y =
- m_width =
+ m_x = 0;
+ m_y = 0;
+ m_width = 0;
m_height = 0;
m_font = *wxSWISS_FONT;
m_hasVMT = FALSE;
m_needParent = TRUE;
- m_hasScrolling =
+ m_hasScrolling = FALSE;
m_isScrolling = FALSE;
- m_hAdjust =
+ m_hAdjust = (GtkAdjustment*) NULL;
m_vAdjust = (GtkAdjustment*) NULL;
- m_oldHorizontalPos =
+ m_oldHorizontalPos = 0.0;
m_oldVerticalPos = 0.0;
m_resizing = FALSE;
#endif // GTK_MINOR_VERSION == 0
// I _really_ don't want scrollbars in the beginning
- InitAdjustment(m_vAdjust);
- InitAdjustment(m_hAdjust);
+ m_vAdjust->lower = 0.0;
+ m_vAdjust->upper = 1.0;
+ m_vAdjust->value = 0.0;
+ m_vAdjust->step_increment = 1.0;
+ m_vAdjust->page_increment = 1.0;
+ m_vAdjust->page_size = 5.0;
+ gtk_signal_emit_by_name( GTK_OBJECT(m_vAdjust), "changed" );
+ m_hAdjust->lower = 0.0;
+ m_hAdjust->upper = 1.0;
+ m_hAdjust->value = 0.0;
+ m_hAdjust->step_increment = 1.0;
+ m_hAdjust->page_increment = 1.0;
+ m_hAdjust->page_size = 5.0;
+ gtk_signal_emit_by_name( GTK_OBJECT(m_hAdjust), "changed" );
// these handlers block mouse events to any window during scrolling such as
// motion events and prevent GTK and wxWindows from fighting over where the
if (m_widget)
Show( FALSE );
+ DestroyChildren();
+
if (m_parent)
m_parent->RemoveChild( this );
if (m_widgetStyle)
+ {
gtk_style_unref( m_widgetStyle );
+ m_widgetStyle = (GtkStyle*) NULL;
+ }
if (m_scrollGC)
+ {
gdk_gc_unref( m_scrollGC );
+ m_scrollGC = (GdkGC*) NULL;
+ }
if (m_wxwindow)
+ {
gtk_widget_destroy( m_wxwindow );
+ m_wxwindow = (GtkWidget*) NULL;
+ }
if (m_widget)
+ {
gtk_widget_destroy( m_widget );
+ m_widget = (GtkWidget*) NULL;
+ }
}
void wxWindow::PreCreation( wxWindow *parent,
#endif
}
- ConnectWidget( GetConnectWidget() );
-
- /* we force the creation of wxFrame and wxDialog in the respective code */
- if (m_parent)
- gtk_widget_realize( m_widget );
+ GtkWidget *connect_widget = GetConnectWidget();
- if (m_wxwindow)
- gtk_widget_realize( m_wxwindow );
+ ConnectWidget( connect_widget );
- SetCursor( *wxSTANDARD_CURSOR );
+ /* we cannot set colours, fonts and cursors before the widget has
+ been realized, so we do this directly after realization */
+ gtk_signal_connect( GTK_OBJECT(connect_widget), "realize",
+ GTK_SIGNAL_FUNC(gtk_window_realized_callback), (gpointer) this );
m_hasVMT = TRUE;
}
if (m_resizing) return; /* I don't like recursions */
m_resizing = TRUE;
- if (m_parent->GetWxWindow() == NULL) /* i.e. wxNotebook */
+ if (m_parent->m_wxwindow == NULL) /* i.e. wxNotebook */
{
/* don't set the size for children of wxNotebook, just take the values. */
m_x = x;
}
else
{
- int old_width = m_width;
- int old_height = m_height;
-
if ((sizeFlags & wxSIZE_USE_EXISTING) == wxSIZE_USE_EXISTING)
{
if (x != -1) m_x = x;
if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_maxWidth;
if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight;
- if (GTK_WIDGET_HAS_DEFAULT(m_widget))
- {
- /* the default button has a border around it */
- int border = 5;
-
- gtk_myfixed_move( GTK_MYFIXED(m_parent->GetWxWindow()), m_widget, m_x-border, m_y-border );
-
- gtk_widget_set_usize( m_widget, m_width+2*border, m_height+2*border );
- }
- else
- {
- gtk_myfixed_move( GTK_MYFIXED(m_parent->GetWxWindow()), m_widget, m_x, m_y );
+ int border = 0;
- if ((old_width != m_width) || (old_height != m_height))
- gtk_widget_set_usize( m_widget, m_width, m_height );
- }
+ if (GTK_WIDGET_HAS_DEFAULT(m_widget))
+ {
+ /* the default button has a border around it */
+ border = 5;
+ }
+
+ /* this is the result of hours of debugging: the following code
+ means that if we have a m_wxwindow and we set the size of
+ m_widget, m_widget (which is a GtkScrolledWindow) does NOT
+ automatically propagate its size down to its m_wxwindow,
+ which is its client area. therefore, we have to tell the
+ client area directly that it has to resize itself.
+ this will lead to that m_widget (GtkScrolledWindow) will
+ calculate how much size it needs for scrollbars etc and
+ it will then call XXX_size_allocate of its child, which
+ is m_wxwindow. m_wxwindow in turn will do the same with its
+ children and so on. problems can arise if this happens
+ before all the children have been realized as some widgets
+ stupidy need to be realized during XXX_size_allocate (e.g.
+ GtkNotebook) and they will segv if called otherwise. this
+ emergency is tested in gtk_myfixed_size_allocate. Normally
+ this shouldn't be needed and only gtk_widget_queue_resize()
+ should be enough to provoke a resize at the next appropriate
+ moment, but this seems to fail, e.g. when a wxNotebook contains
+ a wxSplitterWindow: the splitter window's children won't
+ show up properly resized then. */
+
+ gtk_myfixed_set_size( GTK_MYFIXED(m_parent->m_wxwindow),
+ m_widget,
+ m_x-border,
+ m_y-border,
+ m_width+2*border,
+ m_height+2*border );
}
m_sizeSet = TRUE;
{
wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
+ if (!m_widget->window) return;
+
GdkWindow *source = (GdkWindow *) NULL;
if (m_wxwindow)
source = m_wxwindow->window;
{
wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
+ if (!m_widget->window) return;
+
GdkWindow *source = (GdkWindow *) NULL;
if (m_wxwindow)
source = m_wxwindow->window;
{
wxCHECK_MSG( (m_widget != NULL), (wxWindow*) NULL, _T("invalid window") );
+ gtk_widget_unparent( m_widget );
+
if ( !wxWindowBase::Reparent(newParent) )
return FALSE;
- gtk_widget_unparent( m_widget );
-
return TRUE;
}
{
wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
+ if (!m_widget->window) return;
+
gdk_window_raise( m_widget->window );
}
{
wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
+ if (!m_widget->window) return;
+
gdk_window_lower( m_widget->window );
}
if ( wxWindowBase::SetCursor(cursor) )
{
+ if (!m_widget->window) return TRUE;
+
if ((m_widget) && (m_widget->window))
gdk_window_set_cursor( m_widget->window, GetCursor().GetCursor() );
{
wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
+ if (!m_widget->window) return;
+
if (eraseBackground && m_wxwindow && m_wxwindow->window)
{
if (rect)
{
wxCHECK_RET( m_widget != NULL, _T("invalid window") );
+ if (!m_widget->window) return;
+
if (m_wxwindow && m_wxwindow->window)
{
gdk_window_clear( m_wxwindow->window );
{
wxCHECK_MSG( m_widget != NULL, FALSE, _T("invalid window") );
- if ( !wxWindowBase::SetBackgroundColour(colour) )
- return FALSE;
+ if (!colour.Ok()) return FALSE;
+ if (m_backgroundColour == colour) return FALSE;
+
+ GtkWidget *connect_widget = GetConnectWidget();
+ if (!connect_widget->window) return TRUE;
if (m_wxwindow && m_wxwindow->window)
{
- // wxMSW doesn't clear the window here. I don't do that either to
- // provide compatibility. call Clear() to do the job.
+ /* 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() );
{
wxCHECK_MSG( m_widget != NULL, FALSE, _T("invalid window") );
- if ( !wxWindowBase::SetForegroundColour(colour) )
- return FALSE;
+ if (!colour.Ok()) return FALSE;
+ if (m_backgroundColour == colour) return FALSE;
+
+ GtkWidget *connect_widget = GetConnectWidget();
+ if (!connect_widget->window) return TRUE;
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
if ( sysbg == m_foregroundColour )
bool wxWindow::SetFont( const wxFont &font )
{
- wxCHECK_MSG( m_widget != NULL, FALSE, _T("invalid window") );
+ wxCHECK_MSG( m_widget != NULL, FALSE, _T( "invalid window") );
- if ( !wxWindowBase::SetFont(font) )
- {
- // nothing to do
- return FALSE;
- }
+ if (!font.Ok()) return FALSE;
+ if (m_font == font) return FALSE;
+
+ GtkWidget *connect_widget = GetConnectWidget();
+ if (!connect_widget->window) return TRUE;
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
if ( sysbg == m_backgroundColour )
wxCHECK_RET( g_capturing == FALSE, _T("CaptureMouse called twice") );
GtkWidget *connect_widget = GetConnectWidget();
+ if (!connect_widget->window) return;
+
gtk_grab_add( connect_widget );
gdk_pointer_grab( connect_widget->window, FALSE,
(GdkEventMask)
wxCHECK_RET( g_capturing == TRUE, _T("ReleaseMouse called twice") );
GtkWidget *connect_widget = GetConnectWidget();
+ if (!connect_widget->window) return;
+
gtk_grab_remove( connect_widget );
gdk_pointer_ungrab ( GDK_CURRENT_TIME );
g_capturing = FALSE;
wxCHECK_RET( m_wxwindow != NULL, _T("window needs client area for scrolling") );
- wxNode *node = m_children.First();
- while (node)
+ if (!m_scrollGC)
{
- wxWindow *child = (wxWindow*) node->Data();
- child->Move( child->GetX() + dx, child->GetY() + dy );
- node = node->Next();
+ m_scrollGC = gdk_gc_new( m_wxwindow->window );
+ gdk_gc_set_exposures( m_scrollGC, TRUE );
}
int cw = 0;
int ch = 0;
GetClientSize( &cw, &ch );
-
int w = cw - abs(dx);
int h = ch - abs(dy);
+
if ((h < 0) || (w < 0))
{
Refresh();
- return;
}
- int s_x = 0;
- int s_y = 0;
- if (dx < 0) s_x = -dx;
- if (dy < 0) s_y = -dy;
- int d_x = 0;
- int d_y = 0;
- if (dx > 0) d_x = dx;
- if (dy > 0) d_y = dy;
-
- if (!m_scrollGC)
+ else
{
- m_scrollGC = gdk_gc_new( m_wxwindow->window );
- gdk_gc_set_exposures( m_scrollGC, TRUE );
- }
+ int s_x = 0;
+ int s_y = 0;
+ if (dx < 0) s_x = -dx;
+ if (dy < 0) s_y = -dy;
+ int d_x = 0;
+ int d_y = 0;
+ if (dx > 0) d_x = dx;
+ if (dy > 0) d_y = dy;
- gdk_window_copy_area( m_wxwindow->window, m_scrollGC, d_x, d_y,
- m_wxwindow->window, s_x, s_y, w, h );
+ gdk_window_copy_area( m_wxwindow->window, m_scrollGC, d_x, d_y,
+ m_wxwindow->window, s_x, s_y, w, h );
- wxRect rect;
- if (dx < 0) rect.x = cw+dx; else rect.x = 0;
- if (dy < 0) rect.y = ch+dy; else rect.y = 0;
- if (dy != 0) rect.width = cw; else rect.width = abs(dx);
- if (dx != 0) rect.height = ch; else rect.height = abs(dy);
+ wxRect rect;
+ if (dx < 0) rect.x = cw+dx; else rect.x = 0;
+ if (dy < 0) rect.y = ch+dy; else rect.y = 0;
+ if (dy != 0) rect.width = cw; else rect.width = abs(dx);
+ if (dx != 0) rect.height = ch; else rect.height = abs(dy);
- Refresh( TRUE, &rect );
+ Refresh( TRUE, &rect );
+ }
+
+ wxNode *node = m_children.First();
+ while (node)
+ {
+ wxWindow *child = (wxWindow*) node->Data();
+ child->Move( child->m_x + dx, child->m_y + dy );
+ node = node->Next();
+ }
}
void wxWindow::SetScrolling(bool scroll)