virtual void OnSelectCellImplementation(wxDC *dc, int row, int col);
virtual void OnSelectCell(int WXUNUSED(row), int WXUNUSED(col)) {};
- virtual void _OnSelectCell(wxGridEvent& event);
+ void _OnSelectCell(wxGridEvent& event);
// Override to create your own class of grid cell
virtual wxGridCell *OnCreateCell(void);
- virtual void _OnCreateCell(wxGridEvent& event);
+ void _OnCreateCell(wxGridEvent& event);
// Override to change labels e.g. creation of grid, inserting/deleting a row/col.
// By default, auto-labels the grid.
virtual void OnChangeLabels(void);
- virtual void _OnChangeLabels(wxGridEvent& event);
+ void _OnChangeLabels(wxGridEvent& event);
// Override to change the label of the edit field when selecting a cell
// By default, sets it to e.g. A12
virtual void OnChangeSelectionLabel(void);
- virtual void _OnChangeSelectionLabel(wxGridEvent& event);
+ void _OnChangeSelectionLabel(wxGridEvent& event);
// Override for event processing
virtual void OnCellChange(int WXUNUSED(row), int WXUNUSED(col)) {};
virtual void OnLabelLeftClick(int WXUNUSED(row), int WXUNUSED(col), int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(control), bool WXUNUSED(shift)) {};
virtual void OnLabelRightClick(int WXUNUSED(row), int WXUNUSED(col), int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(control), bool WXUNUSED(shift)) {};
- virtual void _OnCellChange(wxGridEvent& event);
- virtual void _OnCellLeftClick(wxGridEvent& event);
- virtual void _OnCellRightClick(wxGridEvent& event);
- virtual void _OnLabelLeftClick(wxGridEvent& event);
- virtual void _OnLabelRightClick(wxGridEvent& event);
-
+ void _OnCellChange(wxGridEvent& event);
+ void _OnCellLeftClick(wxGridEvent& event);
+ void _OnCellRightClick(wxGridEvent& event);
+ void _OnLabelLeftClick(wxGridEvent& event);
+ void _OnLabelRightClick(wxGridEvent& event);
// Activation: call from wxFrame::OnActivate
void OnActivate(bool active);
#include "wx/print.h"
#include "wx/printdlg.h"
+#include "wx/accel.h"
+
#if wxTEST_POSTSCRIPT_IN_MSW
#include "wx/generic/printps.h"
#include "wx/generic/prntdlgg.h"
file_menu->Append(WXPRINT_PAGE_SETUP, "Page Set&up...", "Page setup");
file_menu->Append(WXPRINT_PREVIEW, "Print Pre&view", "Preview");
+ // Accelerators
+ wxAcceleratorEntry entries[1];
+ entries[0].Set(wxACCEL_CTRL, (int) 'V', WXPRINT_PREVIEW);
+ wxAcceleratorTable accel(1, entries);
+ frame->SetAcceleratorTable(accel);
+
#if defined(__WXMSW__) && wxTEST_POSTSCRIPT_IN_MSW
file_menu->AppendSeparator();
file_menu->Append(WXPRINT_PRINT_PS, "Print PostScript...", "Print (PostScript)");
#include "wx/defs.h"
-#ifndef __WXGTK__
-#define __GOOD_COMPILER__
-#endif
-
#ifndef WX_PRECOMP
#include "wx/utils.h"
#include "wx/dc.h"
void wxPreviewCanvas::OnPaint(wxPaintEvent& WXUNUSED(event))
{
wxPaintDC dc(this);
+ PrepareDC( dc );
if (m_printPreview)
{
void wxPreviewControlBar::CreateButtons()
{
-#ifdef __GOOD_COMPILER__ // Robert Roebling
-
SetSize(0, 0, 400, 40);
#ifdef __WXMSW__
SetFont(buttonFont);
int buttonWidth = 65;
- int buttonHeight = 24;
+#ifdef __WXGTK__
+ int buttonHeight = -1;
+#else
+ int buttonHeight = 24;
+#endif
int x = 5;
int y = 5;
x += gap + buttonWidth;
}
- // Can't be static because gcc bails out
- wxString choices[] = { "10%", "20%", "25%", "30%", "35%", "40%", "45%", "50%", "55%", "60%",
- "65%", "70%", "75%", "80%", "85%", "90%", "95%", "100%", "110%", "120%", "150%", "200%" };
- int n = 22;
+ // Yes, this look stupid, but this is because gcc gives up otherwise.
+ wxString *choices = new wxString[23];
+ choices[0] = "10%";
+ choices[1] = "15%";
+ choices[2] = "20%";
+ choices[3] = "25%";
+ choices[4] = "30%";
+ choices[5] = "35%";
+ choices[6] = "40%";
+ choices[7] = "45%";
+ choices[8] = "50%";
+ choices[9] = "55%";
+ choices[10] = "60%";
+ choices[11] = "65%";
+ choices[12] = "70%";
+ choices[13] = "75%";
+ choices[14] = "80%";
+ choices[15] = "85%";
+ choices[16] = "90%";
+ choices[17] = "95%";
+ choices[18] = "100%";
+ choices[19] = "110%";
+ choices[20] = "120%";
+ choices[21] = "150%";
+ choices[22] = "200%";
+
+ int n = 23;
if (m_buttonFlags & wxPREVIEW_ZOOM)
{
m_zoomControl = new wxChoice(this, wxID_PREVIEW_ZOOM, wxPoint(x, y),
SetZoomControl(m_printPreview->GetZoom());
}
- m_closeButton->SetDefault();
+ delete[] choices;
-#endif
+ m_closeButton->SetDefault();
}
void wxPreviewControlBar::SetZoomControl(int zoom)
{
-#ifdef __GOOD_COMPILER__ // Robert Roebling
char buf[20];
sprintf(buf, "%d%%", zoom);
if (m_zoomControl)
m_zoomControl->SetStringSelection(buf);
-#endif
}
int wxPreviewControlBar::GetZoomControl()
{
-#ifdef __GOOD_COMPILER__ // Robert Roebling
char buf[20];
if (m_zoomControl && m_zoomControl->GetStringSelection())
{
return (int)atoi(buf);
}
else return 0;
-#else
- return 0;
-#endif
}
const wxPoint& pos, const wxSize& size, long style, const wxString& name):
wxFrame(parent, -1, title, pos, size, style, name)
{
-#ifdef __GOOD_COMPILER__ // Robert Roebling
m_printPreview = preview;
m_controlBar = NULL;
m_previewCanvas = NULL;
-#endif
}
wxPreviewFrame::~wxPreviewFrame()
bool wxPreviewFrame::OnClose()
{
-#ifdef __GOOD_COMPILER__ // Robert Roebling
-
MakeModal(FALSE);
// Need to delete the printout and the print preview
}
delete m_printPreview;
return TRUE;
-#else
- return FALSE;
-#endif
}
void wxPreviewFrame::Initialize()
{
-
-#ifdef __GOOD_COMPILER__ // Robert Roebling
-
CreateStatusBar();
CreateCanvas();
// int w, h;
// m_controlBar->GetSize(&w, &h);
int h;
-#ifdef __WXMSW__
+#if (defined(__WXMSW__) || defined(__WXGTK__))
h = 40;
#else
h = 60;
MakeModal(TRUE);
Layout();
-
-#endif
}
void wxPreviewFrame::CreateCanvas()
{
-#ifdef __GOOD_COMPILER__ // Robert Roebling
-
m_previewCanvas = new wxPreviewCanvas(m_printPreview, this);
-
-#endif
}
void wxPreviewFrame::CreateControlBar()
{
-#ifdef __GOOD_COMPILER__ // Robert Roebling
-
long buttons = wxPREVIEW_DEFAULT;
if (m_printPreview->GetPrintoutForPrinting())
buttons |= wxPREVIEW_PRINT;
m_controlBar = new wxPreviewControlBar(m_printPreview, buttons, this, wxPoint(0, 0), wxSize(400, 40));
m_controlBar->CreateButtons();
-#endif
}
/*
wxPrintPreviewBase::wxPrintPreviewBase(wxPrintout *printout, wxPrintout *printoutForPrinting, wxPrintData *data)
{
-
-#ifdef __GOOD_COMPILER__ // Robert Roebling
-
m_isOk = TRUE;
m_previewPrintout = printout;
if (m_previewPrintout)
// Get some parameters from the printout, if defined
int selFrom, selTo;
printout->GetPageInfo(&m_minPage, &m_maxPage, &selFrom, &selTo);
-
-#endif
}
wxPrintPreviewBase::~wxPrintPreviewBase()
{
-#ifdef __GOOD_COMPILER__ // Robert Roebling
-
if (m_previewPrintout)
delete m_previewPrintout;
if (m_previewBitmap)
delete m_previewBitmap;
if (m_printPrintout)
delete m_printPrintout;
-
-#endif
}
bool wxPrintPreviewBase::SetCurrentPage(int pageNum)
{
-#ifdef __GOOD_COMPILER__ // Robert Roebling
if (m_currentPage == pageNum)
return TRUE;
RenderPage(pageNum);
m_previewCanvas->Refresh();
}
-
-#endif
return TRUE;
}
bool wxPrintPreviewBase::PaintPage(wxWindow *canvas, wxDC& dc)
{
-
-#ifdef __GOOD_COMPILER__ // Robert Roebling
-
DrawBlankPage(canvas, dc);
if (!m_previewBitmap)
temp_dc.SelectObject(wxNullBitmap);
-#endif
-
return TRUE;
}
{
int canvasWidth, canvasHeight;
-#ifdef __GOOD_COMPILER__ // Robert Roebling
-
if (!m_previewCanvas)
{
wxMessageBox(_("wxPrintPreviewBase::RenderPage: must use wxPrintPreviewBase::SetCanvas to let me know about the canvas!"),
m_previewPrintout->SetDC(NULL);
memoryDC.SelectObject(wxNullBitmap);
-#endif
char buf[200];
if (m_maxPage != 0)
bool wxPrintPreviewBase::DrawBlankPage(wxWindow *canvas, wxDC& dc)
{
-
-#ifdef __GOOD_COMPILER__ // Robert Roebling
-
int canvasWidth, canvasHeight;
canvas->GetSize(&canvasWidth, &canvasHeight);
dc.DrawRectangle((int)(x-1), (int)(y-1), (int)(actualWidth+2), (int)(actualHeight+2));
-#endif
-
return TRUE;
}
void wxPrintPreviewBase::SetZoom(int percent)
{
-#ifdef __GOOD_COMPILER__ // Robert Roebling
if (m_currentZoom == percent)
return;
m_previewCanvas->Clear();
m_previewCanvas->Refresh();
}
-#endif
-
}
SetGridClippingRegion(dc);
- // Why isn't this needed for Windows??
- // Probably because of the SetValue??
- // Arrrrrgh. This isn't needed anywhere, of course. RR.
+ // 1) Why isn't this needed for Windows??
+ // Probably because of the SetValue?? JS.
+ // 2) Arrrrrgh. This isn't needed anywhere,
+ // of course. One hour of debugging... RR.
#ifndef __WXMSW__
// HighlightCell(dc);
#endif
ev.m_cell = OnCreateCell();
}
-void wxGenericGrid::_OnChangeLabels(wxGridEvent& ev)
+void wxGenericGrid::_OnChangeLabels(wxGridEvent& WXUNUSED(ev))
{
OnChangeLabels();
}
-void wxGenericGrid::_OnChangeSelectionLabel(wxGridEvent& ev)
+void wxGenericGrid::_OnChangeSelectionLabel(wxGridEvent& WXUNUSED(ev))
{
OnChangeSelectionLabel();
}
#include "wx/font.h"
#include "wx/settings.h"
#include "wx/resource.h"
+#include "wx/module.h"
#include "unistd.h"
wxApp::CommonInit();
+ wxModule::RegisterModules();
+ if (!wxModule::InitializeModules()) return FALSE;
+
wxTheApp->OnInitGui();
// Here frames insert themselves automatically
wxTheApp->OnExit();
+ wxModule::CleanUpModules();
+
wxApp::CommonCleanUp();
wxDELETE(wxTheApp);
gdk_gc_set_clip_mask( m_textGC, mask );
gdk_gc_set_clip_origin( m_textGC, xx, yy );
}
-
+
gdk_draw_pixmap( m_window, m_textGC, pmap,
source->DeviceToLogicalX(xsrc),
source->DeviceToLogicalY(ysrc),
m_backgroundBrush.GetColour().CalcPixel( m_cmap );
gdk_gc_set_background( m_brushGC, m_backgroundBrush.GetColour().GetColor() );
+ gdk_gc_set_background( m_bgGC, m_backgroundBrush.GetColour().GetColor() );
gdk_gc_set_foreground( m_bgGC, m_backgroundBrush.GetColour().GetColor() );
GdkFill fillStyle = GDK_SOLID;
m_bgGC = gdk_gc_new( m_window );
SetTextForeground( m_textForegroundColour );
SetTextBackground( m_textBackgroundColour );
- SetPen( m_pen );
- SetFont( m_font );
- SetBrush( m_brush );
+
+ wxPen tmp_pen( m_pen );
+ m_pen = wxNullPen;
+ SetPen( tmp_pen );
+
+ wxFont tmp_font( m_font );
+ m_font = wxNullFont;
+ SetFont( tmp_font );
+
+ wxBrush tmp_brush( m_brush );
+ m_brush = wxNullBrush;
+ SetBrush( tmp_brush );
+
+ tmp_brush = m_backgroundBrush;
+ m_backgroundBrush = wxNullBrush;
+ SetBackground( tmp_brush );
gdk_gc_set_background( m_penGC, wxWHITE->GetColor() );
IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxPaintDC)
-wxMemoryDC::wxMemoryDC(void)
+wxMemoryDC::wxMemoryDC(void) : wxPaintDC()
{
m_ok = FALSE;
m_cmap = gtk_widget_get_default_colormap();
}
-wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
+wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) ) : wxPaintDC()
{
m_ok = FALSE;
static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxWindow *win )
{
+ printf( "OnKeyPress.\n " );
+
if (!win->HasVMT()) return FALSE;
if (g_blockEventsOnDrag) return FALSE;
-/*
printf( "OnKeyPress from " );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
printf( win->GetClassInfo()->GetClassName() );
printf( ".\n" );
-*/
long key_code = 0;
switch (gdk_event->keyval)
event.m_y = 0;
event.SetEventObject( win );
+ printf( "process key.\n" );
+
bool ret = win->GetEventHandler()->ProcessEvent( event );
+ printf( "no handler.\n" );
+
if (!ret)
{
wxWindow *ancestor = win;
while (ancestor)
{
+ printf( "check accel in %s .\n", WXSTRINGCAST ancestor->GetName() );
+
int command = ancestor->GetAcceleratorTable()->GetCommand( event );
if (command != -1)
{
#include "wx/font.h"
#include "wx/settings.h"
#include "wx/resource.h"
+#include "wx/module.h"
#include "unistd.h"
wxApp::CommonInit();
+ wxModule::RegisterModules();
+ if (!wxModule::InitializeModules()) return FALSE;
+
wxTheApp->OnInitGui();
// Here frames insert themselves automatically
wxTheApp->OnExit();
+ wxModule::CleanUpModules();
+
wxApp::CommonCleanUp();
wxDELETE(wxTheApp);
gdk_gc_set_clip_mask( m_textGC, mask );
gdk_gc_set_clip_origin( m_textGC, xx, yy );
}
-
+
gdk_draw_pixmap( m_window, m_textGC, pmap,
source->DeviceToLogicalX(xsrc),
source->DeviceToLogicalY(ysrc),
m_backgroundBrush.GetColour().CalcPixel( m_cmap );
gdk_gc_set_background( m_brushGC, m_backgroundBrush.GetColour().GetColor() );
+ gdk_gc_set_background( m_bgGC, m_backgroundBrush.GetColour().GetColor() );
gdk_gc_set_foreground( m_bgGC, m_backgroundBrush.GetColour().GetColor() );
GdkFill fillStyle = GDK_SOLID;
m_bgGC = gdk_gc_new( m_window );
SetTextForeground( m_textForegroundColour );
SetTextBackground( m_textBackgroundColour );
- SetPen( m_pen );
- SetFont( m_font );
- SetBrush( m_brush );
+
+ wxPen tmp_pen( m_pen );
+ m_pen = wxNullPen;
+ SetPen( tmp_pen );
+
+ wxFont tmp_font( m_font );
+ m_font = wxNullFont;
+ SetFont( tmp_font );
+
+ wxBrush tmp_brush( m_brush );
+ m_brush = wxNullBrush;
+ SetBrush( tmp_brush );
+
+ tmp_brush = m_backgroundBrush;
+ m_backgroundBrush = wxNullBrush;
+ SetBackground( tmp_brush );
gdk_gc_set_background( m_penGC, wxWHITE->GetColor() );
IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxPaintDC)
-wxMemoryDC::wxMemoryDC(void)
+wxMemoryDC::wxMemoryDC(void) : wxPaintDC()
{
m_ok = FALSE;
m_cmap = gtk_widget_get_default_colormap();
}
-wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
+wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) ) : wxPaintDC()
{
m_ok = FALSE;
static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxWindow *win )
{
+ printf( "OnKeyPress.\n " );
+
if (!win->HasVMT()) return FALSE;
if (g_blockEventsOnDrag) return FALSE;
-/*
printf( "OnKeyPress from " );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
printf( win->GetClassInfo()->GetClassName() );
printf( ".\n" );
-*/
long key_code = 0;
switch (gdk_event->keyval)
event.m_y = 0;
event.SetEventObject( win );
+ printf( "process key.\n" );
+
bool ret = win->GetEventHandler()->ProcessEvent( event );
+ printf( "no handler.\n" );
+
if (!ret)
{
wxWindow *ancestor = win;
while (ancestor)
{
+ printf( "check accel in %s .\n", WXSTRINGCAST ancestor->GetName() );
+
int command = ancestor->GetAcceleratorTable()->GetCommand( event );
if (command != -1)
{