Added PushEventHandler, Pop...

Corrected spelling of SetEventhandler
  Fixed two bugs in wxGenericPrintDlg
  Tried in vain to make printing of icons work.
    It now prints black on black, mostly.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@514 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling 1998-08-12 21:24:51 +00:00
parent 16ced4a272
commit 86b29a6122
9 changed files with 85 additions and 9 deletions

View File

@ -94,7 +94,9 @@ class wxDC: public wxObject
virtual void DrawSpline( int n, wxPoint points[] );
virtual bool CanDrawBitmap(void) const = 0;
virtual void DrawIcon( const wxIcon &icon, long x, long y, bool useMask=FALSE );
virtual void DrawIcon( const wxIcon &icon, long x, long y )
{ DrawIcon( icon, x, y, TRUE ); }
virtual void DrawIcon( const wxIcon &icon, long x, long y, bool useMask );
void DrawBitmap( const wxBitmap &bmp, long x, long y, bool useMask=FALSE )
{ DrawIcon( *((wxIcon*)(&bmp)), x, y, useMask ); }
virtual bool Blit( long xdest, long ydest, long width, long height,

View File

@ -102,7 +102,9 @@ public:
wxWindow *GetParent();
wxEvtHandler *GetEventHandler();
void SetEventhandler( wxEvtHandler *handler );
void SetEventHandler( wxEvtHandler *handler );
void PushEventHandler( wxEvtHandler *handler );
wxEvtHandler *PopEventHandler( bool deleteHandler = FALSE );
virtual wxValidator *GetValidator();
virtual void SetValidator( wxValidator *validator );

View File

@ -94,7 +94,9 @@ class wxDC: public wxObject
virtual void DrawSpline( int n, wxPoint points[] );
virtual bool CanDrawBitmap(void) const = 0;
virtual void DrawIcon( const wxIcon &icon, long x, long y, bool useMask=FALSE );
virtual void DrawIcon( const wxIcon &icon, long x, long y )
{ DrawIcon( icon, x, y, TRUE ); }
virtual void DrawIcon( const wxIcon &icon, long x, long y, bool useMask );
void DrawBitmap( const wxBitmap &bmp, long x, long y, bool useMask=FALSE )
{ DrawIcon( *((wxIcon*)(&bmp)), x, y, useMask ); }
virtual bool Blit( long xdest, long ydest, long width, long height,

View File

@ -102,7 +102,9 @@ public:
wxWindow *GetParent();
wxEvtHandler *GetEventHandler();
void SetEventhandler( wxEvtHandler *handler );
void SetEventHandler( wxEvtHandler *handler );
void PushEventHandler( wxEvtHandler *handler );
wxEvtHandler *PopEventHandler( bool deleteHandler = FALSE );
virtual wxValidator *GetValidator();
virtual void SetValidator( wxValidator *validator );

View File

@ -76,6 +76,10 @@ class WXDLLEXPORT wxPostScriptDC: public wxDC
void DrawOpenSpline(wxList *points);
void DrawIcon(const wxIcon& icon, long x, long y);
#ifdef __WXGTK__
void DrawIcon(const wxIcon& icon, long x, long y, bool WXUNUSED(usemask) )
{ DrawIcon( icon, x, y ); }
#endif
void DrawText(const wxString& text, long x, long y, bool use16 = FALSE);
void Clear(void);

View File

@ -56,6 +56,11 @@ float zoom_factor = 1.0;
#include "aiai.xbm"
#endif
#ifdef __WXGTK__
#include "folder.xpm"
#endif
// Writes a header on a page. Margin units are in millimetres.
bool WritePageHeader(wxPrintout *printout, wxDC *dc, char *text, float mmToLogical);
@ -319,6 +324,9 @@ void MyFrame::Draw(wxDC& dc)
dc.SetPen(wxBLACK_PEN);
dc.DrawLine(0, 0, 200, 200);
dc.DrawLine(200, 0, 0, 200);
wxIcon my_icon( folder_xpm );
dc.DrawIcon( my_icon, 100, 100, TRUE );
}
void MyFrame::OnSize(wxSizeEvent& event )

View File

@ -93,7 +93,9 @@ wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent, wxPrintData* data):
wxString choices[2];
choices[0] = _("All");
choices[1] = _("Pages");
fromText = (wxTextCtrl*)NULL;
rangeRadioBox = new wxRadioBox(this, wxPRINTID_RANGE, _("Print Range"),
wxPoint(5, yPos), wxSize(-1, -1), 2, choices, 2);
rangeRadioBox->SetSelection(1);
@ -186,12 +188,14 @@ void wxGenericPrintDialog::OnOK(wxCommandEvent& WXUNUSED(event))
void wxGenericPrintDialog::OnRange(wxCommandEvent& event)
{
if (event.GetInt() == 0)
if (!fromText) return;
if (event.GetInt() == 1)
{
fromText->Enable(FALSE);
toText->Enable(FALSE);
}
else if (event.GetInt() == 1)
else if (event.GetInt() == 0)
{
fromText->Enable(TRUE);
toText->Enable(TRUE);

View File

@ -1544,11 +1544,37 @@ wxEvtHandler *wxWindow::GetEventHandler(void)
return m_eventHandler;
}
void wxWindow::SetEventhandler( wxEvtHandler *handler )
void wxWindow::SetEventHandler( wxEvtHandler *handler )
{
m_eventHandler = handler;
}
void wxWindow::PushEventHandler(wxEvtHandler *handler)
{
handler->SetNextHandler(GetEventHandler());
SetEventHandler(handler);
}
wxEvtHandler *wxWindow::PopEventHandler(bool deleteHandler)
{
if ( GetEventHandler() )
{
wxEvtHandler *handlerA = GetEventHandler();
wxEvtHandler *handlerB = handlerA->GetNextHandler();
handlerA->SetNextHandler(NULL);
SetEventHandler(handlerB);
if ( deleteHandler )
{
delete handlerA;
return NULL;
}
else
return handlerA;
}
else
return NULL;
}
wxValidator *wxWindow::GetValidator(void)
{
return m_windowValidator;

View File

@ -1544,11 +1544,37 @@ wxEvtHandler *wxWindow::GetEventHandler(void)
return m_eventHandler;
}
void wxWindow::SetEventhandler( wxEvtHandler *handler )
void wxWindow::SetEventHandler( wxEvtHandler *handler )
{
m_eventHandler = handler;
}
void wxWindow::PushEventHandler(wxEvtHandler *handler)
{
handler->SetNextHandler(GetEventHandler());
SetEventHandler(handler);
}
wxEvtHandler *wxWindow::PopEventHandler(bool deleteHandler)
{
if ( GetEventHandler() )
{
wxEvtHandler *handlerA = GetEventHandler();
wxEvtHandler *handlerB = handlerA->GetNextHandler();
handlerA->SetNextHandler(NULL);
SetEventHandler(handlerB);
if ( deleteHandler )
{
delete handlerA;
return NULL;
}
else
return handlerA;
}
else
return NULL;
}
wxValidator *wxWindow::GetValidator(void)
{
return m_windowValidator;