m_printPreview = preview;
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE));
- SetScrollbars(40, 40, 100, 100);
+ SetScrollbars(15, 18, 100, 100);
}
wxPreviewCanvas::~wxPreviewCanvas()
*/
BEGIN_EVENT_TABLE(wxPreviewControlBar, wxPanel)
- EVT_BUTTON(wxID_PREVIEW_CLOSE, wxPreviewControlBar::OnClose)
+ EVT_BUTTON(wxID_PREVIEW_CLOSE, wxPreviewControlBar::OnWindowClose)
EVT_BUTTON(wxID_PREVIEW_PRINT, wxPreviewControlBar::OnPrint)
EVT_BUTTON(wxID_PREVIEW_PREVIOUS, wxPreviewControlBar::OnPrevious)
EVT_BUTTON(wxID_PREVIEW_NEXT, wxPreviewControlBar::OnNext)
dc.DrawLine( 0, h-1, w, h-1 );
}
-void wxPreviewControlBar::OnClose(wxCommandEvent& WXUNUSED(event))
+void wxPreviewControlBar::OnWindowClose(wxCommandEvent& WXUNUSED(event))
{
wxPreviewFrame *frame = (wxPreviewFrame *)GetParent();
frame->Close(TRUE);
{
SetSize(0, 0, 400, 40);
+ /*
#ifdef __WXMSW__
int fontSize = 9;
#else
wxFont buttonFont(fontSize, wxSWISS, wxNORMAL, wxBOLD);
SetFont(buttonFont);
+ */
int buttonWidth = 65;
#ifdef __WXGTK__
int x = 5;
int y = 5;
+
+#ifdef __WXMOTIF__
+ int gap = 15;
+#else
int gap = 5;
+#endif
m_closeButton = new wxButton(this, wxID_PREVIEW_CLOSE, _("Close"),
wxPoint(x, y), wxSize(buttonWidth, buttonHeight));
delete[] choices;
- m_closeButton->SetDefault();
+ // m_closeButton->SetDefault();
}
void wxPreviewControlBar::SetZoomControl(int zoom)
int wxPreviewControlBar::GetZoomControl()
{
char buf[20];
- if (m_zoomControl && m_zoomControl->GetStringSelection())
+ if (m_zoomControl && (m_zoomControl->GetStringSelection() != ""))
{
strcpy(buf, m_zoomControl->GetStringSelection());
buf[strlen(buf) - 1] = 0;
* Preview frame
*/
+BEGIN_EVENT_TABLE(wxPreviewFrame, wxFrame)
+ EVT_CLOSE(wxPreviewFrame::OnCloseWindow)
+END_EVENT_TABLE()
+
wxPreviewFrame::wxPreviewFrame(wxPrintPreviewBase *preview, wxFrame *parent, const wxString& title,
const wxPoint& pos, const wxSize& size, long style, const wxString& name):
wxFrame(parent, -1, title, pos, size, style, name)
{
}
-bool wxPreviewFrame::OnClose()
+void wxPreviewFrame::OnCloseWindow(wxCloseEvent& event)
{
MakeModal(FALSE);
m_printPreview->SetFrame(NULL);
}
delete m_printPreview;
- return TRUE;
+
+ Destroy();
}
void wxPreviewFrame::Initialize()
int shadowOffset = 4;
dc.SetPen(*wxBLACK_PEN);
dc.SetBrush(*wxBLACK_BRUSH);
+/*
dc.DrawRectangle((int)(x-1 + shadowOffset), (int)(y-1 + shadowOffset), (int)(actualWidth+2), (int)(actualHeight+2));
+*/
+ dc.DrawRectangle((int)(x + shadowOffset), (int)(y + actualHeight+1), (int)(actualWidth), shadowOffset);
+ dc.DrawRectangle((int)(x + actualWidth), (int)(y + shadowOffset), shadowOffset, (int)(actualHeight));
// Draw blank page allowing for 1-pixel border AROUND the actual page
dc.SetPen(*wxBLACK_PEN);
dc.SetBrush(*wxWHITE_BRUSH);
-
- dc.DrawRectangle((int)(x-1), (int)(y-1), (int)(actualWidth+2), (int)(actualHeight+2));
+/*
+ wxRegion update_region = canvas->GetUpdateRegion();
+ wxRect r = update_region.GetBox();
+
+ printf( "x: %d y: %d w: %d h: %d.\n", (int)r.x, (int)r.y, (int)r.width, (int)r.height );
+*/
+
+ dc.DrawRectangle((int)(x-2), (int)(y-1), (int)(actualWidth+3), (int)(actualHeight+2));
return TRUE;
}