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:
Vadim Zeitlin
2001-10-14 21:38:58 +00:00
parent 5d9007815f
commit 71e030352d
25 changed files with 1157 additions and 362 deletions

View File

@@ -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")

View File

@@ -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
// ----------------------------------------------------------------------------

View File

@@ -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

View File

@@ -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
View 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_

View File

@@ -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);