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:
@@ -69,8 +69,9 @@ extern const wxEventType wxEVT_COMMAND_TOOL_RCLICKED;
|
|||||||
extern const wxEventType wxEVT_COMMAND_TOOL_ENTER;
|
extern const wxEventType wxEVT_COMMAND_TOOL_ENTER;
|
||||||
extern const wxEventType wxEVT_COMMAND_SPINCTRL_UPDATED;
|
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_SOCKET;
|
||||||
|
extern const wxEventType wxEVT_TIMER;
|
||||||
|
|
||||||
/* Mouse event types */
|
/* Mouse event types */
|
||||||
extern const wxEventType wxEVT_LEFT_DOWN;
|
extern const wxEventType wxEVT_LEFT_DOWN;
|
||||||
@@ -283,6 +284,9 @@ const wxEventType wxEVT_COMMAND_SPINCTRL_UPDATED = wxEVT_FIRST + 18;
|
|||||||
/* Sockets send events, too */
|
/* Sockets send events, too */
|
||||||
const wxEventType wxEVT_SOCKET = wxEVT_FIRST + 50;
|
const wxEventType wxEVT_SOCKET = wxEVT_FIRST + 50;
|
||||||
|
|
||||||
|
/* And timers do as well */
|
||||||
|
const wxEventType wxEVT_TIMER = wxEVT_FIRST + 80;
|
||||||
|
|
||||||
/* Mouse event types */
|
/* Mouse event types */
|
||||||
const wxEventType wxEVT_LEFT_DOWN = wxEVT_FIRST + 100;
|
const wxEventType wxEVT_LEFT_DOWN = wxEVT_FIRST + 100;
|
||||||
const wxEventType wxEVT_LEFT_UP = wxEVT_FIRST + 101;
|
const wxEventType wxEVT_LEFT_UP = wxEVT_FIRST + 101;
|
||||||
|
@@ -1,34 +1,32 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: statusbr.h
|
// Name: wx/generic/statusbr.h
|
||||||
// Purpose: wxStatusBar class
|
// Purpose: wxStatusBarGeneric class
|
||||||
// Author: Julian Smart
|
// Author: Julian Smart
|
||||||
// Modified by:
|
// Modified by: VZ at 05.02.00 to derive from wxStatusBarBase
|
||||||
// Created: 01/02/97
|
// Created: 01/02/97
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart and Markus Holzem
|
// Copyright: (c) Julian Smart and Markus Holzem
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef __STATUSBRH_G__
|
#ifndef _WX_GENERIC_STATUSBR_H_
|
||||||
#define __STATUSBRH_G__
|
#define _WX_GENERIC_STATUSBR_H_
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface "statusbr.h"
|
#pragma interface "statusbr.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/window.h"
|
|
||||||
#include "wx/pen.h"
|
#include "wx/pen.h"
|
||||||
#include "wx/font.h"
|
#include "wx/font.h"
|
||||||
|
|
||||||
WXDLLEXPORT_DATA(extern const wxChar*) wxPanelNameStr;
|
WXDLLEXPORT_DATA(extern const wxChar*) wxPanelNameStr;
|
||||||
|
|
||||||
class WXDLLEXPORT wxStatusBar: public wxWindow
|
class WXDLLEXPORT wxStatusBarGeneric : public wxStatusBarBase
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxStatusBar)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxStatusBar(void);
|
wxStatusBarGeneric();
|
||||||
inline wxStatusBar(wxWindow *parent, wxWindowID id,
|
wxStatusBarGeneric(wxWindow *parent,
|
||||||
|
wxWindowID id,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
long style = 0,
|
long style = 0,
|
||||||
@@ -36,18 +34,33 @@ public:
|
|||||||
{
|
{
|
||||||
Create(parent, id, pos, size, style, name);
|
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& 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,
|
bool Create(wxWindow *parent, wxWindowID id,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
|
||||||
const wxSize& size = wxDefaultSize,
|
|
||||||
long style = 0,
|
long style = 0,
|
||||||
const wxString& name = wxPanelNameStr);
|
const wxString& name = wxPanelNameStr);
|
||||||
|
|
||||||
// Create status line
|
// Create status line
|
||||||
virtual void SetFieldsCount(int number=1, const int widths[] = (const int *) NULL);
|
virtual void SetFieldsCount(int number = 1,
|
||||||
inline int GetFieldsCount() const { return m_nFields; }
|
const int *widths = (const int *) NULL);
|
||||||
|
int GetFieldsCount() const { return m_nFields; }
|
||||||
|
|
||||||
// Set status line text
|
// Set status line text
|
||||||
virtual void SetStatusText(const wxString& text, int number = 0);
|
virtual void SetStatusText(const wxString& text, int number = 0);
|
||||||
@@ -56,20 +69,24 @@ public:
|
|||||||
// Set status line widths
|
// Set status line widths
|
||||||
virtual void SetStatusWidths(int n, const int widths_field[]);
|
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
|
// Get the position and size of the field's internal bounding rectangle
|
||||||
virtual bool GetFieldRect(int i, wxRect& rect) const;
|
virtual bool GetFieldRect(int i, wxRect& rect) const;
|
||||||
|
|
||||||
inline int GetBorderX() const { return m_borderX; }
|
// sets the minimal vertical size of the status bar
|
||||||
inline int GetBorderY() const { return m_borderY; }
|
virtual void SetMinHeight(int height);
|
||||||
inline void SetBorderX(int x);
|
|
||||||
inline void SetBorderY(int y);
|
virtual int GetBorderX() const { return m_borderX; }
|
||||||
|
virtual int GetBorderY() const { return m_borderY; }
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
// Implementation
|
// 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);
|
void OnPaint(wxPaintEvent& event);
|
||||||
|
|
||||||
virtual void InitColours();
|
virtual void InitColours();
|
||||||
@@ -78,8 +95,6 @@ public:
|
|||||||
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int * m_statusWidths;
|
|
||||||
int m_nFields;
|
|
||||||
wxString * m_statusStrings;
|
wxString * m_statusStrings;
|
||||||
int m_borderX;
|
int m_borderX;
|
||||||
int m_borderY;
|
int m_borderY;
|
||||||
@@ -87,8 +102,10 @@ protected:
|
|||||||
wxPen m_mediumShadowPen;
|
wxPen m_mediumShadowPen;
|
||||||
wxPen m_hilightPen;
|
wxPen m_hilightPen;
|
||||||
|
|
||||||
|
private:
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxStatusBarGeneric)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// __STATUSBRH_G__
|
// _WX_GENERIC_STATUSBR_H_
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: timer.h
|
// Name: wx/gtk/timer.h
|
||||||
// Purpose:
|
// Purpose:
|
||||||
// Author: Robert Roebling
|
// Author: Robert Roebling
|
||||||
// Id: $Id$
|
// Id: $Id$
|
||||||
@@ -22,7 +22,9 @@
|
|||||||
class wxTimer : public wxTimerBase
|
class wxTimer : public wxTimerBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxTimer();
|
wxTimer() { Init(); }
|
||||||
|
wxTimer(wxEvtHandler *owner, int id = -1) : wxTimerBase(owner, id)
|
||||||
|
{ Init(); }
|
||||||
~wxTimer();
|
~wxTimer();
|
||||||
|
|
||||||
virtual bool Start( int millisecs = -1, bool oneShot = FALSE );
|
virtual bool Start( int millisecs = -1, bool oneShot = FALSE );
|
||||||
@@ -31,6 +33,8 @@ public:
|
|||||||
virtual bool IsRunning() const { return m_tag != -1; }
|
virtual bool IsRunning() const { return m_tag != -1; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void Init();
|
||||||
|
|
||||||
int m_tag;
|
int m_tag;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: timer.h
|
// Name: wx/gtk/timer.h
|
||||||
// Purpose:
|
// Purpose:
|
||||||
// Author: Robert Roebling
|
// Author: Robert Roebling
|
||||||
// Id: $Id$
|
// Id: $Id$
|
||||||
@@ -22,7 +22,9 @@
|
|||||||
class wxTimer : public wxTimerBase
|
class wxTimer : public wxTimerBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxTimer();
|
wxTimer() { Init(); }
|
||||||
|
wxTimer(wxEvtHandler *owner, int id = -1) : wxTimerBase(owner, id)
|
||||||
|
{ Init(); }
|
||||||
~wxTimer();
|
~wxTimer();
|
||||||
|
|
||||||
virtual bool Start( int millisecs = -1, bool oneShot = FALSE );
|
virtual bool Start( int millisecs = -1, bool oneShot = FALSE );
|
||||||
@@ -31,6 +33,8 @@ public:
|
|||||||
virtual bool IsRunning() const { return m_tag != -1; }
|
virtual bool IsRunning() const { return m_tag != -1; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void Init();
|
||||||
|
|
||||||
int m_tag;
|
int m_tag;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -226,6 +226,15 @@ inline void wxRGBToColour(wxColour& c, COLORREF rgb)
|
|||||||
c.Set(GetRValue(rgb), GetGValue(rgb), GetBValue(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
|
// translations between HIMETRIC units (which OLE likes) and pixels (which are
|
||||||
// liked by all the others) - implemented in msw/utilsexc.cpp
|
// liked by all the others) - implemented in msw/utilsexc.cpp
|
||||||
extern void HIMETRICToPixel(LONG *x, LONG *y);
|
extern void HIMETRICToPixel(LONG *x, LONG *y);
|
||||||
|
@@ -18,20 +18,28 @@
|
|||||||
|
|
||||||
#if wxUSE_NATIVE_STATUSBAR
|
#if wxUSE_NATIVE_STATUSBAR
|
||||||
|
|
||||||
class WXDLLEXPORT wxStatusBar95 : public wxStatusBar
|
class WXDLLEXPORT wxStatusBar95 : public wxStatusBarBase
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxStatusBar95);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// ctors
|
// ctors and such
|
||||||
wxStatusBar95();
|
wxStatusBar95();
|
||||||
wxStatusBar95(wxWindow *parent, wxWindowID id = -1, long style = wxST_SIZEGRIP);
|
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,
|
||||||
bool Create(wxWindow *parent, wxWindowID id = -1, long style = wxST_SIZEGRIP);
|
wxWindowID id = -1,
|
||||||
|
long style = wxST_SIZEGRIP,
|
||||||
|
const wxString& name = wxEmptyString);
|
||||||
|
|
||||||
|
virtual ~wxStatusBar95();
|
||||||
|
|
||||||
// a status line can have several (<256) fields numbered from 0
|
// a status line can have several (<256) fields numbered from 0
|
||||||
virtual void SetFieldsCount(int number = 1, const int widths[] = NULL);
|
virtual void SetFieldsCount(int number = 1, const int *widths = NULL);
|
||||||
|
|
||||||
// each field of status line has it's own text
|
// each field of status line has it's own text
|
||||||
virtual void SetStatusText(const wxString& text, int number = 0);
|
virtual void SetStatusText(const wxString& text, int number = 0);
|
||||||
@@ -40,14 +48,25 @@ public:
|
|||||||
// set status line fields' widths
|
// set status line fields' widths
|
||||||
virtual void SetStatusWidths(int n, const int widths_field[]);
|
virtual void SetStatusWidths(int n, const int widths_field[]);
|
||||||
|
|
||||||
// we're going to process WM_SIZE (of the parent window)
|
// sets the minimal vertical size of the status bar
|
||||||
void OnSize(wxSizeEvent& event);
|
virtual void SetMinHeight(int height);
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
// 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:
|
protected:
|
||||||
void CopyFieldsWidth(const int widths[]);
|
void CopyFieldsWidth(const int widths[]);
|
||||||
void SetFieldsWidth();
|
void SetFieldsWidth();
|
||||||
|
|
||||||
|
private:
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxStatusBar95);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // wxUSE_NATIVE_STATUSBAR
|
#endif // wxUSE_NATIVE_STATUSBAR
|
||||||
|
@@ -21,7 +21,9 @@ class WXDLLEXPORT wxTimer : public wxTimerBase
|
|||||||
friend void wxProcessTimer(wxTimer& timer);
|
friend void wxProcessTimer(wxTimer& timer);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxTimer();
|
wxTimer() { Init(); }
|
||||||
|
wxTimer(wxEvtHandler *owner, int id = -1) : wxTimerBase(owner, id)
|
||||||
|
{ Init(); }
|
||||||
~wxTimer();
|
~wxTimer();
|
||||||
|
|
||||||
virtual bool Start(int milliseconds = -1, bool oneShot = FALSE);
|
virtual bool Start(int milliseconds = -1, bool oneShot = FALSE);
|
||||||
@@ -30,6 +32,8 @@ public:
|
|||||||
virtual bool IsRunning() const { return m_id != 0; }
|
virtual bool IsRunning() const { return m_id != 0; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void Init();
|
||||||
|
|
||||||
long m_id;
|
long m_id;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -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_
|
#ifndef _WX_STATUSBR_H_BASE_
|
||||||
#define _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
|
#endif
|
||||||
// _WX_STATUSBR_H_BASE_
|
// _WX_STATUSBR_H_BASE_
|
||||||
|
@@ -1,11 +1,12 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: wx/timer.h
|
// Name: wx/timer.h
|
||||||
// Purpose: wxTimer class and global time-related functions
|
// Purpose: wxTimer, wxStopWatch and global time-related functions
|
||||||
// Author: Julian Smart
|
// Author: Julian Smart (wxTimer), Sylvain Bougnoux (wxStopWatch)
|
||||||
// Modified by:
|
// Modified by: Vadim Zeitlin (wxTimerBase)
|
||||||
|
// Guillermo Rodriguez (global clean up)
|
||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart and Markus Holzem
|
// Copyright: (c) wxWindows team
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@@ -19,6 +20,7 @@
|
|||||||
#include "wx/setup.h"
|
#include "wx/setup.h"
|
||||||
#include "wx/object.h"
|
#include "wx/object.h"
|
||||||
#include "wx/longlong.h"
|
#include "wx/longlong.h"
|
||||||
|
#include "wx/event.h"
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxTimer
|
// wxTimer
|
||||||
@@ -28,7 +30,22 @@
|
|||||||
class WXDLLEXPORT wxTimerBase : public wxObject
|
class WXDLLEXPORT wxTimerBase : public wxObject
|
||||||
{
|
{
|
||||||
public:
|
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
|
// working with the timer
|
||||||
// ----------------------
|
// ----------------------
|
||||||
@@ -51,8 +68,9 @@ public:
|
|||||||
// stop the timer
|
// stop the timer
|
||||||
virtual void Stop() = 0;
|
virtual void Stop() = 0;
|
||||||
|
|
||||||
// override this in your wxTimer-derived class
|
// override this in your wxTimer-derived class if you want to process timer
|
||||||
virtual void Notify() = 0;
|
// messages in it, use non default ctor or SetOwner() otherwise
|
||||||
|
virtual void Notify();
|
||||||
|
|
||||||
// getting info
|
// getting info
|
||||||
// ------------
|
// ------------
|
||||||
@@ -73,10 +91,20 @@ public:
|
|||||||
#endif // WXWIN_COMPATIBILITY_2
|
#endif // WXWIN_COMPATIBILITY_2
|
||||||
|
|
||||||
protected:
|
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
|
int m_milli; // the timer interval
|
||||||
bool m_oneShot; // TRUE if one shot
|
bool m_oneShot; // TRUE if one shot
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxTimer itself
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
#if defined(__WXMSW__)
|
#if defined(__WXMSW__)
|
||||||
#include "wx/msw/timer.h"
|
#include "wx/msw/timer.h"
|
||||||
#elif defined(__WXMOTIF__)
|
#elif defined(__WXMOTIF__)
|
||||||
@@ -94,7 +122,34 @@ protected:
|
|||||||
#endif
|
#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
|
class WXDLLEXPORT wxStopWatch
|
||||||
@@ -127,7 +182,6 @@ void WXDLLEXPORT wxStartTimer();
|
|||||||
// -- DEPRECATED: use wxStopWatch instead
|
// -- DEPRECATED: use wxStopWatch instead
|
||||||
long WXDLLEXPORT wxGetElapsedTime(bool resetTimer = TRUE);
|
long WXDLLEXPORT wxGetElapsedTime(bool resetTimer = TRUE);
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// global time functions
|
// global time functions
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -338,20 +338,18 @@ wxStatusBar *wxFrameBase::OnCreateStatusBar(int number,
|
|||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
wxStatusBar *statusBar = new wxStatusBar(this, id,
|
wxStatusBar *statusBar = new wxStatusBar(this, id, style, name);
|
||||||
wxPoint(0, 0), wxSize(100, 20),
|
|
||||||
style, name);
|
|
||||||
|
|
||||||
// Set the height according to the font and the border size
|
// Set the height according to the font and the border size
|
||||||
wxClientDC dc(statusBar);
|
wxClientDC dc(statusBar);
|
||||||
dc.SetFont(statusBar->GetFont());
|
dc.SetFont(statusBar->GetFont());
|
||||||
|
|
||||||
long y;
|
wxCoord y;
|
||||||
dc.GetTextExtent( "X", NULL, &y );
|
dc.GetTextExtent( "X", NULL, &y );
|
||||||
|
|
||||||
int height = (int)( (11*y)/10 + 2*statusBar->GetBorderY());
|
int height = (int)( (11*y)/10 + 2*statusBar->GetBorderY());
|
||||||
|
|
||||||
statusBar->SetSize( -1, -1, 100, height );
|
statusBar->SetSize( -1, -1, -1, height );
|
||||||
|
|
||||||
statusBar->SetFieldsCount(number);
|
statusBar->SetFieldsCount(number);
|
||||||
|
|
||||||
|
@@ -57,6 +57,12 @@
|
|||||||
#include <sys/timeb.h>
|
#include <sys/timeb.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxWin macros
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS(wxTimerEvent, wxEvent)
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// macros
|
// macros
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -72,11 +78,29 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif // HAVE_GETTIMEOFDAY
|
#endif // HAVE_GETTIMEOFDAY
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// prototypes
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
wxLongLong wxGetLocalTimeMillis();
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// implementation
|
// 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
|
// wxStopWatch
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: statusbr.cpp
|
// Name: generic/statusbr.cpp
|
||||||
// Purpose: wxStatusBar class implementation
|
// Purpose: wxStatusBarGeneric class implementation
|
||||||
// Author: Julian Smart
|
// Author: Julian Smart
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: 01/02/97
|
// Created: 01/02/97
|
||||||
@@ -20,6 +20,8 @@
|
|||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//#if !defined(__WIN32__) || !wxUSE_NATIVE_STATUSBAR
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/setup.h"
|
#include "wx/setup.h"
|
||||||
#include "wx/frame.h"
|
#include "wx/frame.h"
|
||||||
@@ -34,18 +36,22 @@
|
|||||||
#include "wx/msw/winundef.h"
|
#include "wx/msw/winundef.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxStatusBar, wxWindow)
|
IMPLEMENT_DYNAMIC_CLASS(wxStatusBarGeneric, wxWindow)
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxStatusBar, wxWindow)
|
#if !defined(__WIN32__) || !wxUSE_NATIVE_STATUSBAR
|
||||||
EVT_PAINT(wxStatusBar::OnPaint)
|
IMPLEMENT_DYNAMIC_CLASS(wxStatusBar, wxStatusBarGeneric)
|
||||||
EVT_SYS_COLOUR_CHANGED(wxStatusBar::OnSysColourChanged)
|
#endif // Win32 && wxUSE_NATIVE_STATUSBAR
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE(wxStatusBarGeneric, wxWindow)
|
||||||
|
EVT_PAINT(wxStatusBarGeneric::OnPaint)
|
||||||
|
EVT_SYS_COLOUR_CHANGED(wxStatusBarGeneric::OnSysColourChanged)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
// Default status border dimensions
|
// Default status border dimensions
|
||||||
#define wxTHICK_LINE_BORDER 2
|
#define wxTHICK_LINE_BORDER 2
|
||||||
#define wxTHICK_LINE_WIDTH 1
|
#define wxTHICK_LINE_WIDTH 1
|
||||||
|
|
||||||
wxStatusBar::wxStatusBar(void)
|
wxStatusBarGeneric::wxStatusBarGeneric()
|
||||||
{
|
{
|
||||||
m_statusWidths = (int *) NULL;
|
m_statusWidths = (int *) NULL;
|
||||||
m_statusStrings = (wxString *) NULL;
|
m_statusStrings = (wxString *) NULL;
|
||||||
@@ -54,7 +60,7 @@ wxStatusBar::wxStatusBar(void)
|
|||||||
m_borderY = wxTHICK_LINE_BORDER;
|
m_borderY = wxTHICK_LINE_BORDER;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxStatusBar::~wxStatusBar(void)
|
wxStatusBarGeneric::~wxStatusBarGeneric()
|
||||||
{
|
{
|
||||||
# ifdef __WXMSW__
|
# ifdef __WXMSW__
|
||||||
SetFont(wxNullFont);
|
SetFont(wxNullFont);
|
||||||
@@ -66,9 +72,8 @@ wxStatusBar::~wxStatusBar(void)
|
|||||||
delete[] m_statusStrings;
|
delete[] m_statusStrings;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxStatusBar::Create(wxWindow *parent, wxWindowID id,
|
bool wxStatusBarGeneric::Create(wxWindow *parent,
|
||||||
const wxPoint& pos,
|
wxWindowID id,
|
||||||
const wxSize& size,
|
|
||||||
long style,
|
long style,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
@@ -78,7 +83,9 @@ bool wxStatusBar::Create(wxWindow *parent, wxWindowID id,
|
|||||||
m_borderX = wxTHICK_LINE_BORDER;
|
m_borderX = wxTHICK_LINE_BORDER;
|
||||||
m_borderY = 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
|
// Don't wish this to be found as a child
|
||||||
#ifndef __WXMAC__
|
#ifndef __WXMAC__
|
||||||
@@ -91,7 +98,7 @@ bool wxStatusBar::Create(wxWindow *parent, wxWindowID id,
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxStatusBar::SetFieldsCount(int number, const int widths[])
|
void wxStatusBarGeneric::SetFieldsCount(int number, const int widths[])
|
||||||
{
|
{
|
||||||
m_nFields = number;
|
m_nFields = number;
|
||||||
|
|
||||||
@@ -111,7 +118,7 @@ void wxStatusBar::SetFieldsCount(int number, const int widths[])
|
|||||||
SetStatusWidths(number, 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))
|
if ((number < 0) || (number >= m_nFields))
|
||||||
return;
|
return;
|
||||||
@@ -119,23 +126,17 @@ void wxStatusBar::SetStatusText(const wxString& text, int number)
|
|||||||
m_statusStrings[number] = text;
|
m_statusStrings[number] = text;
|
||||||
|
|
||||||
Refresh();
|
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))
|
wxCHECK_MSG( (n >= 0) && (n < m_nFields), wxEmptyString,
|
||||||
return wxString("");
|
_T("invalid status bar field index") );
|
||||||
else
|
|
||||||
return m_statusStrings[n];
|
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
|
// only set status widths, when n == number of statuswindows
|
||||||
if (n == m_nFields)
|
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);
|
wxPaintDC dc(this);
|
||||||
|
|
||||||
@@ -179,7 +180,7 @@ void wxStatusBar::OnPaint(wxPaintEvent& WXUNUSED(event) )
|
|||||||
# endif // MSW
|
# endif // MSW
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxStatusBar::DrawFieldText(wxDC& dc, int i)
|
void wxStatusBarGeneric::DrawFieldText(wxDC& dc, int i)
|
||||||
{
|
{
|
||||||
int leftMargin = 2;
|
int leftMargin = 2;
|
||||||
|
|
||||||
@@ -207,7 +208,7 @@ void wxStatusBar::DrawFieldText(wxDC& dc, int i)
|
|||||||
dc.DestroyClippingRegion();
|
dc.DestroyClippingRegion();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxStatusBar::DrawField(wxDC& dc, int i)
|
void wxStatusBarGeneric::DrawField(wxDC& dc, int i)
|
||||||
{
|
{
|
||||||
wxRect rect;
|
wxRect rect;
|
||||||
GetFieldRect(i, 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
|
// 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))
|
wxCHECK_MSG( (n >= 0) && (n < m_nFields), FALSE,
|
||||||
return FALSE;
|
_T("invalid status bar field index") );
|
||||||
|
|
||||||
int width, height;
|
int width, height;
|
||||||
GetClientSize(&width, &height);
|
GetClientSize(&width, &height);
|
||||||
@@ -308,7 +309,7 @@ bool wxStatusBar::GetFieldRect(int n, wxRect& rect) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Initialize colours
|
// Initialize colours
|
||||||
void wxStatusBar::InitColours(void)
|
void wxStatusBarGeneric::InitColours()
|
||||||
{
|
{
|
||||||
// Shadow colours
|
// Shadow colours
|
||||||
#if defined(__WIN95__)
|
#if defined(__WIN95__)
|
||||||
@@ -327,7 +328,7 @@ void wxStatusBar::InitColours(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Responds to colour changes, and passes event on to children.
|
// Responds to colour changes, and passes event on to children.
|
||||||
void wxStatusBar::OnSysColourChanged(wxSysColourChangedEvent& event)
|
void wxStatusBarGeneric::OnSysColourChanged(wxSysColourChangedEvent& event)
|
||||||
{
|
{
|
||||||
InitColours();
|
InitColours();
|
||||||
Refresh();
|
Refresh();
|
||||||
@@ -336,3 +337,18 @@ void wxStatusBar::OnSysColourChanged(wxSysColourChangedEvent& event)
|
|||||||
wxWindow::OnSysColourChanged(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
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: timer.cpp
|
// Name: gtk/timer.cpp
|
||||||
// Purpose:
|
// Purpose:
|
||||||
// Author: Robert Roebling
|
// Author: Robert Roebling
|
||||||
// Id: $Id$
|
// Id: $Id$
|
||||||
@@ -42,11 +42,10 @@ static gint timeout_callback( gpointer data )
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxTimer::wxTimer()
|
void wxTimer::Init()
|
||||||
{
|
{
|
||||||
m_tag = -1;
|
m_tag = -1;
|
||||||
m_milli = 1000;
|
m_milli = 1000;
|
||||||
m_oneShot = FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxTimer::~wxTimer()
|
wxTimer::~wxTimer()
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: timer.cpp
|
// Name: gtk/timer.cpp
|
||||||
// Purpose:
|
// Purpose:
|
||||||
// Author: Robert Roebling
|
// Author: Robert Roebling
|
||||||
// Id: $Id$
|
// Id: $Id$
|
||||||
@@ -42,11 +42,10 @@ static gint timeout_callback( gpointer data )
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxTimer::wxTimer()
|
void wxTimer::Init()
|
||||||
{
|
{
|
||||||
m_tag = -1;
|
m_tag = -1;
|
||||||
m_milli = 1000;
|
m_milli = 1000;
|
||||||
m_oneShot = FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxTimer::~wxTimer()
|
wxTimer::~wxTimer()
|
||||||
|
@@ -992,41 +992,40 @@ void wxDC::SetLogicalFunction(int function)
|
|||||||
{
|
{
|
||||||
m_logicalFunction = function;
|
m_logicalFunction = function;
|
||||||
|
|
||||||
SetRop((WXHDC) m_hDC);
|
SetRop(m_hDC);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDC::SetRop(WXHDC dc)
|
void wxDC::SetRop(WXHDC dc)
|
||||||
{
|
{
|
||||||
if (!dc || m_logicalFunction < 0)
|
if ( !dc || m_logicalFunction < 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int c_rop;
|
int rop;
|
||||||
|
|
||||||
switch (m_logicalFunction)
|
switch (m_logicalFunction)
|
||||||
{
|
{
|
||||||
case wxXOR: c_rop = R2_XORPEN; break;
|
case wxXOR: rop = R2_XORPEN; break;
|
||||||
case wxINVERT: c_rop = R2_NOT; break;
|
case wxINVERT: rop = R2_NOT; break;
|
||||||
case wxOR_REVERSE: c_rop = R2_MERGEPENNOT; break;
|
case wxOR_REVERSE: rop = R2_MERGEPENNOT; break;
|
||||||
case wxAND_REVERSE: c_rop = R2_MASKPENNOT; break;
|
case wxAND_REVERSE: rop = R2_MASKPENNOT; break;
|
||||||
case wxCLEAR: c_rop = R2_WHITE; break;
|
case wxCLEAR: rop = R2_WHITE; break;
|
||||||
case wxSET: c_rop = R2_BLACK; break;
|
case wxSET: rop = R2_BLACK; break;
|
||||||
case wxOR_INVERT: c_rop = R2_MERGENOTPEN; break;
|
case wxOR_INVERT: rop = R2_MERGENOTPEN; break;
|
||||||
case wxAND: c_rop = R2_MASKPEN; break;
|
case wxAND: rop = R2_MASKPEN; break;
|
||||||
case wxOR: c_rop = R2_MERGEPEN; break;
|
case wxOR: rop = R2_MERGEPEN; break;
|
||||||
case wxEQUIV: c_rop = R2_NOTXORPEN; break;
|
case wxEQUIV: rop = R2_NOTXORPEN; break;
|
||||||
case wxNAND: c_rop = R2_NOTMASKPEN; break;
|
case wxNAND: rop = R2_NOTMASKPEN; break;
|
||||||
case wxAND_INVERT: c_rop = R2_MASKNOTPEN; break;
|
case wxAND_INVERT: rop = R2_MASKNOTPEN; break;
|
||||||
case wxCOPY: c_rop = R2_COPYPEN; break;
|
case wxCOPY: rop = R2_COPYPEN; break;
|
||||||
case wxNO_OP: c_rop = R2_NOP; break;
|
case wxNO_OP: rop = R2_NOP; break;
|
||||||
case wxSRC_INVERT: c_rop = R2_NOTCOPYPEN; break;
|
case wxSRC_INVERT: rop = R2_NOTCOPYPEN; break;
|
||||||
case wxNOR: c_rop = R2_NOTMERGEPEN; break;
|
case wxNOR: rop = R2_NOTMERGEPEN; break;
|
||||||
default:
|
default:
|
||||||
{
|
|
||||||
wxFAIL_MSG( wxT("unsupported logical function") );
|
wxFAIL_MSG( wxT("unsupported logical function") );
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
SetROP2((HDC) dc, c_rop);
|
SetROP2(GetHdc(), rop);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxDC::StartDoc(const wxString& message)
|
bool wxDC::StartDoc(const wxString& message)
|
||||||
@@ -1295,10 +1294,8 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest,
|
|||||||
case wxSRC_INVERT: dwRop = NOTSRCCOPY; break;
|
case wxSRC_INVERT: dwRop = NOTSRCCOPY; break;
|
||||||
case wxNOR: dwRop = NOTSRCCOPY; break;
|
case wxNOR: dwRop = NOTSRCCOPY; break;
|
||||||
default:
|
default:
|
||||||
{
|
|
||||||
wxFAIL_MSG( wxT("unsupported logical function") );
|
wxFAIL_MSG( wxT("unsupported logical function") );
|
||||||
break;
|
return FALSE;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -43,10 +43,7 @@
|
|||||||
|
|
||||||
#if wxUSE_STATUSBAR
|
#if wxUSE_STATUSBAR
|
||||||
#include "wx/statusbr.h"
|
#include "wx/statusbr.h"
|
||||||
|
#include "wx/generic/statusbr.h"
|
||||||
#if wxUSE_NATIVE_STATUSBAR
|
|
||||||
#include "wx/msw/statbr95.h"
|
|
||||||
#endif
|
|
||||||
#endif // wxUSE_STATUSBAR
|
#endif // wxUSE_STATUSBAR
|
||||||
|
|
||||||
#if wxUSE_TOOLBAR
|
#if wxUSE_TOOLBAR
|
||||||
@@ -354,14 +351,27 @@ wxStatusBar *wxFrame::OnCreateStatusBar(int number,
|
|||||||
#if wxUSE_NATIVE_STATUSBAR
|
#if wxUSE_NATIVE_STATUSBAR
|
||||||
if ( UsesNativeStatusBar() )
|
if ( UsesNativeStatusBar() )
|
||||||
{
|
{
|
||||||
statusBar = new wxStatusBar95(this, id, style);
|
statusBar = (wxStatusBar *)new wxStatusBar95(this, id, style);
|
||||||
|
|
||||||
statusBar->SetFieldsCount(number);
|
statusBar->SetFieldsCount(number);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#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;
|
return statusBar;
|
||||||
@@ -369,12 +379,22 @@ wxStatusBar *wxFrame::OnCreateStatusBar(int number,
|
|||||||
|
|
||||||
void wxFrame::PositionStatusBar()
|
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
|
#if wxUSE_NATIVE_STATUSBAR
|
||||||
&& !m_frameStatusBar->IsKindOf(CLASSINFO(wxStatusBar95))
|
wxStatusBar95 *sb = wxDynamicCast(m_frameStatusBar, wxStatusBar95);
|
||||||
#endif
|
if ( sb )
|
||||||
)
|
{
|
||||||
|
wxSizeEvent event(GetSize(), sb->GetId());
|
||||||
|
event.SetEventObject(sb);
|
||||||
|
|
||||||
|
sb->GetEventHandler()->ProcessEvent(event);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif // wxUSE_NATIVE_STATUSBAR
|
||||||
{
|
{
|
||||||
int w, h;
|
int w, h;
|
||||||
GetClientSize(&w, &h);
|
GetClientSize(&w, &h);
|
||||||
@@ -772,17 +792,6 @@ bool wxFrame::HandleSize(int x, int y, WXUINT id)
|
|||||||
|
|
||||||
if ( !m_iconized )
|
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();
|
PositionStatusBar();
|
||||||
PositionToolBar();
|
PositionToolBar();
|
||||||
|
|
||||||
|
@@ -27,11 +27,10 @@
|
|||||||
#include "wx/dcclient.h"
|
#include "wx/dcclient.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __WIN95__
|
#if defined(__WIN95__) && wxUSE_NATIVE_STATUSBAR
|
||||||
|
|
||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
#include "wx/generic/statusbr.h"
|
#include "wx/statusbr.h"
|
||||||
#include "wx/msw/statbr95.h"
|
|
||||||
|
|
||||||
#include "wx/msw/private.h"
|
#include "wx/msw/private.h"
|
||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
@@ -40,14 +39,16 @@
|
|||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
#endif
|
#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)
|
EVT_SIZE(wxStatusBar95::OnSize)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// macros
|
// macros
|
||||||
@@ -59,7 +60,25 @@
|
|||||||
#define StatusBar_GetTextLen(h, n) LOWORD(SendMessage(h, SB_GETTEXTLENGTH, (WPARAM)n, 0))
|
#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 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
|
// implementation
|
||||||
@@ -76,13 +95,12 @@ wxStatusBar95::wxStatusBar95()
|
|||||||
m_windowId = 0;
|
m_windowId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxStatusBar95::wxStatusBar95(wxWindow *parent, wxWindowID id, long style)
|
bool wxStatusBar95::Create(wxWindow *parent,
|
||||||
{
|
wxWindowID id,
|
||||||
Create(parent, id, style);
|
long style,
|
||||||
}
|
const wxString& name)
|
||||||
|
|
||||||
bool wxStatusBar95::Create(wxWindow *parent, wxWindowID id, long style)
|
|
||||||
{
|
{
|
||||||
|
SetName(name);
|
||||||
SetParent(parent);
|
SetParent(parent);
|
||||||
|
|
||||||
if (id == -1)
|
if (id == -1)
|
||||||
@@ -95,20 +113,34 @@ bool wxStatusBar95::Create(wxWindow *parent, wxWindowID id, long style)
|
|||||||
wstyle |= SBARS_SIZEGRIP;
|
wstyle |= SBARS_SIZEGRIP;
|
||||||
|
|
||||||
m_hWnd = (WXHWND)CreateStatusWindow(wstyle,
|
m_hWnd = (WXHWND)CreateStatusWindow(wstyle,
|
||||||
wxT(""),
|
wxEmptyString,
|
||||||
(HWND)parent->GetHWND(),
|
GetHwndOf(parent),
|
||||||
m_windowId);
|
m_windowId);
|
||||||
if ( m_hWnd == 0 ) {
|
if ( m_hWnd == 0 )
|
||||||
wxLogSysError(wxT("can't create status bar window"));
|
{
|
||||||
|
wxLogSysError(_("Failed to create a status bar."));
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// this doesn't work: display problems (white 1-2 pixel borders...)
|
// 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);
|
// 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;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxStatusBar95::~wxStatusBar95()
|
||||||
|
{
|
||||||
|
delete [] m_statusWidths;
|
||||||
|
}
|
||||||
|
|
||||||
void wxStatusBar95::CopyFieldsWidth(const int widths[])
|
void wxStatusBar95::CopyFieldsWidth(const int widths[])
|
||||||
{
|
{
|
||||||
if (widths && !m_statusWidths)
|
if (widths && !m_statusWidths)
|
||||||
@@ -126,7 +158,8 @@ void wxStatusBar95::CopyFieldsWidth(const int widths[])
|
|||||||
|
|
||||||
void wxStatusBar95::SetFieldsCount(int nFields, 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;
|
m_nFields = nFields;
|
||||||
|
|
||||||
@@ -136,8 +169,7 @@ void wxStatusBar95::SetFieldsCount(int nFields, const int widths[])
|
|||||||
|
|
||||||
void wxStatusBar95::SetStatusWidths(int n, const int widths[])
|
void wxStatusBar95::SetStatusWidths(int n, const int widths[])
|
||||||
{
|
{
|
||||||
// @@ I don't understand what this function is for...
|
wxASSERT_MSG( n == m_nFields, _T("field number mismatch") );
|
||||||
wxASSERT( n == m_nFields );
|
|
||||||
|
|
||||||
CopyFieldsWidth(widths);
|
CopyFieldsWidth(widths);
|
||||||
SetFieldsWidth();
|
SetFieldsWidth();
|
||||||
@@ -148,6 +180,11 @@ void wxStatusBar95::SetFieldsWidth()
|
|||||||
if ( !m_nFields )
|
if ( !m_nFields )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
int aBorders[3];
|
||||||
|
SendMessage(GetHwnd(), SB_GETBORDERS, 0, (LPARAM)aBorders);
|
||||||
|
|
||||||
|
int extraWidth = aBorders[2]; // space between fields
|
||||||
|
|
||||||
int *pWidths = new int[m_nFields];
|
int *pWidths = new int[m_nFields];
|
||||||
|
|
||||||
int nWindowWidth, y;
|
int nWindowWidth, y;
|
||||||
@@ -168,12 +205,11 @@ void wxStatusBar95::SetFieldsWidth()
|
|||||||
if ( m_statusWidths[i] == -1 )
|
if ( m_statusWidths[i] == -1 )
|
||||||
nVarCount++;
|
nVarCount++;
|
||||||
else
|
else
|
||||||
nTotalWidth += m_statusWidths[i];
|
nTotalWidth += m_statusWidths[i] + extraWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( nVarCount == 0 ) {
|
if ( nVarCount == 0 ) {
|
||||||
// wrong! at least one field must be of variable width
|
wxFAIL_MSG( _T("at least one field must be of variable width") );
|
||||||
wxFAIL;
|
|
||||||
|
|
||||||
nVarCount++;
|
nVarCount++;
|
||||||
}
|
}
|
||||||
@@ -186,12 +222,12 @@ void wxStatusBar95::SetFieldsWidth()
|
|||||||
if ( m_statusWidths[i] == -1 )
|
if ( m_statusWidths[i] == -1 )
|
||||||
nCurPos += nVarWidth;
|
nCurPos += nVarWidth;
|
||||||
else
|
else
|
||||||
nCurPos += m_statusWidths[i];
|
nCurPos += m_statusWidths[i] + extraWidth;
|
||||||
pWidths[i] = nCurPos;
|
pWidths[i] = nCurPos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !StatusBar_SetParts(hwnd, m_nFields, pWidths) ) {
|
if ( !StatusBar_SetParts(GetHwnd(), m_nFields, pWidths) ) {
|
||||||
wxLogLastError(wxT("StatusBar_SetParts"));
|
wxLogLastError(wxT("StatusBar_SetParts"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,37 +236,78 @@ void wxStatusBar95::SetFieldsWidth()
|
|||||||
|
|
||||||
void wxStatusBar95::SetStatusText(const wxString& strText, int nField)
|
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"));
|
wxLogLastError(wxT("StatusBar_SetText"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxStatusBar95::GetStatusText(int nField) const
|
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(""));
|
wxString str;
|
||||||
int len = StatusBar_GetTextLen(hwnd, nField);
|
int len = StatusBar_GetTextLen(GetHwnd(), nField);
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
{
|
{
|
||||||
StatusBar_GetText(hwnd, nField, str.GetWriteBuf(len));
|
StatusBar_GetText(GetHwnd(), nField, str.GetWriteBuf(len));
|
||||||
str.UngetWriteBuf();
|
str.UngetWriteBuf();
|
||||||
}
|
}
|
||||||
return str;
|
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)
|
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);
|
SendMessage);
|
||||||
|
|
||||||
// adjust fields widths to the new size
|
// adjust fields widths to the new size
|
||||||
SetFieldsWidth();
|
SetFieldsWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_NATIVE_STATUSBAR
|
#endif // __WIN95__ && wxUSE_NATIVE_STATUSBAR
|
||||||
|
|
||||||
#else
|
|
||||||
#error "wxStatusBar95 is only available under Windows 95 and later."
|
|
||||||
#endif // __WIN95__
|
|
||||||
|
|
||||||
|
@@ -51,7 +51,7 @@ UINT WINAPI _EXPORT wxTimerProc(HWND hwnd, WORD, int idTimer, DWORD);
|
|||||||
#define _EXPORT _export
|
#define _EXPORT _export
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject)
|
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject)
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// implementation
|
// implementation
|
||||||
@@ -61,7 +61,7 @@ UINT WINAPI _EXPORT wxTimerProc(HWND hwnd, WORD, int idTimer, DWORD);
|
|||||||
// wxTimer class
|
// wxTimer class
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
wxTimer::wxTimer()
|
void wxTimer::Init()
|
||||||
{
|
{
|
||||||
m_id = 0;
|
m_id = 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user