1. wxTimer change - now generates EVT_TIMER()

2. wxStatusBar reorganisation


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5848 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2000-02-05 01:57:38 +00:00
parent 85401ffe5c
commit ed79198695
18 changed files with 606 additions and 287 deletions

View File

@@ -69,8 +69,9 @@ extern const wxEventType wxEVT_COMMAND_TOOL_RCLICKED;
extern const wxEventType wxEVT_COMMAND_TOOL_ENTER;
extern const wxEventType wxEVT_COMMAND_SPINCTRL_UPDATED;
/* Sockets send events, too */
/* Sockets and timers send events, too */
extern const wxEventType wxEVT_SOCKET;
extern const wxEventType wxEVT_TIMER;
/* Mouse event types */
extern const wxEventType wxEVT_LEFT_DOWN;
@@ -283,6 +284,9 @@ const wxEventType wxEVT_COMMAND_SPINCTRL_UPDATED = wxEVT_FIRST + 18;
/* Sockets send events, too */
const wxEventType wxEVT_SOCKET = wxEVT_FIRST + 50;
/* And timers do as well */
const wxEventType wxEVT_TIMER = wxEVT_FIRST + 80;
/* Mouse event types */
const wxEventType wxEVT_LEFT_DOWN = wxEVT_FIRST + 100;
const wxEventType wxEVT_LEFT_UP = wxEVT_FIRST + 101;

View File

@@ -1,53 +1,66 @@
/////////////////////////////////////////////////////////////////////////////
// Name: statusbr.h
// Purpose: wxStatusBar class
// Name: wx/generic/statusbr.h
// Purpose: wxStatusBarGeneric class
// Author: Julian Smart
// Modified by:
// Modified by: VZ at 05.02.00 to derive from wxStatusBarBase
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) Julian Smart and Markus Holzem
// Licence: wxWindows license
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifndef __STATUSBRH_G__
#define __STATUSBRH_G__
#ifndef _WX_GENERIC_STATUSBR_H_
#define _WX_GENERIC_STATUSBR_H_
#ifdef __GNUG__
#pragma interface "statusbr.h"
#endif
#include "wx/window.h"
#include "wx/pen.h"
#include "wx/font.h"
WXDLLEXPORT_DATA(extern const wxChar*) wxPanelNameStr;
class WXDLLEXPORT wxStatusBar: public wxWindow
class WXDLLEXPORT wxStatusBarGeneric : public wxStatusBarBase
{
DECLARE_DYNAMIC_CLASS(wxStatusBar)
public:
wxStatusBar(void);
inline wxStatusBar(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPanelNameStr)
wxStatusBarGeneric();
wxStatusBarGeneric(wxWindow *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPanelNameStr)
{
Create(parent, id, pos, size, style, name);
}
wxStatusBarGeneric(wxWindow *parent,
wxWindowID id,
long style,
const wxString& name = wxPanelNameStr)
{
Create(parent, id, style, name);
}
~wxStatusBar();
~wxStatusBarGeneric();
bool Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPanelNameStr);
const wxPoint& WXUNUSED(pos) = wxDefaultPosition,
const wxSize& WXUNUSED(size) = wxDefaultSize,
long style = 0,
const wxString& name = wxPanelNameStr)
{
return Create(parent, id, style, name);
}
bool Create(wxWindow *parent, wxWindowID id,
long style = 0,
const wxString& name = wxPanelNameStr);
// Create status line
virtual void SetFieldsCount(int number=1, const int widths[] = (const int *) NULL);
inline int GetFieldsCount() const { return m_nFields; }
virtual void SetFieldsCount(int number = 1,
const int *widths = (const int *) NULL);
int GetFieldsCount() const { return m_nFields; }
// Set status line text
virtual void SetStatusText(const wxString& text, int number = 0);
@@ -56,20 +69,24 @@ public:
// Set status line widths
virtual void SetStatusWidths(int n, const int widths_field[]);
virtual void DrawFieldText(wxDC& dc, int i);
virtual void DrawField(wxDC& dc, int i);
// Get the position and size of the field's internal bounding rectangle
virtual bool GetFieldRect(int i, wxRect& rect) const;
inline int GetBorderX() const { return m_borderX; }
inline int GetBorderY() const { return m_borderY; }
inline void SetBorderX(int x);
inline void SetBorderY(int y);
// sets the minimal vertical size of the status bar
virtual void SetMinHeight(int height);
virtual int GetBorderX() const { return m_borderX; }
virtual int GetBorderY() const { return m_borderY; }
////////////////////////////////////////////////////////////////////////
// Implementation
virtual void DrawFieldText(wxDC& dc, int i);
virtual void DrawField(wxDC& dc, int i);
void SetBorderX(int x);
void SetBorderY(int y);
void OnPaint(wxPaintEvent& event);
virtual void InitColours();
@@ -78,8 +95,6 @@ public:
void OnSysColourChanged(wxSysColourChangedEvent& event);
protected:
int * m_statusWidths;
int m_nFields;
wxString * m_statusStrings;
int m_borderX;
int m_borderY;
@@ -87,8 +102,10 @@ protected:
wxPen m_mediumShadowPen;
wxPen m_hilightPen;
private:
DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS(wxStatusBarGeneric)
};
#endif
// __STATUSBRH_G__
// _WX_GENERIC_STATUSBR_H_

View File

@@ -1,10 +1,10 @@
/////////////////////////////////////////////////////////////////////////////
// Name: timer.h
// Name: wx/gtk/timer.h
// Purpose:
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@@ -22,7 +22,9 @@
class wxTimer : public wxTimerBase
{
public:
wxTimer();
wxTimer() { Init(); }
wxTimer(wxEvtHandler *owner, int id = -1) : wxTimerBase(owner, id)
{ Init(); }
~wxTimer();
virtual bool Start( int millisecs = -1, bool oneShot = FALSE );
@@ -31,6 +33,8 @@ public:
virtual bool IsRunning() const { return m_tag != -1; }
protected:
void Init();
int m_tag;
private:

View File

@@ -1,10 +1,10 @@
/////////////////////////////////////////////////////////////////////////////
// Name: timer.h
// Name: wx/gtk/timer.h
// Purpose:
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@@ -22,7 +22,9 @@
class wxTimer : public wxTimerBase
{
public:
wxTimer();
wxTimer() { Init(); }
wxTimer(wxEvtHandler *owner, int id = -1) : wxTimerBase(owner, id)
{ Init(); }
~wxTimer();
virtual bool Start( int millisecs = -1, bool oneShot = FALSE );
@@ -31,6 +33,8 @@ public:
virtual bool IsRunning() const { return m_tag != -1; }
protected:
void Init();
int m_tag;
private:

View File

@@ -226,6 +226,15 @@ inline void wxRGBToColour(wxColour& c, COLORREF rgb)
c.Set(GetRValue(rgb), GetGValue(rgb), GetBValue(rgb));
}
// copy Windows RECT to our wxRect
inline void wxCopyRECTToRect(const RECT& r, wxRect& rect)
{
rect.y = r.top;
rect.x = r.left;
rect.width = r.right - r.left;
rect.height = r.bottom - r.top;
}
// translations between HIMETRIC units (which OLE likes) and pixels (which are
// liked by all the others) - implemented in msw/utilsexc.cpp
extern void HIMETRICToPixel(LONG *x, LONG *y);

View File

@@ -16,38 +16,57 @@
#pragma interface "statbr95.h"
#endif
#if wxUSE_NATIVE_STATUSBAR
#if wxUSE_NATIVE_STATUSBAR
class WXDLLEXPORT wxStatusBar95 : public wxStatusBar
class WXDLLEXPORT wxStatusBar95 : public wxStatusBarBase
{
DECLARE_DYNAMIC_CLASS(wxStatusBar95);
public:
// ctors
wxStatusBar95();
wxStatusBar95(wxWindow *parent, wxWindowID id = -1, long style = wxST_SIZEGRIP);
// ctors and such
wxStatusBar95();
wxStatusBar95(wxWindow *parent,
wxWindowID id = -1,
long style = wxST_SIZEGRIP,
const wxString& name = wxEmptyString)
{
(void)Create(parent, id, style, name);
}
// create status line
bool Create(wxWindow *parent, wxWindowID id = -1, long style = wxST_SIZEGRIP);
bool Create(wxWindow *parent,
wxWindowID id = -1,
long style = wxST_SIZEGRIP,
const wxString& name = wxEmptyString);
// a status line can have several (<256) fields numbered from 0
virtual void SetFieldsCount(int number = 1, const int widths[] = NULL);
virtual ~wxStatusBar95();
// each field of status line has it's own text
virtual void SetStatusText(const wxString& text, int number = 0);
virtual wxString GetStatusText(int number = 0) const;
// a status line can have several (<256) fields numbered from 0
virtual void SetFieldsCount(int number = 1, const int *widths = NULL);
// set status line fields' widths
virtual void SetStatusWidths(int n, const int widths_field[]);
// each field of status line has it's own text
virtual void SetStatusText(const wxString& text, int number = 0);
virtual wxString GetStatusText(int number = 0) const;
// we're going to process WM_SIZE (of the parent window)
void OnSize(wxSizeEvent& event);
// set status line fields' widths
virtual void SetStatusWidths(int n, const int widths_field[]);
DECLARE_EVENT_TABLE()
// sets the minimal vertical size of the status bar
virtual void SetMinHeight(int height);
// get the position and size of the field's internal bounding rectangle
virtual bool GetFieldRect(int i, wxRect& rect) const;
// get the border size
virtual int GetBorderX() const;
virtual int GetBorderY() const;
void OnSize(wxSizeEvent& event);
protected:
void CopyFieldsWidth(const int widths[]);
void SetFieldsWidth();
void CopyFieldsWidth(const int widths[]);
void SetFieldsWidth();
private:
DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS(wxStatusBar95);
};
#endif // wxUSE_NATIVE_STATUSBAR

View File

@@ -21,7 +21,9 @@ class WXDLLEXPORT wxTimer : public wxTimerBase
friend void wxProcessTimer(wxTimer& timer);
public:
wxTimer();
wxTimer() { Init(); }
wxTimer(wxEvtHandler *owner, int id = -1) : wxTimerBase(owner, id)
{ Init(); }
~wxTimer();
virtual bool Start(int milliseconds = -1, bool oneShot = FALSE);
@@ -30,6 +32,8 @@ public:
virtual bool IsRunning() const { return m_id != 0; }
protected:
void Init();
long m_id;
private:

View File

@@ -1,7 +1,92 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/statusbr.h
// Purpose: wxStatusBar class interface
// Author: Vadim Zeitlin
// Modified by:
// Created: 05.02.00
// RCS-ID: $Id$
// Copyright: (c) wxWindows team
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_STATUSBR_H_BASE_
#define _WX_STATUSBR_H_BASE_
#include "wx/generic/statusbr.h"
#include "wx/window.h"
// ----------------------------------------------------------------------------
// wxStatusBar: a window near the bottom of the frame used for status info
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxStatusBarBase : public wxWindow
{
public:
wxStatusBarBase() { m_statusWidths = NULL; }
// get/set the number of fields
virtual void SetFieldsCount(int number = 1,
const int *widths = (const int *) NULL) = 0;
int GetFieldsCount() const { return m_nFields; }
// get/set the text of the given field
virtual void SetStatusText(const wxString& text, int number = 0) = 0;
virtual wxString GetStatusText(int number = 0) const = 0;
// set status line widths (n should be the same as field count)
virtual void SetStatusWidths(int n, const int widths[]) = 0;
// Get the position and size of the field's internal bounding rectangle
virtual bool GetFieldRect(int i, wxRect& rect) const = 0;
// sets the minimal vertical size of the status bar
virtual void SetMinHeight(int height) = 0;
// get the dimensions of the horizontal and vertical borders
virtual int GetBorderX() const = 0;
virtual int GetBorderY() const = 0;
protected:
int m_nFields; // the current number of fields
int *m_statusWidths; // the width (if !NULL) of the fields
};
#if defined(__WIN32__) && wxUSE_NATIVE_STATUSBAR
#include "wx/msw/statbr95.h"
typedef wxStatusBar95 wxStatusBarReal;
#else
#include "wx/generic/statusbr.h"
typedef wxStatusBarGeneric wxStatusBarReal;
#endif
// we can't just typedef wxStatusBar to be one of 95/Generic because we should
// be able to forward declare it (done in several places) and because wxWin
// RTTI wouldn't work then
class wxStatusBar : public wxStatusBarReal
{
public:
wxStatusBar() { }
wxStatusBar(wxWindow *parent,
wxWindowID id,
const wxPoint& WXUNUSED(pos) = wxDefaultPosition,
const wxSize& WXUNUSED(size) = wxDefaultSize,
long style = 0,
const wxString& name = wxPanelNameStr)
{
Create(parent, id, style, name);
}
wxStatusBar(wxWindow *parent,
wxWindowID id,
long style,
const wxString& name = wxPanelNameStr)
{
Create(parent, id, style, name);
}
private:
DECLARE_DYNAMIC_CLASS(wxStatusBar)
};
#endif
// _WX_STATUSBR_H_BASE_

View File

@@ -1,12 +1,13 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/timer.h
// Purpose: wxTimer class and global time-related functions
// Author: Julian Smart
// Modified by:
// Purpose: wxTimer, wxStopWatch and global time-related functions
// Author: Julian Smart (wxTimer), Sylvain Bougnoux (wxStopWatch)
// Modified by: Vadim Zeitlin (wxTimerBase)
// Guillermo Rodriguez (global clean up)
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart and Markus Holzem
// Licence: wxWindows license
// Copyright: (c) wxWindows team
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_TIMER_H_BASE_
@@ -19,6 +20,7 @@
#include "wx/setup.h"
#include "wx/object.h"
#include "wx/longlong.h"
#include "wx/event.h"
// ----------------------------------------------------------------------------
// wxTimer
@@ -28,7 +30,22 @@
class WXDLLEXPORT wxTimerBase : public wxObject
{
public:
wxTimerBase() { m_oneShot = FALSE; m_milli = 0; }
// ctors and initializers
// ----------------------
// default: if you don't call SetOwner(), your only chance to get timer
// notifications is to override Notify() in the derived class
wxTimerBase() { Init(); SetOwner(NULL); }
// ctor which allows to avoid having to override Notify() in the derived
// class: the owner will get timer notifications which can be handled with
// EVT_TIMER
wxTimerBase(wxEvtHandler *owner, int id = -1)
{ Init(); SetOwner(owner, -1); }
// same as ctor above
void SetOwner(wxEvtHandler *owner, int id = -1)
{ m_owner = owner; m_idTimer = id; }
// working with the timer
// ----------------------
@@ -51,8 +68,9 @@ public:
// stop the timer
virtual void Stop() = 0;
// override this in your wxTimer-derived class
virtual void Notify() = 0;
// override this in your wxTimer-derived class if you want to process timer
// messages in it, use non default ctor or SetOwner() otherwise
virtual void Notify();
// getting info
// ------------
@@ -73,10 +91,20 @@ public:
#endif // WXWIN_COMPATIBILITY_2
protected:
// common part of all ctors
void Init() { m_oneShot = FALSE; m_milli = 0; }
wxEvtHandler *m_owner;
int m_idTimer;
int m_milli; // the timer interval
bool m_oneShot; // TRUE if one shot
};
// ----------------------------------------------------------------------------
// wxTimer itself
// ----------------------------------------------------------------------------
#if defined(__WXMSW__)
#include "wx/msw/timer.h"
#elif defined(__WXMOTIF__)
@@ -94,7 +122,34 @@ protected:
#endif
// ----------------------------------------------------------------------------
// wxStopWatch
// wxTimerEvent
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxTimerEvent : public wxEvent
{
public:
wxTimerEvent(int id = 0, int interval = 0) : wxEvent(id)
{
m_eventType = wxEVT_TIMER;
m_interval = interval;
}
// accessors
int GetInterval() const { return m_interval; }
private:
int m_interval;
DECLARE_DYNAMIC_CLASS(wxTimerEvent)
};
typedef void (wxEvtHandler::*wxTimerEventFunction)(wxTimerEvent&);
#define EVT_TIMER(id, func) { wxEVT_TIMER, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTimerEventFunction) & func, NULL},
// ----------------------------------------------------------------------------
// wxStopWatch: measure time intervals with up to 1ms resolution
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxStopWatch
@@ -127,7 +182,6 @@ void WXDLLEXPORT wxStartTimer();
// -- DEPRECATED: use wxStopWatch instead
long WXDLLEXPORT wxGetElapsedTime(bool resetTimer = TRUE);
// ----------------------------------------------------------------------------
// global time functions
// ----------------------------------------------------------------------------

View File

@@ -338,20 +338,18 @@ wxStatusBar *wxFrameBase::OnCreateStatusBar(int number,
wxWindowID id,
const wxString& name)
{
wxStatusBar *statusBar = new wxStatusBar(this, id,
wxPoint(0, 0), wxSize(100, 20),
style, name);
wxStatusBar *statusBar = new wxStatusBar(this, id, style, name);
// Set the height according to the font and the border size
wxClientDC dc(statusBar);
dc.SetFont(statusBar->GetFont());
long y;
wxCoord y;
dc.GetTextExtent( "X", NULL, &y );
int height = (int)( (11*y)/10 + 2*statusBar->GetBorderY());
statusBar->SetSize( -1, -1, 100, height );
statusBar->SetSize( -1, -1, -1, height );
statusBar->SetFieldsCount(number);

View File

@@ -11,7 +11,7 @@
// RCS-ID: $Id$
// Copyright: (c) Julian Smart and Markus Holzem
// (c) 1999 Guillermo Rodriguez <guille@iies.es>
// Licence: wxWindows license
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// ============================================================================
@@ -57,6 +57,12 @@
#include <sys/timeb.h>
#endif
// ----------------------------------------------------------------------------
// wxWin macros
// ----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxTimerEvent, wxEvent)
// ----------------------------------------------------------------------------
// macros
// ----------------------------------------------------------------------------
@@ -72,11 +78,29 @@
#endif
#endif // HAVE_GETTIMEOFDAY
// ----------------------------------------------------------------------------
// prototypes
// ----------------------------------------------------------------------------
wxLongLong wxGetLocalTimeMillis();
// ============================================================================
// implementation
// ============================================================================
wxLongLong wxGetLocalTimeMillis();
// ----------------------------------------------------------------------------
// wxTimerBase
// ----------------------------------------------------------------------------
void wxTimerBase::Notify()
{
// the base class version generates an event if it has owner - which it
// should because otherwise nobody can process timer events
wxCHECK_RET( m_owner, _T("wxTimer::Notify() should be overridden.") );
wxTimerEvent event(m_idTimer, m_milli);
(void)m_owner->ProcessEvent(event);
}
// ----------------------------------------------------------------------------
// wxStopWatch

View File

@@ -1,12 +1,12 @@
/////////////////////////////////////////////////////////////////////////////
// Name: statusbr.cpp
// Purpose: wxStatusBar class implementation
// Name: generic/statusbr.cpp
// Purpose: wxStatusBarGeneric class implementation
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) Julian Smart and Markus Holzem
// Licence: wxWindows license
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -20,6 +20,8 @@
#pragma hdrstop
#endif
//#if !defined(__WIN32__) || !wxUSE_NATIVE_STATUSBAR
#ifndef WX_PRECOMP
#include "wx/setup.h"
#include "wx/frame.h"
@@ -34,18 +36,22 @@
#include "wx/msw/winundef.h"
#endif
IMPLEMENT_DYNAMIC_CLASS(wxStatusBar, wxWindow)
IMPLEMENT_DYNAMIC_CLASS(wxStatusBarGeneric, wxWindow)
BEGIN_EVENT_TABLE(wxStatusBar, wxWindow)
EVT_PAINT(wxStatusBar::OnPaint)
EVT_SYS_COLOUR_CHANGED(wxStatusBar::OnSysColourChanged)
#if !defined(__WIN32__) || !wxUSE_NATIVE_STATUSBAR
IMPLEMENT_DYNAMIC_CLASS(wxStatusBar, wxStatusBarGeneric)
#endif // Win32 && wxUSE_NATIVE_STATUSBAR
BEGIN_EVENT_TABLE(wxStatusBarGeneric, wxWindow)
EVT_PAINT(wxStatusBarGeneric::OnPaint)
EVT_SYS_COLOUR_CHANGED(wxStatusBarGeneric::OnSysColourChanged)
END_EVENT_TABLE()
// Default status border dimensions
#define wxTHICK_LINE_BORDER 2
#define wxTHICK_LINE_WIDTH 1
wxStatusBar::wxStatusBar(void)
wxStatusBarGeneric::wxStatusBarGeneric()
{
m_statusWidths = (int *) NULL;
m_statusStrings = (wxString *) NULL;
@@ -54,7 +60,7 @@ wxStatusBar::wxStatusBar(void)
m_borderY = wxTHICK_LINE_BORDER;
}
wxStatusBar::~wxStatusBar(void)
wxStatusBarGeneric::~wxStatusBarGeneric()
{
# ifdef __WXMSW__
SetFont(wxNullFont);
@@ -66,11 +72,10 @@ wxStatusBar::~wxStatusBar(void)
delete[] m_statusStrings;
}
bool wxStatusBar::Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos,
const wxSize& size,
long style,
const wxString& name)
bool wxStatusBarGeneric::Create(wxWindow *parent,
wxWindowID id,
long style,
const wxString& name)
{
m_statusWidths = (int *) NULL;
m_statusStrings = (wxString *) NULL;
@@ -78,7 +83,9 @@ bool wxStatusBar::Create(wxWindow *parent, wxWindowID id,
m_borderX = wxTHICK_LINE_BORDER;
m_borderY = wxTHICK_LINE_BORDER;
bool success = wxWindow::Create(parent, id, pos, size, style | wxTAB_TRAVERSAL, name);
bool success = wxWindow::Create(parent, id,
wxDefaultPosition, wxDefaultSize,
style | wxTAB_TRAVERSAL, name);
// Don't wish this to be found as a child
#ifndef __WXMAC__
@@ -91,7 +98,7 @@ bool wxStatusBar::Create(wxWindow *parent, wxWindowID id,
return success;
}
void wxStatusBar::SetFieldsCount(int number, const int widths[])
void wxStatusBarGeneric::SetFieldsCount(int number, const int widths[])
{
m_nFields = number;
@@ -107,11 +114,11 @@ void wxStatusBar::SetFieldsCount(int number, const int widths[])
for (i = 0; i < number; i++)
m_statusStrings[i] = "";
if ( widths )
SetStatusWidths(number, widths);
if ( widths )
SetStatusWidths(number, widths);
}
void wxStatusBar::SetStatusText(const wxString& text, int number)
void wxStatusBarGeneric::SetStatusText(const wxString& text, int number)
{
if ((number < 0) || (number >= m_nFields))
return;
@@ -119,23 +126,17 @@ void wxStatusBar::SetStatusText(const wxString& text, int number)
m_statusStrings[number] = text;
Refresh();
#ifdef __WXMSW__
// For some reason, this can cause major GDI problems - graphics
// all over the place. E.g. in print previewing.
// ::UpdateWindow((HWND) GetHWND());
#endif
}
wxString wxStatusBar::GetStatusText(int n) const
wxString wxStatusBarGeneric::GetStatusText(int n) const
{
if ((n < 0) || (n >= m_nFields))
return wxString("");
else
wxCHECK_MSG( (n >= 0) && (n < m_nFields), wxEmptyString,
_T("invalid status bar field index") );
return m_statusStrings[n];
}
void wxStatusBar::SetStatusWidths(int n, const int widths_field[])
void wxStatusBarGeneric::SetStatusWidths(int n, const int widths_field[])
{
// only set status widths, when n == number of statuswindows
if (n == m_nFields)
@@ -162,7 +163,7 @@ void wxStatusBar::SetStatusWidths(int n, const int widths_field[])
}
}
void wxStatusBar::OnPaint(wxPaintEvent& WXUNUSED(event) )
void wxStatusBarGeneric::OnPaint(wxPaintEvent& WXUNUSED(event) )
{
wxPaintDC dc(this);
@@ -179,7 +180,7 @@ void wxStatusBar::OnPaint(wxPaintEvent& WXUNUSED(event) )
# endif // MSW
}
void wxStatusBar::DrawFieldText(wxDC& dc, int i)
void wxStatusBarGeneric::DrawFieldText(wxDC& dc, int i)
{
int leftMargin = 2;
@@ -207,7 +208,7 @@ void wxStatusBar::DrawFieldText(wxDC& dc, int i)
dc.DestroyClippingRegion();
}
void wxStatusBar::DrawField(wxDC& dc, int i)
void wxStatusBarGeneric::DrawField(wxDC& dc, int i)
{
wxRect rect;
GetFieldRect(i, rect);
@@ -238,10 +239,10 @@ void wxStatusBar::DrawField(wxDC& dc, int i)
}
// Get the position and size of the field's internal bounding rectangle
bool wxStatusBar::GetFieldRect(int n, wxRect& rect) const
bool wxStatusBarGeneric::GetFieldRect(int n, wxRect& rect) const
{
if ((n < 0) || (n >= m_nFields))
return FALSE;
wxCHECK_MSG( (n >= 0) && (n < m_nFields), FALSE,
_T("invalid status bar field index") );
int width, height;
GetClientSize(&width, &height);
@@ -308,7 +309,7 @@ bool wxStatusBar::GetFieldRect(int n, wxRect& rect) const
}
// Initialize colours
void wxStatusBar::InitColours(void)
void wxStatusBarGeneric::InitColours()
{
// Shadow colours
#if defined(__WIN95__)
@@ -327,7 +328,7 @@ void wxStatusBar::InitColours(void)
}
// Responds to colour changes, and passes event on to children.
void wxStatusBar::OnSysColourChanged(wxSysColourChangedEvent& event)
void wxStatusBarGeneric::OnSysColourChanged(wxSysColourChangedEvent& event)
{
InitColours();
Refresh();
@@ -336,3 +337,18 @@ void wxStatusBar::OnSysColourChanged(wxSysColourChangedEvent& event)
wxWindow::OnSysColourChanged(event);
}
void wxStatusBarGeneric::SetMinHeight(int height)
{
// check that this min height is not less than minimal height for the
// current font
wxClientDC dc(this);
wxCoord y;
dc.GetTextExtent( _T("X"), NULL, &y );
if ( height > (11*y)/10 )
{
SetSize(-1, -1, -1, height + 2*m_borderY);
}
}
//#endif // Win32 && wxUSE_NATIVE_STATUSBAR

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: timer.cpp
// Name: gtk/timer.cpp
// Purpose:
// Author: Robert Roebling
// Id: $Id$
@@ -42,11 +42,10 @@ static gint timeout_callback( gpointer data )
return TRUE;
}
wxTimer::wxTimer()
void wxTimer::Init()
{
m_tag = -1;
m_milli = 1000;
m_oneShot = FALSE;
}
wxTimer::~wxTimer()

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: timer.cpp
// Name: gtk/timer.cpp
// Purpose:
// Author: Robert Roebling
// Id: $Id$
@@ -42,11 +42,10 @@ static gint timeout_callback( gpointer data )
return TRUE;
}
wxTimer::wxTimer()
void wxTimer::Init()
{
m_tag = -1;
m_milli = 1000;
m_oneShot = FALSE;
}
wxTimer::~wxTimer()

View File

@@ -992,41 +992,40 @@ void wxDC::SetLogicalFunction(int function)
{
m_logicalFunction = function;
SetRop((WXHDC) m_hDC);
SetRop(m_hDC);
}
void wxDC::SetRop(WXHDC dc)
{
if (!dc || m_logicalFunction < 0)
if ( !dc || m_logicalFunction < 0 )
return;
int c_rop;
int rop;
switch (m_logicalFunction)
{
case wxXOR: c_rop = R2_XORPEN; break;
case wxINVERT: c_rop = R2_NOT; break;
case wxOR_REVERSE: c_rop = R2_MERGEPENNOT; break;
case wxAND_REVERSE: c_rop = R2_MASKPENNOT; break;
case wxCLEAR: c_rop = R2_WHITE; break;
case wxSET: c_rop = R2_BLACK; break;
case wxOR_INVERT: c_rop = R2_MERGENOTPEN; break;
case wxAND: c_rop = R2_MASKPEN; break;
case wxOR: c_rop = R2_MERGEPEN; break;
case wxEQUIV: c_rop = R2_NOTXORPEN; break;
case wxNAND: c_rop = R2_NOTMASKPEN; break;
case wxAND_INVERT: c_rop = R2_MASKNOTPEN; break;
case wxCOPY: c_rop = R2_COPYPEN; break;
case wxNO_OP: c_rop = R2_NOP; break;
case wxSRC_INVERT: c_rop = R2_NOTCOPYPEN; break;
case wxNOR: c_rop = R2_NOTMERGEPEN; break;
case wxXOR: rop = R2_XORPEN; break;
case wxINVERT: rop = R2_NOT; break;
case wxOR_REVERSE: rop = R2_MERGEPENNOT; break;
case wxAND_REVERSE: rop = R2_MASKPENNOT; break;
case wxCLEAR: rop = R2_WHITE; break;
case wxSET: rop = R2_BLACK; break;
case wxOR_INVERT: rop = R2_MERGENOTPEN; break;
case wxAND: rop = R2_MASKPEN; break;
case wxOR: rop = R2_MERGEPEN; break;
case wxEQUIV: rop = R2_NOTXORPEN; break;
case wxNAND: rop = R2_NOTMASKPEN; break;
case wxAND_INVERT: rop = R2_MASKNOTPEN; break;
case wxCOPY: rop = R2_COPYPEN; break;
case wxNO_OP: rop = R2_NOP; break;
case wxSRC_INVERT: rop = R2_NOTCOPYPEN; break;
case wxNOR: rop = R2_NOTMERGEPEN; break;
default:
{
wxFAIL_MSG( wxT("unsupported logical function") );
break;
}
return;
}
SetROP2((HDC) dc, c_rop);
SetROP2(GetHdc(), rop);
}
bool wxDC::StartDoc(const wxString& message)
@@ -1278,27 +1277,25 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest,
DWORD dwRop = SRCCOPY;
switch (rop)
{
case wxXOR: dwRop = SRCINVERT; break;
case wxINVERT: dwRop = DSTINVERT; break;
case wxOR_REVERSE: dwRop = 0x00DD0228; break;
case wxAND_REVERSE: dwRop = SRCERASE; break;
case wxCLEAR: dwRop = BLACKNESS; break;
case wxSET: dwRop = WHITENESS; break;
case wxOR_INVERT: dwRop = MERGEPAINT; break;
case wxAND: dwRop = SRCAND; break;
case wxOR: dwRop = SRCPAINT; break;
case wxEQUIV: dwRop = 0x00990066; break;
case wxNAND: dwRop = 0x007700E6; break;
case wxAND_INVERT: dwRop = 0x00220326; break;
case wxCOPY: dwRop = SRCCOPY; break;
case wxNO_OP: dwRop = 0x00AA0029; break;
case wxSRC_INVERT: dwRop = NOTSRCCOPY; break;
case wxXOR: dwRop = SRCINVERT; break;
case wxINVERT: dwRop = DSTINVERT; break;
case wxOR_REVERSE: dwRop = 0x00DD0228; break;
case wxAND_REVERSE: dwRop = SRCERASE; break;
case wxCLEAR: dwRop = BLACKNESS; break;
case wxSET: dwRop = WHITENESS; break;
case wxOR_INVERT: dwRop = MERGEPAINT; break;
case wxAND: dwRop = SRCAND; break;
case wxOR: dwRop = SRCPAINT; break;
case wxEQUIV: dwRop = 0x00990066; break;
case wxNAND: dwRop = 0x007700E6; break;
case wxAND_INVERT: dwRop = 0x00220326; break;
case wxCOPY: dwRop = SRCCOPY; break;
case wxNO_OP: dwRop = 0x00AA0029; break;
case wxSRC_INVERT: dwRop = NOTSRCCOPY; break;
case wxNOR: dwRop = NOTSRCCOPY; break;
default:
{
wxFAIL_MSG( wxT("unsupported logical function") );
break;
}
return FALSE;
}

View File

@@ -43,10 +43,7 @@
#if wxUSE_STATUSBAR
#include "wx/statusbr.h"
#if wxUSE_NATIVE_STATUSBAR
#include "wx/msw/statbr95.h"
#endif
#include "wx/generic/statusbr.h"
#endif // wxUSE_STATUSBAR
#if wxUSE_TOOLBAR
@@ -354,14 +351,27 @@ wxStatusBar *wxFrame::OnCreateStatusBar(int number,
#if wxUSE_NATIVE_STATUSBAR
if ( UsesNativeStatusBar() )
{
statusBar = new wxStatusBar95(this, id, style);
statusBar = (wxStatusBar *)new wxStatusBar95(this, id, style);
statusBar->SetFieldsCount(number);
}
else
#endif
{
statusBar = wxFrameBase::OnCreateStatusBar(number, style, id, name);
statusBar = (wxStatusBar *)new wxStatusBarGeneric(this, id, style, name);
// Set the height according to the font and the border size
wxClientDC dc(statusBar);
dc.SetFont(statusBar->GetFont());
wxCoord y;
dc.GetTextExtent(_T("X"), NULL, &y );
int height = (int)( (11*y)/10 + 2*statusBar->GetBorderY());
statusBar->SetSize(-1, -1, -1, height);
statusBar->SetFieldsCount(number);
}
return statusBar;
@@ -369,12 +379,22 @@ wxStatusBar *wxFrame::OnCreateStatusBar(int number,
void wxFrame::PositionStatusBar()
{
// native status bar positions itself
if ( m_frameStatusBar
if ( !m_frameStatusBar )
return;
// native status bar positions itself, but we must forward the WM_SIZE
// messages to it
#if wxUSE_NATIVE_STATUSBAR
&& !m_frameStatusBar->IsKindOf(CLASSINFO(wxStatusBar95))
#endif
)
wxStatusBar95 *sb = wxDynamicCast(m_frameStatusBar, wxStatusBar95);
if ( sb )
{
wxSizeEvent event(GetSize(), sb->GetId());
event.SetEventObject(sb);
sb->GetEventHandler()->ProcessEvent(event);
}
else
#endif // wxUSE_NATIVE_STATUSBAR
{
int w, h;
GetClientSize(&w, &h);
@@ -772,17 +792,6 @@ bool wxFrame::HandleSize(int x, int y, WXUINT id)
if ( !m_iconized )
{
// forward WM_SIZE to status bar control
#if wxUSE_NATIVE_STATUSBAR
if (m_frameStatusBar && m_frameStatusBar->IsKindOf(CLASSINFO(wxStatusBar95)))
{
wxSizeEvent event(wxSize(x, y), m_frameStatusBar->GetId());
event.SetEventObject( m_frameStatusBar );
((wxStatusBar95 *)m_frameStatusBar)->OnSize(event);
}
#endif // wxUSE_NATIVE_STATUSBAR
PositionStatusBar();
PositionToolBar();

View File

@@ -27,11 +27,10 @@
#include "wx/dcclient.h"
#endif
#ifdef __WIN95__
#if defined(__WIN95__) && wxUSE_NATIVE_STATUSBAR
#include "wx/log.h"
#include "wx/generic/statusbr.h"
#include "wx/msw/statbr95.h"
#include "wx/statusbr.h"
#include "wx/msw/private.h"
#include <windowsx.h>
@@ -40,14 +39,16 @@
#include <commctrl.h>
#endif
#if wxUSE_NATIVE_STATUSBAR
// ----------------------------------------------------------------------------
// wxWindows macros
// ----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxStatusBar95, wxStatusBar);
IMPLEMENT_DYNAMIC_CLASS(wxStatusBar95, wxWindow);
IMPLEMENT_DYNAMIC_CLASS(wxStatusBar, wxStatusBar95)
BEGIN_EVENT_TABLE(wxStatusBar95, wxStatusBar)
BEGIN_EVENT_TABLE(wxStatusBar95, wxWindow)
EVT_SIZE(wxStatusBar95::OnSize)
END_EVENT_TABLE()
END_EVENT_TABLE()
// ----------------------------------------------------------------------------
// macros
@@ -59,7 +60,25 @@
#define StatusBar_GetTextLen(h, n) LOWORD(SendMessage(h, SB_GETTEXTLENGTH, (WPARAM)n, 0))
#define StatusBar_GetText(h, n, s) LOWORD(SendMessage(h, SB_GETTEXT, (WPARAM)n, (LPARAM)(LPTSTR)s))
#define hwnd ((HWND)m_hWnd)
// ----------------------------------------------------------------------------
//
// ----------------------------------------------------------------------------
static WNDPROC gs_wndprocStatBar = NULL;
LRESULT APIENTRY wxStatusBarProc(HWND hwnd,
UINT message,
WPARAM wParam,
LPARAM lParam)
{
if ( message == WM_COMMAND )
{
wxStatusBar95 *sb = (wxStatusBar95 *)GetWindowLong(hwnd, GWL_USERDATA);
sb->MSWWindowProc(message, wParam, lParam);
}
return ::CallWindowProc(gs_wndprocStatBar, hwnd, message, wParam, lParam);
}
// ============================================================================
// implementation
@@ -76,37 +95,50 @@ wxStatusBar95::wxStatusBar95()
m_windowId = 0;
}
wxStatusBar95::wxStatusBar95(wxWindow *parent, wxWindowID id, long style)
bool wxStatusBar95::Create(wxWindow *parent,
wxWindowID id,
long style,
const wxString& name)
{
Create(parent, id, style);
SetName(name);
SetParent(parent);
if (id == -1)
m_windowId = NewControlId();
else
m_windowId = id;
DWORD wstyle = WS_CHILD | WS_VISIBLE;
if ( style & wxST_SIZEGRIP )
wstyle |= SBARS_SIZEGRIP;
m_hWnd = (WXHWND)CreateStatusWindow(wstyle,
wxEmptyString,
GetHwndOf(parent),
m_windowId);
if ( m_hWnd == 0 )
{
wxLogSysError(_("Failed to create a status bar."));
return FALSE;
}
// for some reason, subclassing in the usual way doesn't work at all - many
// strange things start happening (status bar is not positioned correctly,
// all methods fail...)
// SubclassWin(m_hWnd);
// but we want to process the messages from it still, so must subclass it
gs_wndprocStatBar = (WNDPROC)GetWindowLong(GetHwnd(), GWL_WNDPROC);
SetWindowLong(GetHwnd(), GWL_WNDPROC, (LONG)wxStatusBarProc);
SetWindowLong(GetHwnd(), GWL_USERDATA, (LONG)this);
return TRUE;
}
bool wxStatusBar95::Create(wxWindow *parent, wxWindowID id, long style)
wxStatusBar95::~wxStatusBar95()
{
SetParent(parent);
if (id == -1)
m_windowId = NewControlId();
else
m_windowId = id;
DWORD wstyle = WS_CHILD | WS_VISIBLE;
if ( style & wxST_SIZEGRIP )
wstyle |= SBARS_SIZEGRIP;
m_hWnd = (WXHWND)CreateStatusWindow(wstyle,
wxT(""),
(HWND)parent->GetHWND(),
m_windowId);
if ( m_hWnd == 0 ) {
wxLogSysError(wxT("can't create status bar window"));
return FALSE;
}
// this doesn't work: display problems (white 1-2 pixel borders...)
// SubclassWin(m_hWnd);
return TRUE;
delete [] m_statusWidths;
}
void wxStatusBar95::CopyFieldsWidth(const int widths[])
@@ -126,7 +158,8 @@ void wxStatusBar95::CopyFieldsWidth(const int widths[])
void wxStatusBar95::SetFieldsCount(int nFields, const int widths[])
{
wxASSERT( (nFields > 0) && (nFields < 255) );
// this is Windows limitation
wxASSERT_MSG( (nFields > 0) && (nFields < 255), _T("too many fields") );
m_nFields = nFields;
@@ -136,8 +169,7 @@ void wxStatusBar95::SetFieldsCount(int nFields, const int widths[])
void wxStatusBar95::SetStatusWidths(int n, const int widths[])
{
// @@ I don't understand what this function is for...
wxASSERT( n == m_nFields );
wxASSERT_MSG( n == m_nFields, _T("field number mismatch") );
CopyFieldsWidth(widths);
SetFieldsWidth();
@@ -148,89 +180,134 @@ void wxStatusBar95::SetFieldsWidth()
if ( !m_nFields )
return;
int *pWidths = new int[m_nFields];
int aBorders[3];
SendMessage(GetHwnd(), SB_GETBORDERS, 0, (LPARAM)aBorders);
int nWindowWidth, y;
GetClientSize(&nWindowWidth, &y);
int extraWidth = aBorders[2]; // space between fields
if ( m_statusWidths == NULL ) {
// default: all fields have the same width
int nWidth = nWindowWidth / m_nFields;
for ( int i = 0; i < m_nFields; i++ )
pWidths[i] = (i + 1) * nWidth;
}
else {
// -1 doesn't mean the same thing for wxWindows and Win32, recalc
int nTotalWidth = 0,
int *pWidths = new int[m_nFields];
int nWindowWidth, y;
GetClientSize(&nWindowWidth, &y);
if ( m_statusWidths == NULL ) {
// default: all fields have the same width
int nWidth = nWindowWidth / m_nFields;
for ( int i = 0; i < m_nFields; i++ )
pWidths[i] = (i + 1) * nWidth;
}
else {
// -1 doesn't mean the same thing for wxWindows and Win32, recalc
int nTotalWidth = 0,
nVarCount = 0,
i;
for ( i = 0; i < m_nFields; i++ ) {
if ( m_statusWidths[i] == -1 )
nVarCount++;
else
nTotalWidth += m_statusWidths[i];
for ( i = 0; i < m_nFields; i++ ) {
if ( m_statusWidths[i] == -1 )
nVarCount++;
else
nTotalWidth += m_statusWidths[i] + extraWidth;
}
if ( nVarCount == 0 ) {
wxFAIL_MSG( _T("at least one field must be of variable width") );
nVarCount++;
}
int nVarWidth = (nWindowWidth - nTotalWidth) / nVarCount;
// do fill the array
int nCurPos = 0;
for ( i = 0; i < m_nFields; i++ ) {
if ( m_statusWidths[i] == -1 )
nCurPos += nVarWidth;
else
nCurPos += m_statusWidths[i] + extraWidth;
pWidths[i] = nCurPos;
}
}
if ( nVarCount == 0 ) {
// wrong! at least one field must be of variable width
wxFAIL;
nVarCount++;
if ( !StatusBar_SetParts(GetHwnd(), m_nFields, pWidths) ) {
wxLogLastError(wxT("StatusBar_SetParts"));
}
int nVarWidth = (nWindowWidth - nTotalWidth) / nVarCount;
// do fill the array
int nCurPos = 0;
for ( i = 0; i < m_nFields; i++ ) {
if ( m_statusWidths[i] == -1 )
nCurPos += nVarWidth;
else
nCurPos += m_statusWidths[i];
pWidths[i] = nCurPos;
}
}
if ( !StatusBar_SetParts(hwnd, m_nFields, pWidths) ) {
wxLogLastError(wxT("StatusBar_SetParts"));
}
delete [] pWidths;
delete [] pWidths;
}
void wxStatusBar95::SetStatusText(const wxString& strText, int nField)
{
if ( !StatusBar_SetText(hwnd, nField, strText) ) {
wxCHECK_RET( (nField >= 0) && (nField < m_nFields),
_T("invalid statusbar field index") );
if ( !StatusBar_SetText(GetHwnd(), nField, strText) ) {
wxLogLastError(wxT("StatusBar_SetText"));
}
}
wxString wxStatusBar95::GetStatusText(int nField) const
{
wxASSERT( (nField > -1) && (nField < m_nFields) );
wxCHECK_MSG( (nField >= 0) && (nField < m_nFields), wxEmptyString,
_T("invalid statusbar field index") );
wxString str(wxT(""));
int len = StatusBar_GetTextLen(hwnd, nField);
wxString str;
int len = StatusBar_GetTextLen(GetHwnd(), nField);
if (len > 0)
{
StatusBar_GetText(hwnd, nField, str.GetWriteBuf(len));
str.UngetWriteBuf();
StatusBar_GetText(GetHwnd(), nField, str.GetWriteBuf(len));
str.UngetWriteBuf();
}
return str;
}
int wxStatusBar95::GetBorderX() const
{
int aBorders[3];
SendMessage(GetHwnd(), SB_GETBORDERS, 0, (LPARAM)aBorders);
return aBorders[0];
}
int wxStatusBar95::GetBorderY() const
{
int aBorders[3];
SendMessage(GetHwnd(), SB_GETBORDERS, 0, (LPARAM)aBorders);
return aBorders[1];
}
void wxStatusBar95::SetMinHeight(int height)
{
SendMessage(GetHwnd(), SB_SETMINHEIGHT, height + 2*GetBorderY(), 0);
// have to send a (dummy) WM_SIZE to redraw it now
SendMessage(GetHwnd(), WM_SIZE, 0, 0);
}
bool wxStatusBar95::GetFieldRect(int i, wxRect& rect) const
{
wxCHECK_MSG( (i >= 0) && (i < m_nFields), FALSE,
_T("invalid statusbar field index") );
RECT r;
if ( !::SendMessage(GetHwnd(), SB_GETRECT, i, (LPARAM)&r) )
{
wxLogLastError("SendMessage(SB_GETRECT)");
}
wxCopyRECTToRect(r, rect);
return TRUE;
}
void wxStatusBar95::OnSize(wxSizeEvent& event)
{
FORWARD_WM_SIZE(hwnd, SIZE_RESTORED, event.GetSize().x, event.GetSize().y,
FORWARD_WM_SIZE(GetHwnd(), SIZE_RESTORED,
event.GetSize().x, event.GetSize().y,
SendMessage);
// adjust fields widths to the new size
SetFieldsWidth();
}
#endif // wxUSE_NATIVE_STATUSBAR
#else
#error "wxStatusBar95 is only available under Windows 95 and later."
#endif // __WIN95__
#endif // __WIN95__ && wxUSE_NATIVE_STATUSBAR

View File

@@ -51,7 +51,7 @@ UINT WINAPI _EXPORT wxTimerProc(HWND hwnd, WORD, int idTimer, DWORD);
#define _EXPORT _export
#endif
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject)
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject)
// ============================================================================
// implementation
@@ -61,7 +61,7 @@ UINT WINAPI _EXPORT wxTimerProc(HWND hwnd, WORD, int idTimer, DWORD);
// wxTimer class
// ----------------------------------------------------------------------------
wxTimer::wxTimer()
void wxTimer::Init()
{
m_id = 0;
}