void OnAbout( wxCommandEvent &event );
void OnQuit( wxCommandEvent &event );
+ void OnDeleteAll( wxCommandEvent &event );
+ void OnInsertNew( wxCommandEvent &event );
MyCanvas *m_canvas;
wxTextCtrl *m_log;
const int ID_QUIT = 108;
const int ID_ABOUT = 109;
+const int ID_DELETE_ALL = 110;
+const int ID_INSERT_NEW = 111;
IMPLEMENT_DYNAMIC_CLASS( MyFrame, wxFrame )
BEGIN_EVENT_TABLE(MyFrame,wxFrame)
+ EVT_MENU (ID_DELETE_ALL, MyFrame::OnDeleteAll)
+ EVT_MENU (ID_INSERT_NEW, MyFrame::OnInsertNew)
EVT_MENU (ID_ABOUT, MyFrame::OnAbout)
EVT_MENU (ID_QUIT, MyFrame::OnQuit)
END_EVENT_TABLE()
wxPoint(20,20), wxSize(470,500) )
{
wxMenu *file_menu = new wxMenu();
+ file_menu->Append( ID_DELETE_ALL, "Delete all");
+ file_menu->Append( ID_INSERT_NEW, "Insert new");
file_menu->Append( ID_ABOUT, "&About..");
file_menu->Append( ID_QUIT, "E&xit\tAlt-X");
SetSizer( topsizer );
}
+void MyFrame::OnDeleteAll( wxCommandEvent &WXUNUSED(event) )
+{
+ m_canvas->DestroyChildren();
+}
+
+void MyFrame::OnInsertNew( wxCommandEvent &WXUNUSED(event) )
+{
+ (void)new wxButton( m_canvas, -1, "Hello", wxPoint(100,100) );
+}
+
void MyFrame::OnQuit( wxCommandEvent &WXUNUSED(event) )
{
Close( TRUE );
int top, bottom, left, right;
+#ifndef __WXGTK__
if (reg.IsEmpty())
{
int cw, ch;
CalcUnscrolledPosition( x, y, &left, &top );
CalcUnscrolledPosition( x + w, y + h, &right, &bottom );
}
+#else
+ int cw, ch;
+ m_gridWin->GetClientSize(&cw, &ch);
+ CalcUnscrolledPosition( 0, 0, &left, &top );
+ CalcUnscrolledPosition( cw, ch, &right, &bottom );
+#endif
// avoid drawing grid lines past the last row and col
//
pizza->height = 20;
pizza->bin_window = NULL;
+
+ pizza->xoffset = 0;
+ pizza->yoffset = 0;
pizza->configure_serial = 0;
pizza->scroll_x = 0;
wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
wxCHECK_RET( m_wxwindow != NULL, wxT("window needs client area for scrolling") );
+
+ if ((dx == 0) && (dy == 0)) return;
gtk_pizza_scroll( GTK_PIZZA(m_wxwindow), -dx, -dy );
+
+/*
+ if (m_children.GetCount() > 0)
+ {
+ gtk_pizza_scroll( GTK_PIZZA(m_wxwindow), -dx, -dy );
+ }
+ else
+ {
+ GtkPizza *pizza = GTK_PIZZA(m_wxwindow);
+
+ pizza->xoffset -= dx;
+ pizza->yoffset -= dy;
+
+ GdkGC *m_scrollGC = gdk_gc_new( pizza->bin_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();
+ }
+ else
+ {
+ 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( pizza->bin_window, m_scrollGC, d_x, d_y,
+ pizza->bin_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);
+
+ Refresh( TRUE, &rect );
+ }
+
+ gdk_gc_unref( m_scrollGC );
+ }
+*/
}
pizza->height = 20;
pizza->bin_window = NULL;
+
+ pizza->xoffset = 0;
+ pizza->yoffset = 0;
pizza->configure_serial = 0;
pizza->scroll_x = 0;
wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
wxCHECK_RET( m_wxwindow != NULL, wxT("window needs client area for scrolling") );
+
+ if ((dx == 0) && (dy == 0)) return;
gtk_pizza_scroll( GTK_PIZZA(m_wxwindow), -dx, -dy );
+
+/*
+ if (m_children.GetCount() > 0)
+ {
+ gtk_pizza_scroll( GTK_PIZZA(m_wxwindow), -dx, -dy );
+ }
+ else
+ {
+ GtkPizza *pizza = GTK_PIZZA(m_wxwindow);
+
+ pizza->xoffset -= dx;
+ pizza->yoffset -= dy;
+
+ GdkGC *m_scrollGC = gdk_gc_new( pizza->bin_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();
+ }
+ else
+ {
+ 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( pizza->bin_window, m_scrollGC, d_x, d_y,
+ pizza->bin_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);
+
+ Refresh( TRUE, &rect );
+ }
+
+ gdk_gc_unref( m_scrollGC );
+ }
+*/
}