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
virtual bool OnClose(bool deleteWindow);
#ifdef WXWIN_COMPATIBILITY
// 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
virtual bool ProcessEvent(wxEvent& event);
@@ -197,7 +200,8 @@ class WXDLLEXPORT wxView: public wxEvtHandler
// The function then notifies the document manager.
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
virtual wxPrintout *OnCreatePrintout(void);

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling
// RCS-ID: $Id$
// Copyright: (c) Robert Roebling
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __GTKMINIFRAMEH__
@@ -30,39 +30,39 @@ class wxMiniFrame;
class wxMiniFrame: public wxFrame
{
DECLARE_DYNAMIC_CLASS(wxMiniFrame)
DECLARE_DYNAMIC_CLASS(wxMiniFrame)
public:
inline wxMiniFrame(void) {}
inline wxMiniFrame(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)
{
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);
wxMiniFrame() {}
wxMiniFrame(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)
{
Create(parent, id, title, pos, size, style, name);
}
// 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;
int m_oldX,m_oldY;
int m_diffX,m_diffY;
// implementation
bool m_isDragging;
int m_oldX,m_oldY;
int m_diffX,m_diffY;
void DrawFrame( int x, int y );
void OnPaint( wxPaintEvent &event );
void OnMouse( wxMouseEvent &event );
void DrawFrame( int x, int y );
void OnPaint( wxPaintEvent &event );
void OnMouse( wxMouseEvent &event );
DECLARE_EVENT_TABLE()
DECLARE_EVENT_TABLE()
};
#endif

View File

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

View File

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

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling
// RCS-ID: $Id$
// Copyright: (c) Robert Roebling
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __GTKMINIFRAMEH__
@@ -30,39 +30,39 @@ class wxMiniFrame;
class wxMiniFrame: public wxFrame
{
DECLARE_DYNAMIC_CLASS(wxMiniFrame)
DECLARE_DYNAMIC_CLASS(wxMiniFrame)
public:
inline wxMiniFrame(void) {}
inline wxMiniFrame(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)
{
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);
wxMiniFrame() {}
wxMiniFrame(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)
{
Create(parent, id, title, pos, size, style, name);
}
// 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;
int m_oldX,m_oldY;
int m_diffX,m_diffY;
// implementation
bool m_isDragging;
int m_oldX,m_oldY;
int m_diffX,m_diffY;
void DrawFrame( int x, int y );
void OnPaint( wxPaintEvent &event );
void OnMouse( wxMouseEvent &event );
void DrawFrame( int x, int y );
void OnPaint( wxPaintEvent &event );
void OnMouse( wxMouseEvent &event );
DECLARE_EVENT_TABLE()
DECLARE_EVENT_TABLE()
};
#endif

View File

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

View File

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

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -214,14 +214,15 @@ void wxDialog::OnOK( wxCommandEvent &WXUNUSED(event) )
void wxDialog::OnPaint( wxPaintEvent& WXUNUSED(event) )
{
// yes
// yes
}
bool wxDialog::OnClose()
void wxDialog::OnCloseWindow(wxCloseEvent& event)
{
static wxList closing;
if (closing.Member(this)) return FALSE; // no loops
if (closing.Member(this))
return; // no loops
closing.Append(this);
@@ -230,7 +231,8 @@ bool wxDialog::OnClose()
GetEventHandler()->ProcessEvent(cancelEvent);
closing.DeleteObject(this);
return FALSE;
if ( event.CanVeto() )
event.Veto();
}
bool wxDialog::Destroy()
@@ -240,14 +242,6 @@ bool wxDialog::Destroy()
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 )
{
// 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();
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;
child = win;
}

View File

@@ -104,7 +104,6 @@ static gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventC
BEGIN_EVENT_TABLE(wxFrame, wxWindow)
EVT_SIZE(wxFrame::OnSize)
EVT_CLOSE(wxFrame::OnCloseWindow)
EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight)
END_EVENT_TABLE()
@@ -226,11 +225,6 @@ bool wxFrame::Show( bool show )
return wxWindow::Show( show );
}
void wxFrame::OnCloseWindow( wxCloseEvent &event )
{
if (GetEventHandler()->OnClose() || event.GetForce()) this->Destroy();
}
bool wxFrame::Destroy()
{
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);
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()
@@ -2235,11 +2241,6 @@ bool wxWindow::AcceptsFocus() const
return IsEnabled() && IsShown() && m_acceptsFocus;
}
bool wxWindow::OnClose()
{
return TRUE;
}
void wxWindow::AddChild( wxWindow *child )
{
wxCHECK_RET( (m_widget != NULL), "invalid window" );

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -214,14 +214,15 @@ void wxDialog::OnOK( wxCommandEvent &WXUNUSED(event) )
void wxDialog::OnPaint( wxPaintEvent& WXUNUSED(event) )
{
// yes
// yes
}
bool wxDialog::OnClose()
void wxDialog::OnCloseWindow(wxCloseEvent& event)
{
static wxList closing;
if (closing.Member(this)) return FALSE; // no loops
if (closing.Member(this))
return; // no loops
closing.Append(this);
@@ -230,7 +231,8 @@ bool wxDialog::OnClose()
GetEventHandler()->ProcessEvent(cancelEvent);
closing.DeleteObject(this);
return FALSE;
if ( event.CanVeto() )
event.Veto();
}
bool wxDialog::Destroy()
@@ -240,14 +242,6 @@ bool wxDialog::Destroy()
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 )
{
// 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();
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;
child = win;
}

View File

@@ -104,7 +104,6 @@ static gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventC
BEGIN_EVENT_TABLE(wxFrame, wxWindow)
EVT_SIZE(wxFrame::OnSize)
EVT_CLOSE(wxFrame::OnCloseWindow)
EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight)
END_EVENT_TABLE()
@@ -226,11 +225,6 @@ bool wxFrame::Show( bool show )
return wxWindow::Show( show );
}
void wxFrame::OnCloseWindow( wxCloseEvent &event )
{
if (GetEventHandler()->OnClose() || event.GetForce()) this->Destroy();
}
bool wxFrame::Destroy()
{
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);
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()
@@ -2235,11 +2241,6 @@ bool wxWindow::AcceptsFocus() const
return IsEnabled() && IsShown() && m_acceptsFocus;
}
bool wxWindow::OnClose()
{
return TRUE;
}
void wxWindow::AddChild( wxWindow *child )
{
wxCHECK_RET( (m_widget != NULL), "invalid window" );