wxWindow::OnClose() removed completely from wxGTK, wxCloseEvent is now

processed properly. Also, fixes for compilation without WXWIN_COMPATIBILITY
on.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1608 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-02-05 14:26:48 +00:00
parent f992adf9bc
commit 2b854a3261
15 changed files with 1132 additions and 1083 deletions

View File

@@ -187,8 +187,11 @@ class WXDLLEXPORT wxView: public wxEvtHandler
// Override to do cleanup/veto close // Override to do cleanup/veto close
virtual bool OnClose(bool deleteWindow); virtual bool OnClose(bool deleteWindow);
#ifdef WXWIN_COMPATIBILITY
// Defeat compiler warning // Defeat compiler warning
inline bool OnClose(void) { return wxEvtHandler::OnClose(); } bool OnClose(void) { return wxEvtHandler::OnClose(); }
#endif
// Extend event processing to search the document's event table // Extend event processing to search the document's event table
virtual bool ProcessEvent(wxEvent& event); virtual bool ProcessEvent(wxEvent& event);
@@ -197,7 +200,8 @@ class WXDLLEXPORT wxView: public wxEvtHandler
// The function then notifies the document manager. // The function then notifies the document manager.
virtual void Activate(bool activate); virtual void Activate(bool activate);
inline wxDocManager *GetDocumentManager(void) const { return m_viewDocument->GetDocumentManager(); } wxDocManager *GetDocumentManager(void) const
{ return m_viewDocument->GetDocumentManager(); }
#if wxUSE_PRINTING_ARCHITECTURE #if wxUSE_PRINTING_ARCHITECTURE
virtual wxPrintout *OnCreatePrintout(void); virtual wxPrintout *OnCreatePrintout(void);

File diff suppressed because it is too large Load Diff

View File

@@ -5,7 +5,7 @@
// Created: // Created:
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifndef __GTKDIALOGH__ #ifndef __GTKDIALOGH__
@@ -44,21 +44,20 @@ public:
wxDialog( wxWindow *parent, wxWindowID id, wxDialog( wxWindow *parent, wxWindowID id,
const wxString &title, const wxString &title,
const wxPoint &pos = wxDefaultPosition, const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize, const wxSize &size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE, long style = wxDEFAULT_DIALOG_STYLE,
const wxString &name = wxDialogNameStr ); const wxString &name = wxDialogNameStr );
bool Create( wxWindow *parent, wxWindowID id, bool Create( wxWindow *parent, wxWindowID id,
const wxString &title, const wxString &title,
const wxPoint &pos = wxDefaultPosition, const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize, const wxSize &size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE, long style = wxDEFAULT_DIALOG_STYLE,
const wxString &name = wxDialogNameStr ); const wxString &name = wxDialogNameStr );
~wxDialog(); ~wxDialog();
void SetTitle(const wxString& title); void SetTitle(const wxString& title);
wxString GetTitle() const; wxString GetTitle() const;
bool OnClose();
void OnApply( wxCommandEvent &event ); void OnApply( wxCommandEvent &event );
void OnCancel( wxCommandEvent &event ); void OnCancel( wxCommandEvent &event );
void OnOK( wxCommandEvent &event ); void OnOK( wxCommandEvent &event );

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Robert Roebling // Copyright: (c) Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifndef __GTKMINIFRAMEH__ #ifndef __GTKMINIFRAMEH__
@@ -30,39 +30,39 @@ class wxMiniFrame;
class wxMiniFrame: public wxFrame class wxMiniFrame: public wxFrame
{ {
DECLARE_DYNAMIC_CLASS(wxMiniFrame) DECLARE_DYNAMIC_CLASS(wxMiniFrame)
public: public:
inline wxMiniFrame(void) {} wxMiniFrame() {}
inline wxMiniFrame(wxWindow *parent, wxMiniFrame(wxWindow *parent,
wxWindowID id, wxWindowID id,
const wxString& title, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME|wxTINY_CAPTION_HORIZ, long style = wxDEFAULT_FRAME_STYLE | wxTINY_CAPTION_HORIZ,
const wxString& name = wxFrameNameStr) const wxString& name = wxFrameNameStr)
{ {
Create(parent, id, title, pos, size, style, name); Create(parent, id, title, pos, size, style, name);
} }
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME|wxTINY_CAPTION_HORIZ,
const wxString& name = wxFrameNameStr);
// implementation bool Create(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE | wxTINY_CAPTION_HORIZ,
const wxString& name = wxFrameNameStr);
bool m_isDragging; // implementation
int m_oldX,m_oldY; bool m_isDragging;
int m_diffX,m_diffY; int m_oldX,m_oldY;
int m_diffX,m_diffY;
void DrawFrame( int x, int y ); void DrawFrame( int x, int y );
void OnPaint( wxPaintEvent &event ); void OnPaint( wxPaintEvent &event );
void OnMouse( wxMouseEvent &event ); void OnMouse( wxMouseEvent &event );
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
#endif #endif

View File

@@ -184,7 +184,6 @@ public:
virtual void MakeModal( bool modal ); virtual void MakeModal( bool modal );
virtual bool IsEnabled() const { return m_isEnabled; } virtual bool IsEnabled() const { return m_isEnabled; }
inline bool Enabled() const { return IsEnabled(); } inline bool Enabled() const { return IsEnabled(); }
virtual bool OnClose();
virtual void SetFocus(); virtual void SetFocus();
static wxWindow *FindFocus(); static wxWindow *FindFocus();
@@ -195,6 +194,7 @@ public:
virtual void RemoveChild( wxWindow *child ); virtual void RemoveChild( wxWindow *child );
void SetReturnCode( int retCode ); void SetReturnCode( int retCode );
int GetReturnCode(); int GetReturnCode();
wxWindow *GetParent() const wxWindow *GetParent() const
{ return m_parent; } { return m_parent; }
wxWindow *GetGrandParent() const wxWindow *GetGrandParent() const
@@ -260,10 +260,10 @@ public:
virtual wxFont& GetFont() { return m_font; } virtual wxFont& GetFont() { return m_font; }
// For backward compatibility // For backward compatibility
inline virtual void SetButtonFont(const wxFont& font) { SetFont(font); } virtual void SetButtonFont(const wxFont& font) { SetFont(font); }
inline virtual void SetLabelFont(const wxFont& font) { SetFont(font); } virtual void SetLabelFont(const wxFont& font) { SetFont(font); }
inline virtual wxFont& GetLabelFont() { return GetFont(); }; virtual wxFont& GetLabelFont() { return GetFont(); };
inline virtual wxFont& GetButtonFont() { return GetFont(); }; virtual wxFont& GetButtonFont() { return GetFont(); };
virtual void SetWindowStyleFlag( long flag ); virtual void SetWindowStyleFlag( long flag );
virtual long GetWindowStyleFlag() const; virtual long GetWindowStyleFlag() const;
@@ -277,7 +277,7 @@ public:
virtual wxString GetName() const; virtual wxString GetName() const;
virtual wxString GetLabel() const; virtual wxString GetLabel() const;
void OnSysColourChanged( wxSysColourChangedEvent &WXUNUSED(event) ) {}; void OnSysColourChanged( wxSysColourChangedEvent &WXUNUSED(event) ) { }
void OnKeyDown( wxKeyEvent &event ); void OnKeyDown( wxKeyEvent &event );
virtual bool IsShown() const; virtual bool IsShown() const;
@@ -289,8 +289,8 @@ public:
virtual wxWindow *FindWindow( long id ); virtual wxWindow *FindWindow( long id );
virtual wxWindow *FindWindow( const wxString& name ); virtual wxWindow *FindWindow( const wxString& name );
void AllowDoubleClick( bool WXUNUSED(allow) ) {}; void AllowDoubleClick( bool WXUNUSED(allow) ) { }
void SetDoubleClick( bool WXUNUSED(allow) ) {}; void SetDoubleClick( bool WXUNUSED(allow) ) { }
virtual void ClientToScreen( int *x, int *y ); virtual void ClientToScreen( int *x, int *y );
virtual void ScreenToClient( int *x, int *y ); virtual void ScreenToClient( int *x, int *y );

View File

@@ -5,7 +5,7 @@
// Created: // Created:
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifndef __GTKDIALOGH__ #ifndef __GTKDIALOGH__
@@ -44,21 +44,20 @@ public:
wxDialog( wxWindow *parent, wxWindowID id, wxDialog( wxWindow *parent, wxWindowID id,
const wxString &title, const wxString &title,
const wxPoint &pos = wxDefaultPosition, const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize, const wxSize &size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE, long style = wxDEFAULT_DIALOG_STYLE,
const wxString &name = wxDialogNameStr ); const wxString &name = wxDialogNameStr );
bool Create( wxWindow *parent, wxWindowID id, bool Create( wxWindow *parent, wxWindowID id,
const wxString &title, const wxString &title,
const wxPoint &pos = wxDefaultPosition, const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize, const wxSize &size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE, long style = wxDEFAULT_DIALOG_STYLE,
const wxString &name = wxDialogNameStr ); const wxString &name = wxDialogNameStr );
~wxDialog(); ~wxDialog();
void SetTitle(const wxString& title); void SetTitle(const wxString& title);
wxString GetTitle() const; wxString GetTitle() const;
bool OnClose();
void OnApply( wxCommandEvent &event ); void OnApply( wxCommandEvent &event );
void OnCancel( wxCommandEvent &event ); void OnCancel( wxCommandEvent &event );
void OnOK( wxCommandEvent &event ); void OnOK( wxCommandEvent &event );

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Robert Roebling // Copyright: (c) Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifndef __GTKMINIFRAMEH__ #ifndef __GTKMINIFRAMEH__
@@ -30,39 +30,39 @@ class wxMiniFrame;
class wxMiniFrame: public wxFrame class wxMiniFrame: public wxFrame
{ {
DECLARE_DYNAMIC_CLASS(wxMiniFrame) DECLARE_DYNAMIC_CLASS(wxMiniFrame)
public: public:
inline wxMiniFrame(void) {} wxMiniFrame() {}
inline wxMiniFrame(wxWindow *parent, wxMiniFrame(wxWindow *parent,
wxWindowID id, wxWindowID id,
const wxString& title, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME|wxTINY_CAPTION_HORIZ, long style = wxDEFAULT_FRAME_STYLE | wxTINY_CAPTION_HORIZ,
const wxString& name = wxFrameNameStr) const wxString& name = wxFrameNameStr)
{ {
Create(parent, id, title, pos, size, style, name); Create(parent, id, title, pos, size, style, name);
} }
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME|wxTINY_CAPTION_HORIZ,
const wxString& name = wxFrameNameStr);
// implementation bool Create(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE | wxTINY_CAPTION_HORIZ,
const wxString& name = wxFrameNameStr);
bool m_isDragging; // implementation
int m_oldX,m_oldY; bool m_isDragging;
int m_diffX,m_diffY; int m_oldX,m_oldY;
int m_diffX,m_diffY;
void DrawFrame( int x, int y ); void DrawFrame( int x, int y );
void OnPaint( wxPaintEvent &event ); void OnPaint( wxPaintEvent &event );
void OnMouse( wxMouseEvent &event ); void OnMouse( wxMouseEvent &event );
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
#endif #endif

View File

@@ -184,7 +184,6 @@ public:
virtual void MakeModal( bool modal ); virtual void MakeModal( bool modal );
virtual bool IsEnabled() const { return m_isEnabled; } virtual bool IsEnabled() const { return m_isEnabled; }
inline bool Enabled() const { return IsEnabled(); } inline bool Enabled() const { return IsEnabled(); }
virtual bool OnClose();
virtual void SetFocus(); virtual void SetFocus();
static wxWindow *FindFocus(); static wxWindow *FindFocus();
@@ -195,6 +194,7 @@ public:
virtual void RemoveChild( wxWindow *child ); virtual void RemoveChild( wxWindow *child );
void SetReturnCode( int retCode ); void SetReturnCode( int retCode );
int GetReturnCode(); int GetReturnCode();
wxWindow *GetParent() const wxWindow *GetParent() const
{ return m_parent; } { return m_parent; }
wxWindow *GetGrandParent() const wxWindow *GetGrandParent() const
@@ -260,10 +260,10 @@ public:
virtual wxFont& GetFont() { return m_font; } virtual wxFont& GetFont() { return m_font; }
// For backward compatibility // For backward compatibility
inline virtual void SetButtonFont(const wxFont& font) { SetFont(font); } virtual void SetButtonFont(const wxFont& font) { SetFont(font); }
inline virtual void SetLabelFont(const wxFont& font) { SetFont(font); } virtual void SetLabelFont(const wxFont& font) { SetFont(font); }
inline virtual wxFont& GetLabelFont() { return GetFont(); }; virtual wxFont& GetLabelFont() { return GetFont(); };
inline virtual wxFont& GetButtonFont() { return GetFont(); }; virtual wxFont& GetButtonFont() { return GetFont(); };
virtual void SetWindowStyleFlag( long flag ); virtual void SetWindowStyleFlag( long flag );
virtual long GetWindowStyleFlag() const; virtual long GetWindowStyleFlag() const;
@@ -277,7 +277,7 @@ public:
virtual wxString GetName() const; virtual wxString GetName() const;
virtual wxString GetLabel() const; virtual wxString GetLabel() const;
void OnSysColourChanged( wxSysColourChangedEvent &WXUNUSED(event) ) {}; void OnSysColourChanged( wxSysColourChangedEvent &WXUNUSED(event) ) { }
void OnKeyDown( wxKeyEvent &event ); void OnKeyDown( wxKeyEvent &event );
virtual bool IsShown() const; virtual bool IsShown() const;
@@ -289,8 +289,8 @@ public:
virtual wxWindow *FindWindow( long id ); virtual wxWindow *FindWindow( long id );
virtual wxWindow *FindWindow( const wxString& name ); virtual wxWindow *FindWindow( const wxString& name );
void AllowDoubleClick( bool WXUNUSED(allow) ) {}; void AllowDoubleClick( bool WXUNUSED(allow) ) { }
void SetDoubleClick( bool WXUNUSED(allow) ) {}; void SetDoubleClick( bool WXUNUSED(allow) ) { }
virtual void ClientToScreen( int *x, int *y ); virtual void ClientToScreen( int *x, int *y );
virtual void ScreenToClient( int *x, int *y ); virtual void ScreenToClient( int *x, int *y );

View File

@@ -6,7 +6,7 @@
// Created: 01/02/97 // Created: 01/02/97
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) // Copyright: (c)
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
@@ -229,258 +229,258 @@ void wxTabControl::OnDraw(wxDC& dc, bool lastInRow)
#else #else
// New HEL version with rounder tabs // New HEL version with rounder tabs
if (!m_view) return; if (!m_view) return;
int tabInc = 0; int tabInc = 0;
if (m_isSelected) if (m_isSelected)
{ {
tabInc = m_view->GetTabSelectionHeight() - m_view->GetTabHeight(); tabInc = m_view->GetTabSelectionHeight() - m_view->GetTabHeight();
} }
int tabLeft = GetX() + m_view->GetViewRect().x; int tabLeft = GetX() + m_view->GetViewRect().x;
int tabTop = GetY() + m_view->GetViewRect().y - tabInc; int tabTop = GetY() + m_view->GetViewRect().y - tabInc;
int tabRight = tabLeft + m_view->GetTabWidth(); int tabRight = tabLeft + m_view->GetTabWidth();
int left = m_view->GetViewRect().x; int left = m_view->GetViewRect().x;
int top = tabTop + m_view->GetTabHeight() + tabInc; int top = tabTop + m_view->GetTabHeight() + tabInc;
int right = left + m_view->GetViewRect().width; int right = left + m_view->GetViewRect().width;
int bottom = top + m_view->GetViewRect().height; int bottom = top + m_view->GetViewRect().height;
if (m_isSelected) if (m_isSelected)
{ {
// TAB is selected - draw TAB and the View's full outline // TAB is selected - draw TAB and the View's full outline
dc.SetPen(*(m_view->GetHighlightPen())); dc.SetPen(*(m_view->GetHighlightPen()));
wxPoint pnts[10]; wxPoint pnts[10];
int n = 0; int n = 0;
pnts[n].x = left; pnts[n++].y = bottom; pnts[n].x = left; pnts[n++].y = bottom;
pnts[n].x = left; pnts[n++].y = top; pnts[n].x = left; pnts[n++].y = top;
pnts[n].x = tabLeft; pnts[n++].y = top; pnts[n].x = tabLeft; pnts[n++].y = top;
pnts[n].x = tabLeft; pnts[n++].y = tabTop + 2; pnts[n].x = tabLeft; pnts[n++].y = tabTop + 2;
pnts[n].x = tabLeft + 2; pnts[n++].y = tabTop; pnts[n].x = tabLeft + 2; pnts[n++].y = tabTop;
pnts[n].x = tabRight - 1; pnts[n++].y = tabTop; pnts[n].x = tabRight - 1; pnts[n++].y = tabTop;
dc.DrawLines(n, pnts); dc.DrawLines(n, pnts);
if (!lastInRow) if (!lastInRow)
{ {
dc.DrawLine( dc.DrawLine(
(tabRight + 2), (tabRight + 2),
top, top,
right, right,
top top
); );
} }
dc.SetPen(*(m_view->GetShadowPen())); dc.SetPen(*(m_view->GetShadowPen()));
dc.DrawLine( dc.DrawLine(
tabRight, tabRight,
tabTop + 2, tabTop + 2,
tabRight, tabRight,
top top
); );
dc.DrawLine( dc.DrawLine(
right, right,
top, top,
right, right,
bottom bottom
); );
dc.DrawLine( dc.DrawLine(
right, right,
bottom, bottom,
left, left,
bottom bottom
); );
dc.SetPen(*wxBLACK_PEN); dc.SetPen(*wxBLACK_PEN);
dc.DrawPoint( dc.DrawPoint(
tabRight, tabRight,
tabTop + 1 tabTop + 1
); );
dc.DrawPoint( dc.DrawPoint(
tabRight + 1, tabRight + 1,
tabTop + 2 tabTop + 2
); );
if (lastInRow) if (lastInRow)
{ {
dc.DrawLine( dc.DrawLine(
tabRight + 1, tabRight + 1,
bottom, bottom,
tabRight + 1, tabRight + 1,
tabTop + 1 tabTop + 1
); );
} }
else else
{ {
dc.DrawLine( dc.DrawLine(
tabRight + 1, tabRight + 1,
tabTop + 2, tabTop + 2,
tabRight + 1, tabRight + 1,
top top
); );
dc.DrawLine( dc.DrawLine(
right + 1, right + 1,
top, top,
right + 1, right + 1,
bottom + 1 bottom + 1
); );
} }
dc.DrawLine( dc.DrawLine(
right + 1, right + 1,
bottom + 1, bottom + 1,
left + 1, left + 1,
bottom + 1 bottom + 1
); );
} }
else else
{ {
// TAB is not selected - just draw TAB outline and RH edge // TAB is not selected - just draw TAB outline and RH edge
// if the TAB is the last in the row // if the TAB is the last in the row
int maxPositions = ((wxTabLayer*)m_view->GetLayers().Nth(0)->Data())->Number(); int maxPositions = ((wxTabLayer*)m_view->GetLayers().Nth(0)->Data())->Number();
wxTabControl* tabBelow = 0; wxTabControl* tabBelow = 0;
wxTabControl* tabBelowRight = 0; wxTabControl* tabBelowRight = 0;
if (GetColPosition() > 0) if (GetColPosition() > 0)
{ {
tabBelow = m_view->FindTabControlForPosition( tabBelow = m_view->FindTabControlForPosition(
GetColPosition() - 1, GetColPosition() - 1,
GetRowPosition() GetRowPosition()
); );
} }
if (!lastInRow && GetColPosition() > 0) if (!lastInRow && GetColPosition() > 0)
{ {
tabBelowRight = m_view->FindTabControlForPosition( tabBelowRight = m_view->FindTabControlForPosition(
GetColPosition() - 1, GetColPosition() - 1,
GetRowPosition() + 1 GetRowPosition() + 1
); );
} }
float raisedTop = top - m_view->GetTabSelectionHeight() + float raisedTop = top - m_view->GetTabSelectionHeight() +
m_view->GetTabHeight(); m_view->GetTabHeight();
dc.SetPen(*(m_view->GetHighlightPen())); dc.SetPen(*(m_view->GetHighlightPen()));
wxPoint pnts[10]; wxPoint pnts[10];
int n = 0; int n = 0;
pnts[n].x = tabLeft; pnts[n].x = tabLeft;
if (tabBelow && tabBelow->IsSelected()) if (tabBelow && tabBelow->IsSelected())
{ {
pnts[n++].y = (long)raisedTop; pnts[n++].y = (long)raisedTop;
} }
else else
{ {
pnts[n++].y = top; pnts[n++].y = top;
} }
pnts[n].x = tabLeft; pnts[n++].y = tabTop + 2; pnts[n].x = tabLeft; pnts[n++].y = tabTop + 2;
pnts[n].x = tabLeft + 2; pnts[n++].y = tabTop; pnts[n].x = tabLeft + 2; pnts[n++].y = tabTop;
pnts[n].x = tabRight - 1; pnts[n++].y = tabTop; pnts[n].x = tabRight - 1; pnts[n++].y = tabTop;
dc.DrawLines(n, pnts); dc.DrawLines(n, pnts);
dc.SetPen(*(m_view->GetShadowPen())); dc.SetPen(*(m_view->GetShadowPen()));
if (GetRowPosition() >= maxPositions - 1) if (GetRowPosition() >= maxPositions - 1)
{ {
dc.DrawLine( dc.DrawLine(
tabRight, tabRight,
(tabTop + 2), (tabTop + 2),
tabRight, tabRight,
bottom bottom
); );
dc.DrawLine( dc.DrawLine(
tabRight, tabRight,
bottom, bottom,
(tabRight - m_view->GetHorizontalTabOffset()), (tabRight - m_view->GetHorizontalTabOffset()),
bottom bottom
); );
} }
else else
{ {
if (tabBelowRight && tabBelowRight->IsSelected()) if (tabBelowRight && tabBelowRight->IsSelected())
{ {
dc.DrawLine( dc.DrawLine(
tabRight, tabRight,
(long)raisedTop, (long)raisedTop,
tabRight, tabRight,
tabTop + 1 tabTop + 1
); );
} }
else else
{ {
dc.DrawLine( dc.DrawLine(
tabRight, tabRight,
top - 1, top - 1,
tabRight, tabRight,
tabTop + 1 tabTop + 1
); );
} }
} }
dc.SetPen(*wxBLACK_PEN); dc.SetPen(*wxBLACK_PEN);
dc.DrawPoint( dc.DrawPoint(
tabRight, tabRight,
tabTop + 1 tabTop + 1
); );
dc.DrawPoint( dc.DrawPoint(
tabRight + 1, tabRight + 1,
tabTop + 2 tabTop + 2
); );
if (GetRowPosition() >= maxPositions - 1) if (GetRowPosition() >= maxPositions - 1)
{ {
// draw right hand edge to bottom of view // draw right hand edge to bottom of view
dc.DrawLine( dc.DrawLine(
tabRight + 1, tabRight + 1,
bottom + 1, bottom + 1,
tabRight + 1, tabRight + 1,
tabTop + 2 tabTop + 2
); );
dc.DrawLine( dc.DrawLine(
tabRight + 1, tabRight + 1,
bottom + 1, bottom + 1,
(tabRight - m_view->GetHorizontalTabOffset()), (tabRight - m_view->GetHorizontalTabOffset()),
bottom + 1 bottom + 1
); );
} }
else else
{ {
// draw right hand edge of TAB // draw right hand edge of TAB
if (tabBelowRight && tabBelowRight->IsSelected()) if (tabBelowRight && tabBelowRight->IsSelected())
{ {
dc.DrawLine( dc.DrawLine(
tabRight + 1, tabRight + 1,
(long)(raisedTop - 1), (long)(raisedTop - 1),
tabRight + 1, tabRight + 1,
tabTop + 2 tabTop + 2
); );
} }
else else
{ {
dc.DrawLine( dc.DrawLine(
tabRight + 1, tabRight + 1,
top - 1, top - 1,
tabRight + 1, tabRight + 1,
tabTop + 2 tabTop + 2
); );
} }
} }
} }
// Draw centered text // Draw centered text
dc.SetPen(*wxBLACK_PEN); dc.SetPen(*wxBLACK_PEN);
if (m_isSelected) if (m_isSelected)
{ {
dc.SetFont(*(m_view->GetSelectedTabFont())); dc.SetFont(*(m_view->GetSelectedTabFont()));
} }
else else
{ {
dc.SetFont(*(GetFont())); dc.SetFont(*(GetFont()));
} }
wxColour col(m_view->GetTextColour()); wxColour col(m_view->GetTextColour());
dc.SetTextForeground(col); dc.SetTextForeground(col);
dc.SetBackgroundMode(wxTRANSPARENT); dc.SetBackgroundMode(wxTRANSPARENT);
long textWidth, textHeight; long textWidth, textHeight;
dc.GetTextExtent(GetLabel(), &textWidth, &textHeight); dc.GetTextExtent(GetLabel(), &textWidth, &textHeight);
float textX = (tabLeft + tabRight - textWidth) / 2; float textX = (tabLeft + tabRight - textWidth) / 2;
float textY = (tabInc + tabTop + m_view->GetVerticalTabTextSpacing()); float textY = (tabInc + tabTop + m_view->GetVerticalTabTextSpacing());
dc.DrawText(GetLabel(), (long)textX, (long)textY); dc.DrawText(GetLabel(), (long)textX, (long)textY);
#endif #endif
} }
@@ -790,82 +790,82 @@ void wxTabView::Draw(wxDC& dc)
if (GetNumberOfTabs() == 0) if (GetNumberOfTabs() == 0)
return; return;
// Draw top margin area (beneath tabs and above view area) // Draw top margin area (beneath tabs and above view area)
if (GetTabStyle() & wxTAB_STYLE_COLOUR_INTERIOR) if (GetTabStyle() & wxTAB_STYLE_COLOUR_INTERIOR)
{ {
dc.SetPen(*wxTRANSPARENT_PEN); dc.SetPen(*wxTRANSPARENT_PEN);
dc.SetBrush(*GetBackgroundBrush()); dc.SetBrush(*GetBackgroundBrush());
// Add 1 because the pen is transparent. Under Motif, may be different. // Add 1 because the pen is transparent. Under Motif, may be different.
dc.DrawRectangle( dc.DrawRectangle(
m_tabViewRect.x, m_tabViewRect.x,
(m_tabViewRect.y - m_topMargin), (m_tabViewRect.y - m_topMargin),
(m_tabViewRect.width + 1), (m_tabViewRect.width + 1),
(m_topMargin + 1) (m_topMargin + 1)
); );
} }
// Draw layers in reverse order // Draw layers in reverse order
wxNode *node = m_layers.Last(); wxNode *node = m_layers.Last();
while (node) while (node)
{ {
wxTabLayer *layer = (wxTabLayer *)node->Data(); wxTabLayer *layer = (wxTabLayer *)node->Data();
wxNode *node2 = layer->First(); wxNode *node2 = layer->First();
while (node2) while (node2)
{ {
wxTabControl *control = (wxTabControl *)node2->Data(); wxTabControl *control = (wxTabControl *)node2->Data();
control->OnDraw(dc, (node2->Next() == NULL)); control->OnDraw(dc, (node2->Next() == NULL));
node2 = node2->Next(); node2 = node2->Next();
} }
node = node->Previous(); node = node->Previous();
} }
#ifndef wxUSE_NEW_METHOD #ifndef wxUSE_NEW_METHOD
if (GetTabStyle() & wxTAB_STYLE_DRAW_BOX) if (GetTabStyle() & wxTAB_STYLE_DRAW_BOX)
{ {
dc.SetPen(* GetShadowPen()); dc.SetPen(* GetShadowPen());
// Draw bottom line // Draw bottom line
dc.DrawLine( dc.DrawLine(
(GetViewRect().x + 1), (GetViewRect().x + 1),
(GetViewRect().y + GetViewRect().height), (GetViewRect().y + GetViewRect().height),
(GetViewRect().x + GetViewRect().width + 1), (GetViewRect().x + GetViewRect().width + 1),
(GetViewRect().y + GetViewRect().height) (GetViewRect().y + GetViewRect().height)
); );
// Draw right line // Draw right line
dc.DrawLine( dc.DrawLine(
(GetViewRect().x + GetViewRect().width), (GetViewRect().x + GetViewRect().width),
(GetViewRect().y - GetTopMargin() + 1), (GetViewRect().y - GetTopMargin() + 1),
(GetViewRect().x + GetViewRect().width), (GetViewRect().x + GetViewRect().width),
(GetViewRect().y + GetViewRect().height) (GetViewRect().y + GetViewRect().height)
); );
dc.SetPen(* wxBLACK_PEN); dc.SetPen(* wxBLACK_PEN);
// Draw bottom line // Draw bottom line
dc.DrawLine( dc.DrawLine(
(GetViewRect().x), (GetViewRect().x),
(GetViewRect().y + GetViewRect().height + 1), (GetViewRect().y + GetViewRect().height + 1),
#if defined(__WXMOTIF__) #if defined(__WXMOTIF__)
(GetViewRect().x + GetViewRect().width + 1), (GetViewRect().x + GetViewRect().width + 1),
#else #else
(GetViewRect().x + GetViewRect().width + 2), (GetViewRect().x + GetViewRect().width + 2),
#endif #endif
(GetViewRect().y + GetViewRect().height + 1) (GetViewRect().y + GetViewRect().height + 1)
); );
// Draw right line // Draw right line
dc.DrawLine( dc.DrawLine(
(GetViewRect().x + GetViewRect().width + 1), (GetViewRect().x + GetViewRect().width + 1),
(GetViewRect().y - GetTopMargin()), (GetViewRect().y - GetTopMargin()),
(GetViewRect().x + GetViewRect().width + 1), (GetViewRect().x + GetViewRect().width + 1),
(GetViewRect().y + GetViewRect().height + 1) (GetViewRect().y + GetViewRect().height + 1)
); );
} }
#endif #endif
} }
@@ -875,7 +875,7 @@ bool wxTabView::OnEvent(wxMouseEvent& event)
if (!event.LeftDown()) if (!event.LeftDown())
return FALSE; return FALSE;
float x, y; long x, y;
event.Position(&x, &y); event.Position(&x, &y);
wxTabControl *hitControl = (wxTabControl *) NULL; wxTabControl *hitControl = (wxTabControl *) NULL;

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
@@ -214,14 +214,15 @@ void wxDialog::OnOK( wxCommandEvent &WXUNUSED(event) )
void wxDialog::OnPaint( wxPaintEvent& WXUNUSED(event) ) void wxDialog::OnPaint( wxPaintEvent& WXUNUSED(event) )
{ {
// yes // yes
} }
bool wxDialog::OnClose() void wxDialog::OnCloseWindow(wxCloseEvent& event)
{ {
static wxList closing; static wxList closing;
if (closing.Member(this)) return FALSE; // no loops if (closing.Member(this))
return; // no loops
closing.Append(this); closing.Append(this);
@@ -230,7 +231,8 @@ bool wxDialog::OnClose()
GetEventHandler()->ProcessEvent(cancelEvent); GetEventHandler()->ProcessEvent(cancelEvent);
closing.DeleteObject(this); closing.DeleteObject(this);
return FALSE; if ( event.CanVeto() )
event.Veto();
} }
bool wxDialog::Destroy() bool wxDialog::Destroy()
@@ -240,14 +242,6 @@ bool wxDialog::Destroy()
return TRUE; return TRUE;
} }
void wxDialog::OnCloseWindow( wxCloseEvent& event )
{
if (GetEventHandler()->OnClose() || event.GetForce())
{
this->Destroy();
}
}
void wxDialog::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height ) void wxDialog::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height )
{ {
// due to a bug in gtk, x,y are always 0 // due to a bug in gtk, x,y are always 0
@@ -295,7 +289,7 @@ void wxDialog::OnSize( wxSizeEvent &WXUNUSED(event) )
wxWindow *win = (wxWindow *)node->Data(); wxWindow *win = (wxWindow *)node->Data();
if (!wxIS_KIND_OF(win,wxFrame) && !wxIS_KIND_OF(win,wxDialog)) if (!wxIS_KIND_OF(win,wxFrame) && !wxIS_KIND_OF(win,wxDialog))
{ {
// it's the second one: do nothing // it's the second one: do nothing
if (child) return; if (child) return;
child = win; child = win;
} }

View File

@@ -104,7 +104,6 @@ static gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventC
BEGIN_EVENT_TABLE(wxFrame, wxWindow) BEGIN_EVENT_TABLE(wxFrame, wxWindow)
EVT_SIZE(wxFrame::OnSize) EVT_SIZE(wxFrame::OnSize)
EVT_CLOSE(wxFrame::OnCloseWindow)
EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight) EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight)
END_EVENT_TABLE() END_EVENT_TABLE()
@@ -226,11 +225,6 @@ bool wxFrame::Show( bool show )
return wxWindow::Show( show ); return wxWindow::Show( show );
} }
void wxFrame::OnCloseWindow( wxCloseEvent &event )
{
if (GetEventHandler()->OnClose() || event.GetForce()) this->Destroy();
}
bool wxFrame::Destroy() bool wxFrame::Destroy()
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); wxASSERT_MSG( (m_widget != NULL), "invalid frame" );

View File

@@ -1716,9 +1716,15 @@ bool wxWindow::Close( bool force )
wxCloseEvent event(wxEVT_CLOSE_WINDOW, m_windowId); wxCloseEvent event(wxEVT_CLOSE_WINDOW, m_windowId);
event.SetEventObject(this); event.SetEventObject(this);
event.SetForce(force); event.SetCanVeto(!force);
return GetEventHandler()->ProcessEvent(event); (void)GetEventHandler()->ProcessEvent(event);
// when we're forced to close we do it anyhow, otherwise only if the
// application didn't forbid it (if the event wasn't processed, GetVeto()
// will return FALSE too)
if ( force || !event.GetVeto() )
Destroy();
} }
bool wxWindow::Destroy() bool wxWindow::Destroy()
@@ -2235,11 +2241,6 @@ bool wxWindow::AcceptsFocus() const
return IsEnabled() && IsShown() && m_acceptsFocus; return IsEnabled() && IsShown() && m_acceptsFocus;
} }
bool wxWindow::OnClose()
{
return TRUE;
}
void wxWindow::AddChild( wxWindow *child ) void wxWindow::AddChild( wxWindow *child )
{ {
wxCHECK_RET( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), "invalid window" );

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
@@ -214,14 +214,15 @@ void wxDialog::OnOK( wxCommandEvent &WXUNUSED(event) )
void wxDialog::OnPaint( wxPaintEvent& WXUNUSED(event) ) void wxDialog::OnPaint( wxPaintEvent& WXUNUSED(event) )
{ {
// yes // yes
} }
bool wxDialog::OnClose() void wxDialog::OnCloseWindow(wxCloseEvent& event)
{ {
static wxList closing; static wxList closing;
if (closing.Member(this)) return FALSE; // no loops if (closing.Member(this))
return; // no loops
closing.Append(this); closing.Append(this);
@@ -230,7 +231,8 @@ bool wxDialog::OnClose()
GetEventHandler()->ProcessEvent(cancelEvent); GetEventHandler()->ProcessEvent(cancelEvent);
closing.DeleteObject(this); closing.DeleteObject(this);
return FALSE; if ( event.CanVeto() )
event.Veto();
} }
bool wxDialog::Destroy() bool wxDialog::Destroy()
@@ -240,14 +242,6 @@ bool wxDialog::Destroy()
return TRUE; return TRUE;
} }
void wxDialog::OnCloseWindow( wxCloseEvent& event )
{
if (GetEventHandler()->OnClose() || event.GetForce())
{
this->Destroy();
}
}
void wxDialog::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height ) void wxDialog::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height )
{ {
// due to a bug in gtk, x,y are always 0 // due to a bug in gtk, x,y are always 0
@@ -295,7 +289,7 @@ void wxDialog::OnSize( wxSizeEvent &WXUNUSED(event) )
wxWindow *win = (wxWindow *)node->Data(); wxWindow *win = (wxWindow *)node->Data();
if (!wxIS_KIND_OF(win,wxFrame) && !wxIS_KIND_OF(win,wxDialog)) if (!wxIS_KIND_OF(win,wxFrame) && !wxIS_KIND_OF(win,wxDialog))
{ {
// it's the second one: do nothing // it's the second one: do nothing
if (child) return; if (child) return;
child = win; child = win;
} }

View File

@@ -104,7 +104,6 @@ static gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventC
BEGIN_EVENT_TABLE(wxFrame, wxWindow) BEGIN_EVENT_TABLE(wxFrame, wxWindow)
EVT_SIZE(wxFrame::OnSize) EVT_SIZE(wxFrame::OnSize)
EVT_CLOSE(wxFrame::OnCloseWindow)
EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight) EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight)
END_EVENT_TABLE() END_EVENT_TABLE()
@@ -226,11 +225,6 @@ bool wxFrame::Show( bool show )
return wxWindow::Show( show ); return wxWindow::Show( show );
} }
void wxFrame::OnCloseWindow( wxCloseEvent &event )
{
if (GetEventHandler()->OnClose() || event.GetForce()) this->Destroy();
}
bool wxFrame::Destroy() bool wxFrame::Destroy()
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); wxASSERT_MSG( (m_widget != NULL), "invalid frame" );

View File

@@ -1716,9 +1716,15 @@ bool wxWindow::Close( bool force )
wxCloseEvent event(wxEVT_CLOSE_WINDOW, m_windowId); wxCloseEvent event(wxEVT_CLOSE_WINDOW, m_windowId);
event.SetEventObject(this); event.SetEventObject(this);
event.SetForce(force); event.SetCanVeto(!force);
return GetEventHandler()->ProcessEvent(event); (void)GetEventHandler()->ProcessEvent(event);
// when we're forced to close we do it anyhow, otherwise only if the
// application didn't forbid it (if the event wasn't processed, GetVeto()
// will return FALSE too)
if ( force || !event.GetVeto() )
Destroy();
} }
bool wxWindow::Destroy() bool wxWindow::Destroy()
@@ -2235,11 +2241,6 @@ bool wxWindow::AcceptsFocus() const
return IsEnabled() && IsShown() && m_acceptsFocus; return IsEnabled() && IsShown() && m_acceptsFocus;
} }
bool wxWindow::OnClose()
{
return TRUE;
}
void wxWindow::AddChild( wxWindow *child ) void wxWindow::AddChild( wxWindow *child )
{ {
wxCHECK_RET( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), "invalid window" );