1. added wxStatusBarUniv
2. several bug fixes to wxSpinButton/wxSpinCtrl git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11991 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -12,6 +12,10 @@
|
||||
#ifndef _WX_STATUSBR_H_BASE_
|
||||
#define _WX_STATUSBR_H_BASE_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "statbar.h"
|
||||
#endif
|
||||
|
||||
#include "wx/window.h"
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
@@ -23,19 +27,37 @@
|
||||
class WXDLLEXPORT wxStatusBarBase : public wxWindow
|
||||
{
|
||||
public:
|
||||
wxStatusBarBase() { m_statusWidths = NULL; }
|
||||
wxStatusBarBase();
|
||||
|
||||
// get/set the number of fields
|
||||
virtual void SetFieldsCount(int number = 1,
|
||||
const int *widths = (const int *) NULL) = 0;
|
||||
virtual ~wxStatusBarBase();
|
||||
|
||||
// field count
|
||||
// -----------
|
||||
|
||||
// set the number of fields and call SetStatusWidths(widths) if widths are
|
||||
// given
|
||||
virtual void SetFieldsCount(int number = 1, const int *widths = NULL);
|
||||
int GetFieldsCount() const { return m_nFields; }
|
||||
|
||||
// get/set the text of the given field
|
||||
// field text
|
||||
// ----------
|
||||
|
||||
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;
|
||||
// fields widths
|
||||
// -------------
|
||||
|
||||
// set status field widths as absolute numbers: positive widths mean that
|
||||
// the field has the specified absolute width, negative widths are
|
||||
// interpreted as the sizer options, i.e. the extra space (total space
|
||||
// minus the sum of fixed width fields) is divided between the fields with
|
||||
// negative width according to the abs value of the width (field with width
|
||||
// -2 grows twice as much as one with width -1 &c)
|
||||
virtual void SetStatusWidths(int n, const int widths[]);
|
||||
|
||||
// geometry
|
||||
// --------
|
||||
|
||||
// Get the position and size of the field's internal bounding rectangle
|
||||
virtual bool GetFieldRect(int i, wxRect& rect) const = 0;
|
||||
@@ -51,54 +73,54 @@ public:
|
||||
virtual bool AcceptsFocus() const { return FALSE; }
|
||||
|
||||
protected:
|
||||
int m_nFields; // the current number of fields
|
||||
int *m_statusWidths; // the width (if !NULL) of the fields
|
||||
// set the widths array to NULL
|
||||
void InitWidths();
|
||||
|
||||
// free the status widths arrays
|
||||
void FreeWidths();
|
||||
|
||||
// reset the widths
|
||||
void ReinitWidths() { FreeWidths(); InitWidths(); }
|
||||
|
||||
// calculate the real field widths for the given total available size
|
||||
wxArrayInt CalculateAbsWidths(wxCoord widthTotal) const;
|
||||
|
||||
// the current number of fields
|
||||
int m_nFields;
|
||||
|
||||
// the widths of the fields in pixels if !NULL, all fields have the same
|
||||
// width otherwise
|
||||
int *m_statusWidths;
|
||||
};
|
||||
|
||||
#if defined(__WIN32__) && wxUSE_NATIVE_STATUSBAR
|
||||
#include "wx/msw/statbr95.h"
|
||||
// ----------------------------------------------------------------------------
|
||||
// include the actual wxStatusBar class declaration
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
typedef wxStatusBar95 wxStatusBarReal;
|
||||
#if defined(__WXUNIVERSAL__)
|
||||
#define wxStatusBarUniv wxStatusBar
|
||||
#define sm_classwxStatusBarUniv sm_classwxStatusBar
|
||||
|
||||
#include "wx/univ/statusbr.h"
|
||||
#elif defined(__WIN32__) && wxUSE_NATIVE_STATUSBAR
|
||||
#define wxStatusBar95 wxStatusBar
|
||||
#define sm_classwxStatusBar95 sm_classwxStatusBar
|
||||
|
||||
#include "wx/msw/statbr95.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#define wxStatusBarMac wxStatusBar
|
||||
#define sm_classwxStatusBarMac sm_classwxStatusBar
|
||||
|
||||
#include "wx/generic/statusbr.h"
|
||||
#include "wx/mac/statusbr.h"
|
||||
|
||||
typedef wxStatusBarMac wxStatusBarReal;
|
||||
#else
|
||||
#define wxStatusBarGeneric wxStatusBar
|
||||
#define sm_classwxStatusBarGeneric sm_classwxStatusBar
|
||||
|
||||
#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 WXDLLEXPORT wxStatusBar : public wxStatusBarReal
|
||||
{
|
||||
public:
|
||||
wxStatusBar() { }
|
||||
wxStatusBar(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& WXUNUSED(pos) = wxDefaultPosition,
|
||||
const wxSize& WXUNUSED(size) = wxDefaultSize,
|
||||
long style = wxST_SIZEGRIP,
|
||||
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 // wxUSE_STATUSBAR
|
||||
|
||||
#endif
|
||||
// _WX_STATUSBR_H_BASE_
|
||||
|
@@ -1035,6 +1035,8 @@ public:
|
||||
size_t Add(const wxString& str);
|
||||
// add new element at given position
|
||||
void Insert(const wxString& str, size_t uiIndex);
|
||||
// expand the array to have count elements
|
||||
void SetCount(size_t count);
|
||||
// remove first item matching this value
|
||||
void Remove(const wxChar *sz);
|
||||
// remove item by index
|
||||
|
@@ -35,6 +35,7 @@
|
||||
#define wxINP_HANDLER_SCROLLBAR _T("scrollbar")
|
||||
#define wxINP_HANDLER_SLIDER _T("slider")
|
||||
#define wxINP_HANDLER_SPINBTN _T("spinbtn")
|
||||
#define wxINP_HANDLER_STATUSBAR _T("statusbar")
|
||||
#define wxINP_HANDLER_TEXTCTRL _T("textctrl")
|
||||
#define wxINP_HANDLER_TOPLEVEL _T("toplevel")
|
||||
|
||||
|
@@ -26,24 +26,10 @@
|
||||
class WXDLLEXPORT wxMenuInfo;
|
||||
WX_DECLARE_OBJARRAY(wxMenuInfo, wxMenuInfoArray);
|
||||
|
||||
class wxPopupMenuWindow;
|
||||
|
||||
class WXDLLEXPORT wxMenuGeometryInfo;
|
||||
class WXDLLEXPORT wxPopupMenuWindow;
|
||||
class WXDLLEXPORT wxRenderer;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxMenu helper classes, used in implementation only
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// used by wxRenderer
|
||||
class WXDLLEXPORT wxMenuGeometryInfo
|
||||
{
|
||||
public:
|
||||
// get the total size of the menu
|
||||
virtual wxSize GetSize() const = 0;
|
||||
|
||||
virtual ~wxMenuGeometryInfo();
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxMenu
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -44,6 +44,16 @@ class WXDLLEXPORT wxGauge;
|
||||
#include "wx/gdicmn.h"
|
||||
#include "wx/scrolbar.h" // for wxScrollBar::Element
|
||||
|
||||
// helper class used by wxMenu-related functions
|
||||
class WXDLLEXPORT wxMenuGeometryInfo
|
||||
{
|
||||
public:
|
||||
// get the total size of the menu
|
||||
virtual wxSize GetSize() const = 0;
|
||||
|
||||
virtual ~wxMenuGeometryInfo();
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxRenderer: abstract renderers interface
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -220,7 +230,6 @@ public:
|
||||
int step = 1,
|
||||
int flags = 0) = 0;
|
||||
|
||||
#if wxUSE_MENUS
|
||||
// draw a menu bar item
|
||||
virtual void DrawMenuBarItem(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
@@ -244,7 +253,14 @@ public:
|
||||
virtual void DrawMenuSeparator(wxDC& dc,
|
||||
wxCoord y,
|
||||
const wxMenuGeometryInfo& geomInfo) = 0;
|
||||
#endif
|
||||
|
||||
// draw a status bar field: wxCONTROL_ISDEFAULT bit in the flags is
|
||||
// interpreted specially and means "draw the status bar grip" here
|
||||
virtual void DrawStatusField(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
const wxString& label,
|
||||
int flags = 0) = 0;
|
||||
|
||||
// draw complete frame/dialog titlebar
|
||||
virtual void DrawFrameTitleBar(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
@@ -253,7 +269,7 @@ public:
|
||||
int flags,
|
||||
int specialButton = 0,
|
||||
int specialButtonFlags = 0) = 0;
|
||||
|
||||
|
||||
// draw frame borders
|
||||
virtual void DrawFrameBorder(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
@@ -373,7 +389,6 @@ public:
|
||||
// get the size of one progress bar step (in horz and vertical directions)
|
||||
virtual wxSize GetProgressBarStep() const = 0;
|
||||
|
||||
#if wxUSE_MENUS
|
||||
// get the size of rectangle to use in the menubar for the given text rect
|
||||
virtual wxSize GetMenuBarItemSize(const wxSize& sizeText) const = 0;
|
||||
|
||||
@@ -384,19 +399,25 @@ public:
|
||||
// the returned pointer must be deleted by the caller
|
||||
virtual wxMenuGeometryInfo *GetMenuGeometry(wxWindow *win,
|
||||
const wxMenu& menu) const = 0;
|
||||
#endif
|
||||
|
||||
// get the borders around the status bar fields (x and y fields of the
|
||||
// return value) and also, optionally, the border between the fields
|
||||
virtual wxSize GetStatusBarBorders(wxCoord *borderBetweenFields) const = 0;
|
||||
|
||||
// get client area rectangle of top level window (i.e. subtract
|
||||
// decorations from given rectangle)
|
||||
virtual wxRect GetFrameClientArea(const wxRect& rect, int flags) const = 0;
|
||||
|
||||
// get size of whole top level window, given size of its client area size
|
||||
virtual wxSize GetFrameTotalSize(const wxSize& clientSize, int flags) const = 0;
|
||||
|
||||
// get titlebar icon size
|
||||
virtual wxSize GetFrameIconSize() const = 0;
|
||||
|
||||
// returns one of wxHT_TOPLEVEL_XXX constants
|
||||
virtual int HitTestFrame(const wxRect& rect,
|
||||
const wxPoint& pt,
|
||||
int flags) const = 0;
|
||||
int flags = 0) const = 0;
|
||||
|
||||
// virtual dtor for any base class
|
||||
virtual ~wxRenderer();
|
||||
@@ -599,7 +620,6 @@ public:
|
||||
int flags = 0)
|
||||
{ m_renderer->DrawSliderTicks(dc, rect, sizeThumb, orient,
|
||||
start, end, start, flags); }
|
||||
#if wxUSE_MENUS
|
||||
|
||||
virtual void DrawMenuBarItem(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
@@ -621,7 +641,13 @@ public:
|
||||
wxCoord y,
|
||||
const wxMenuGeometryInfo& geomInfo)
|
||||
{ m_renderer->DrawMenuSeparator(dc, y, geomInfo); }
|
||||
#endif
|
||||
|
||||
virtual void DrawStatusField(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
const wxString& label,
|
||||
int flags = 0)
|
||||
{ m_renderer->DrawStatusField(dc, rect, label, flags); }
|
||||
|
||||
virtual void DrawFrameTitleBar(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
const wxString& title,
|
||||
@@ -629,7 +655,7 @@ public:
|
||||
int flags,
|
||||
int specialButton = 0,
|
||||
int specialButtonFlag = 0)
|
||||
{ m_renderer->DrawFrameTitleBar(dc, rect, title, icon, flags,
|
||||
{ m_renderer->DrawFrameTitleBar(dc, rect, title, icon, flags,
|
||||
specialButton, specialButtonFlag); }
|
||||
virtual void DrawFrameBorder(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
@@ -717,13 +743,13 @@ public:
|
||||
{ return m_renderer->GetSliderThumbSize(rect, orient); }
|
||||
virtual wxSize GetProgressBarStep() const
|
||||
{ return m_renderer->GetProgressBarStep(); }
|
||||
#if wxUSE_MENUS
|
||||
virtual wxSize GetMenuBarItemSize(const wxSize& sizeText) const
|
||||
{ return m_renderer->GetMenuBarItemSize(sizeText); }
|
||||
virtual wxMenuGeometryInfo *GetMenuGeometry(wxWindow *win,
|
||||
const wxMenu& menu) const
|
||||
{ return m_renderer->GetMenuGeometry(win, menu); }
|
||||
#endif
|
||||
virtual wxSize GetStatusBarBorders(wxCoord *borderBetweenFields) const
|
||||
{ return m_renderer->GetStatusBarBorders(borderBetweenFields); }
|
||||
virtual wxRect GetFrameClientArea(const wxRect& rect, int flags) const
|
||||
{ return m_renderer->GetFrameClientArea(rect, flags); }
|
||||
virtual wxSize GetFrameTotalSize(const wxSize& clientSize, int flags) const
|
||||
|
@@ -98,7 +98,7 @@
|
||||
#define wxUSE_STATLINE 1
|
||||
#define wxUSE_STATTEXT 1
|
||||
#define wxUSE_STATBMP 1
|
||||
#define wxUSE_STATUSBAR 0
|
||||
#define wxUSE_STATUSBAR 1
|
||||
#define wxUSE_TEXTCTRL 1
|
||||
#define wxUSE_TOOLTIPS 0
|
||||
#define wxUSE_TREECTRL 0
|
||||
@@ -121,7 +121,7 @@
|
||||
#define wxUSE_FILEDLG 0
|
||||
#define wxUSE_COLOURDLG 0
|
||||
#define wxUSE_CHOICEDLG 0
|
||||
#define wxUSE_NUMBERDLG 0
|
||||
#define wxUSE_NUMBERDLG 1
|
||||
#define wxUSE_STARTUP_TIPS 0
|
||||
#define wxUSE_MSGDLG 1
|
||||
#define wxUSE_SPLITTER 1
|
||||
@@ -252,7 +252,7 @@
|
||||
#define wxUSE_STATLINE 1
|
||||
#define wxUSE_STATTEXT 1
|
||||
#define wxUSE_STATBMP 1
|
||||
#define wxUSE_STATUSBAR 0
|
||||
#define wxUSE_STATUSBAR 1
|
||||
#define wxUSE_TEXTCTRL 1
|
||||
#define wxUSE_TOOLTIPS 0
|
||||
#define wxUSE_TREECTRL 0
|
||||
@@ -275,7 +275,7 @@
|
||||
#define wxUSE_COLOURDLG 0
|
||||
#define wxUSE_TEXTDLG 0
|
||||
#define wxUSE_CHOICEDLG 0
|
||||
#define wxUSE_NUMBERDLG 0
|
||||
#define wxUSE_NUMBERDLG 1
|
||||
#define wxUSE_STARTUP_TIPS 0
|
||||
#define wxUSE_MSGDLG 1
|
||||
#define wxUSE_SPLITTER 1
|
||||
|
108
include/wx/univ/statusbr.h
Normal file
108
include/wx/univ/statusbr.h
Normal file
@@ -0,0 +1,108 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/statusbr.h
|
||||
// Purpose: wxStatusBarUniv: wxStatusBar for wxUniversal declaration
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 14.10.01
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_STATUSBR_H_
|
||||
#define _WX_UNIV_STATUSBR_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "univstatusbr.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxStatusBar: a window near the bottom of the frame used for status info
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxStatusBarUniv : public wxStatusBarBase,
|
||||
public wxInputConsumer
|
||||
{
|
||||
public:
|
||||
wxStatusBarUniv() { Init(); }
|
||||
|
||||
wxStatusBarUniv(wxWindow *parent,
|
||||
wxWindowID id = -1,
|
||||
long style = 0,
|
||||
const wxString& name = wxPanelNameStr)
|
||||
{
|
||||
Init();
|
||||
|
||||
(void)Create(parent, id, style, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id = -1,
|
||||
long style = 0,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
|
||||
// set field count/widths
|
||||
virtual void SetFieldsCount(int number = 1, const int *widths = NULL);
|
||||
virtual void SetStatusWidths(int n, const int widths[]);
|
||||
|
||||
// get/set the text of the given field
|
||||
virtual void SetStatusText(const wxString& text, int number = 0);
|
||||
virtual wxString GetStatusText(int number = 0) const;
|
||||
|
||||
// Get the position and size of the field's internal bounding rectangle
|
||||
virtual bool GetFieldRect(int i, wxRect& rect) const;
|
||||
|
||||
// sets the minimal vertical size of the status bar
|
||||
virtual void SetMinHeight(int height);
|
||||
|
||||
// get the dimensions of the horizontal and vertical borders
|
||||
virtual int GetBorderX() const;
|
||||
virtual int GetBorderY() const;
|
||||
|
||||
protected:
|
||||
// recalculate the field widths
|
||||
void OnSize(wxSizeEvent& event);
|
||||
|
||||
// draw the statusbar
|
||||
virtual void DoDraw(wxControlRenderer *renderer);
|
||||
|
||||
// wxInputConsumer pure virtual
|
||||
virtual wxWindow *GetInputWindow() const
|
||||
{ return wxConstCast(this, wxStatusBar); }
|
||||
|
||||
// tell them about our preferred height
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
||||
// override DoSetSize() to prevent the status bar height from changing
|
||||
virtual void DoSetSize(int x, int y,
|
||||
int width, int height,
|
||||
int sizeFlags = wxSIZE_AUTO);
|
||||
|
||||
// get the (fixed) status bar height
|
||||
wxCoord GetHeight() const;
|
||||
|
||||
// get the rectangle containing all the fields and the border between them
|
||||
//
|
||||
// also updates m_widthsAbs if necessary
|
||||
wxRect GetTotalFieldRect(wxCoord *borderBetweenFields);
|
||||
|
||||
// refresh the given field
|
||||
void RefreshField(int i);
|
||||
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
private:
|
||||
// the status fields strings
|
||||
wxArrayString m_statusText;
|
||||
|
||||
// the absolute status fields widths
|
||||
wxArrayInt m_widthsAbs;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxStatusBarUniv)
|
||||
DECLARE_EVENT_TABLE()
|
||||
WX_DECLARE_INPUT_CONSUMER()
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_STATUSBR_H_
|
||||
|
@@ -35,7 +35,7 @@ enum
|
||||
wxTOPLEVEL_BUTTON_MAXIMIZE = 0x02000000,
|
||||
wxTOPLEVEL_BUTTON_ICONIZE = 0x04000000,
|
||||
wxTOPLEVEL_BUTTON_RESTORE = 0x08000000,
|
||||
wxTOPLEVEL_BUTTON_HELP = 0x10000000,
|
||||
wxTOPLEVEL_BUTTON_HELP = 0x10000000,
|
||||
};
|
||||
|
||||
// frame hit test return values:
|
||||
@@ -115,14 +115,15 @@ public:
|
||||
|
||||
// implementation from now on
|
||||
// --------------------------
|
||||
|
||||
|
||||
// tests for frame's part at given point
|
||||
long HitTest(const wxPoint& pt) const;
|
||||
|
||||
protected:
|
||||
virtual bool PerformAction(const wxControlAction& action,
|
||||
long numArg = -1,
|
||||
const wxString& strArg = wxEmptyString);
|
||||
|
||||
protected:
|
||||
// handle titlebar button click event
|
||||
virtual void ClickTitleBarButton(long button);
|
||||
|
||||
@@ -133,7 +134,7 @@ protected:
|
||||
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
|
||||
void RefreshTitleBar();
|
||||
void OnNcPaint(wxPaintEvent& event);
|
||||
|
||||
|
Reference in New Issue
Block a user