# BaseOnly /src/common but only needed for the wxBase compilation
# Generic /src/generic
# Common /src/common
-# MSW /src/msw
-# Mac /src/mac for Mac OS X with Apple Developer Tools
+# MSW /src/msw
+# Mac /src/mac for Mac OS X with Apple Developer Tools
# Motif /src/motif
-# Univ /src/univ or src/univ/themes
-# Unix /src/unix
-# GTK /src/gtk
-# MGL /src/mgl
-# OS2 /src/os2
-# HTML /src/html
+# Univ /src/univ or src/univ/themes
+# Unix /src/unix
+# GTK /src/gtk
+# MGL /src/mgl
+# OS2 /src/os2
+# HTML /src/html
#
# 'H' suffix means these are headers, not .cpp files
#
-# WXH /include/wx
-# GTKH /include/wx/gtk
-# MacH /include/wx/mac
+# WXH /include/wx
+# GTKH /include/wx/gtk
+# MacH /include/wx/mac
# MotifH /include/wx/motif
-# MSWH /include/wx/msw
-# OS2H /include/wx/os2
+# MSWH /include/wx/msw
+# OS2H /include/wx/os2
# GenericH /include/wx/generic
# HtmlH /include/wx/html
# ProtoH /include/wx/protocol
#
# 'R' suffix means these are resource files
#
-# MacR /src/mac
+# MacR /src/mac
#
# The third column may be empty or contain some additional info about this
# file (only compile it in 16bit mode, don't compile it with this or that
# compiler, &c)
#
# Known flags:
-# Base makes part of the base library too
+# Base makes part of the base library too
# NotWin32 not used under Win32, but used under Win16
# Win32Only only can be compiled under Win32
# Generic generic code which might be used instead of native one
-# OLE OLE file (needs Win32 and a decent compiler)
+# OLE OLE file (needs Win32 and a decent compiler)
# Socket Socket file (currently doesn't compile under Win16)
# NotMSW Not required for the MSW port
# NotMac Not required for the MAC port under Mac OS X
# NotMGL Not required for the MGL port
# NotGTK Not required for the GTK port
-# NotX Not required for the Motif port
+# NotX Not required for the Motif port
# NotOS2 Not required for the os2Pm port
+# NotUniv Not required for the wxUniversal
# LowLevel Low level GUI toolkit file, used by wxUniversal as well
-# Theme implements a wxUniv theme
+# Theme implements a wxUniv theme
###############################################################################
# File name Type Flags
serbase.cpp Common Base
sizer.cpp Common
socket.cpp Common Socket,Base
+statbar.cpp Common
strconv.cpp Common Base
stream.cpp Common Base
string.cpp Common Base
statbox.cpp Univ
statline.cpp Univ
stattext.cpp Univ
+statusbr.cpp Univ
textctrl.cpp Univ
theme.cpp Univ
gtk.cpp Univ Theme
statbox.h UnivH
statline.h UnivH
stattext.h UnivH
+statusbr.h UnivH
textctrl.h UnivH
theme.h UnivH
window.h UnivH
\helpref{wxStatusBar::SetStatusText}{wxstatusbarsetstatustext}
-\membersection{wxStatusBar::DrawField}\label{wxstatusbardrawfield}
-
-\func{virtual void}{DrawField}{\param{wxDC\& }{dc}, \param{int }{i}}
-
-Draws a field, including shaded borders and text.
-
-\wxheading{Parameters}
-
-\docparam{dc}{The device context to draw onto.}
-
-\docparam{i}{The field to be drawn.}
-
-\wxheading{See also}
-
-\helpref{wxStatusBar::DrawFieldText}{wxstatusbardrawfieldtext}
-
-\membersection{wxStatusBar::DrawFieldText}\label{wxstatusbardrawfieldtext}
-
-\func{virtual void}{DrawFieldText}{\param{wxDC\& }{dc}, \param{int }{i}}
-
-Draws a field's text.
-
-\wxheading{Parameters}
-
-\docparam{dc}{The device context to draw onto.}
-
-\docparam{i}{The field whose text is to be drawn.}
-
-\wxheading{See also}
-
-\helpref{wxStatusBar::DrawField}{wxstatusbardrawfield}
-
-\membersection{wxStatusBar::InitColours}\label{wxstatusbarinitcolours}
-
-\func{virtual void}{InitColours}{\void}
-
-Sets up the background colour and shading pens using suitable system colours (Windows) or tasteful shades
-of grey (other platforms).
-
-\wxheading{Remarks}
-
-This function is called when the window is created, and also
-from \helpref{wxStatusBar::OnSysColourChanged}{wxstatusbaronsyscolourchanged} on Windows.
-
-\wxheading{See also}
-
-\helpref{wxStatusBar::OnSysColourChanged}{wxstatusbaronsyscolourchanged}
-
-\membersection{wxStatusBar::OnSysColourChanged}\label{wxstatusbaronsyscolourchanged}
-
-\func{void}{OnSysColourChanged}{\param{wxSysColourChangedEvent\& }{event}}
-
-Handles a system colour change by calling \helpref{wxStatusBar::InitColours}{wxstatusbarinitcolours},
-and refreshes the window.
-
-\wxheading{Parameters}
-
-\docparam{event}{The colour change event.}
-
-\wxheading{See also}
-
-\helpref{wxStatusBar::InitColours}{wxstatusbarinitcolours}
+%% VZ: these functions are not in wxStatusBar API, these are just
+%% implementation details of wxStatusBarGeneric
+%%
+%% \membersection{wxStatusBar::DrawField}\label{wxstatusbardrawfield}
+%%
+%% \func{virtual void}{DrawField}{\param{wxDC\& }{dc}, \param{int }{i}}
+%%
+%% Draws a field, including shaded borders and text.
+%%
+%% \wxheading{Parameters}
+%%
+%% \docparam{dc}{The device context to draw onto.}
+%%
+%% \docparam{i}{The field to be drawn.}
+%%
+%% \wxheading{See also}
+%%
+%% \helpref{wxStatusBar::DrawFieldText}{wxstatusbardrawfieldtext}
+%%
+%% \membersection{wxStatusBar::DrawFieldText}\label{wxstatusbardrawfieldtext}
+%%
+%% \func{virtual void}{DrawFieldText}{\param{wxDC\& }{dc}, \param{int }{i}}
+%%
+%% Draws a field's text.
+%%
+%% \wxheading{Parameters}
+%%
+%% \docparam{dc}{The device context to draw onto.}
+%%
+%% \docparam{i}{The field whose text is to be drawn.}
+%%
+%% \wxheading{See also}
+%%
+%% \helpref{wxStatusBar::DrawField}{wxstatusbardrawfield}
+%%
+%% \membersection{wxStatusBar::InitColours}\label{wxstatusbarinitcolours}
+%%
+%% \func{virtual void}{InitColours}{\void}
+%%
+%% Sets up the background colour and shading pens using suitable system colours (Windows) or tasteful shades
+%% of grey (other platforms).
+%%
+%% \wxheading{Remarks}
+%%
+%% This function is called when the window is created, and also
+%% from \helpref{wxStatusBar::OnSysColourChanged}{wxstatusbaronsyscolourchanged} on Windows.
+%%
+%% \wxheading{See also}
+%%
+%% \helpref{wxStatusBar::OnSysColourChanged}{wxstatusbaronsyscolourchanged}
+%%
+%% \membersection{wxStatusBar::OnSysColourChanged}\label{wxstatusbaronsyscolourchanged}
+%%
+%% \func{void}{OnSysColourChanged}{\param{wxSysColourChangedEvent\& }{event}}
+%%
+%% Handles a system colour change by calling \helpref{wxStatusBar::InitColours}{wxstatusbarinitcolours},
+%% and refreshes the window.
+%%
+%% \wxheading{Parameters}
+%%
+%% \docparam{event}{The colour change event.}
+%%
+%% \wxheading{See also}
+%%
+%% \helpref{wxStatusBar::InitColours}{wxstatusbarinitcolours}
\membersection{wxStatusBar::SetFieldsCount}\label{wxstatusbarsetfieldscount}
\func{virtual void}{SetStatusWidths}{\param{int}{ n}, \param{int *}{widths}}
-Sets the widths of the fields in the status line.
+Sets the widths of the fields in the status line. There are two types of
+fields: fixed widths one and variable width fields. For the fixed width fields
+you should specify their (constant) width in pixels. For the variable width
+fields, specify a negative number which indicates how should the field expand:
+the space left for all variable width fields is divided between them according
+to the absolute value of this number. A variable width field with width of $-2$
+gets twice as much of it as a field with width $-1$ and so on.
+
+For example, to create one fixed width field of width $50$ in the right part of
+the status bar and two more fields which get $66$\% and $33$\% of the remaining
+space correspondingly, you should use an array containing $-2$, $-1$ and $100$.
\wxheading{Parameters}
-\docparam{n}{The number of fields in the status bar.}
+\docparam{n}{The number of fields in the status bar. Must be equal to the
+number passed to \helpref{SetFieldsCount}{wxstatusbarsetfieldscount} the last
+time it was called.}
-\docparam{widths}{Must contain an array of {\it n} integers, each of which is a status field width
-in pixels. A value of -1 indicates that the field is variable width; at least one
-field must be -1. You should delete this array after calling {\bf SetStatusWidths}.}
+\docparam{widths}{Contains an array of {\it n} integers, each of which is
+either an absolute status field width in pixels if positive or indicates a
+variable width field if negative}
\wxheading{Remarks}
#ifndef _WX_STATUSBR_H_BASE_
#define _WX_STATUSBR_H_BASE_
+#ifdef __GNUG__
+ #pragma interface "statbar.h"
+#endif
+
#include "wx/window.h"
#if wxUSE_STATUSBAR
class WXDLLEXPORT wxStatusBarBase : public wxWindow
{
public:
- wxStatusBarBase() { m_statusWidths = NULL; }
+ wxStatusBarBase();
+
+ virtual ~wxStatusBarBase();
+
+ // field count
+ // -----------
- // get/set the number of fields
- virtual void SetFieldsCount(int number = 1,
- const int *widths = (const int *) NULL) = 0;
+ // 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;
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
+// ----------------------------------------------------------------------------
+
+#if defined(__WXUNIVERSAL__)
+ #define wxStatusBarUniv wxStatusBar
+ #define sm_classwxStatusBarUniv sm_classwxStatusBar
- typedef wxStatusBar95 wxStatusBarReal;
+ #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
- #include "wx/generic/statusbr.h"
+ #define wxStatusBarGeneric wxStatusBar
+ #define sm_classwxStatusBarGeneric sm_classwxStatusBar
- typedef wxStatusBarGeneric wxStatusBarReal;
+ #include "wx/generic/statusbr.h"
#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_
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
#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")
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
// ----------------------------------------------------------------------------
#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
// ----------------------------------------------------------------------------
int step = 1,
int flags = 0) = 0;
-#if wxUSE_MENUS
// draw a menu bar item
virtual void DrawMenuBarItem(wxDC& dc,
const wxRect& rect,
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,
int flags,
int specialButton = 0,
int specialButtonFlags = 0) = 0;
-
+
// draw frame borders
virtual void DrawFrameBorder(wxDC& dc,
const wxRect& rect,
// 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;
// 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();
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,
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,
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,
{ 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
#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
#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
#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
#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
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// 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_
+
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:
// 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);
// common part of all ctors
void Init();
-
+
void RefreshTitleBar();
void OnNcPaint(wxPaintEvent& event);
// SetFieldsCount() with the same number of fields should be ok
if ( nFields != -1 )
{
- // we set the widths only for 2 of them, otherwise let all the fields
- // have equal width (the default behaviour)
- const int *widths = NULL;
- if ( nFields == 2 )
+ static const int widthsFor2Fields[] = { 200, -1 };
+ static const int widthsFor3Fields[] = { -1, -2, -1 };
+ static const int widthsFor4Fields[] = { 100, -1, 100, -2, 100 };
+
+ static const int *widths[] =
{
- static const int widthsFor2Fields[2] = { 200, -1 };
- widths = widthsFor2Fields;
- }
+ NULL, // 1 field: default
+ widthsFor2Fields, // 2 fields: 1 fixed, 1 var
+ widthsFor3Fields, // 3 fields: 3 var
+ widthsFor4Fields, // 4 fields: 3 fixed, 2 vars
+ NULL // 5 fields: default (all have same width)
+ };
- sb->SetFieldsCount(nFields, widths);
+ sb->SetFieldsCount(nFields, widths[nFields - 1]);
wxLogStatus(this,
wxString::Format(wxT("Status bar now has %ld fields"),
#ifdef USE_STATIC_BITMAP
m_statbmp = new wxStaticBitmap(this, -1, wxIcon(green_xpm));
#else
- m_statbmp = new wxBitmapButton(this, -1, CreateBitmapForButton());
+ m_statbmp = new wxBitmapButton(this, -1, CreateBitmapForButton(),
+ wxDefaultPosition, wxDefaultSize,
+ wxBU_EXACTFIT);
#endif
m_timer.Start(1000);
m_checkbox->SetSize(rect.x + 2, rect.y + 2, rect.width - 4, rect.height - 4);
GetFieldRect(Field_Bitmap, rect);
-#ifdef USE_BUTTON_FOR_BITMAP
- wxSize size(BITMAP_SIZE_X, BITMAP_SIZE_Y);
-#else
wxSize size = m_statbmp->GetSize();
-#endif
m_statbmp->Move(rect.x + (rect.width - size.x) / 2,
rect.y + (rect.height - size.y) / 2);
{
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());
-
- wxCoord y;
- dc.GetTextExtent( "X", NULL, &y );
-
- int height = (int)( (11*y)/10 + 2*statusBar->GetBorderY());
-
- statusBar->SetSize( -1, -1, -1, height );
-
statusBar->SetFieldsCount(number);
return statusBar;
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: common/statbar.cpp
+// Purpose: wxStatusBarBase implementation
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 14.10.01
+// RCS-ID: $Id$
+// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// License: wxWindows license
+///////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#ifdef __GNUG__
+ #pragma implementation "statbar.h"
+#endif
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+ #include "wx/statusbr.h"
+#endif //WX_PRECOMP
+
+#if wxUSE_STATUSBAR
+
+// ============================================================================
+// wxStatusBarBase implementation
+// ============================================================================
+
+IMPLEMENT_DYNAMIC_CLASS(wxStatusBar, wxWindow)
+
+// ----------------------------------------------------------------------------
+// ctor/dtor
+// ----------------------------------------------------------------------------
+
+wxStatusBarBase::wxStatusBarBase()
+{
+ m_nFields = 0;
+
+ InitWidths();
+}
+
+wxStatusBarBase::~wxStatusBarBase()
+{
+ FreeWidths();
+}
+
+// ----------------------------------------------------------------------------
+// widths array handling
+// ----------------------------------------------------------------------------
+
+void wxStatusBarBase::InitWidths()
+{
+ m_statusWidths = NULL;
+}
+
+void wxStatusBarBase::FreeWidths()
+{
+ delete [] m_statusWidths;
+}
+
+// ----------------------------------------------------------------------------
+// field widths
+// ----------------------------------------------------------------------------
+
+void wxStatusBarBase::SetFieldsCount(int number, const int *widths)
+{
+ wxCHECK_RET( number > 0, _T("invalid field number in SetFieldsCount") );
+
+ bool refresh = FALSE;
+
+ if ( number != m_nFields )
+ {
+ m_nFields = number;
+
+ ReinitWidths();
+
+ refresh = TRUE;
+ }
+ //else: keep the old m_statusWidths if we had them
+
+ if ( widths )
+ {
+ SetStatusWidths(number, widths);
+
+ // already done from SetStatusWidths()
+ refresh = FALSE;
+ }
+
+ if ( refresh )
+ Refresh();
+}
+
+void wxStatusBarBase::SetStatusWidths(int WXUNUSED_UNLESS_DEBUG(n),
+ const int widths[])
+{
+ wxCHECK_RET( widths, _T("NULL pointer in SetStatusWidths") );
+
+ wxASSERT_MSG( n == m_nFields, _T("field number mismatch") );
+
+ if ( !m_statusWidths )
+ m_statusWidths = new int[m_nFields];
+
+ for ( int i = 0; i < m_nFields; i++ )
+ {
+ m_statusWidths[i] = widths[i];
+ }
+
+ // update the display after the widths changed
+ Refresh();
+}
+
+wxArrayInt wxStatusBarBase::CalculateAbsWidths(wxCoord widthTotal) const
+{
+ wxArrayInt widths;
+
+ if ( m_statusWidths == NULL )
+ {
+ // default: all fields have the same width
+ int nWidth = widthTotal / m_nFields;
+ for ( int i = 0; i < m_nFields; i++ )
+ {
+ widths.Add(nWidth);
+ }
+ }
+ else // have explicit status widths
+ {
+ // calculate the total width of all the fixed width fields and the
+ // total number of var field widths counting with multiplicity
+ int nTotalWidth = 0,
+ nVarCount = 0,
+ i;
+ for ( i = 0; i < m_nFields; i++ )
+ {
+ if ( m_statusWidths[i] >= 0 )
+ {
+ nTotalWidth += m_statusWidths[i];
+ }
+ else
+ {
+ nVarCount += -m_statusWidths[i];
+ }
+ }
+
+ // the amount of extra width we have per each var width field
+ int nVarWidth;
+ if ( nVarCount )
+ {
+ int widthExtra = widthTotal - nTotalWidth;
+ nVarWidth = widthExtra > 0 ? widthExtra / nVarCount : 0;
+ }
+ else // no var width fields at all
+ {
+ nVarWidth = 0;
+ }
+
+ // do fill the array
+ for ( i = 0; i < m_nFields; i++ )
+ {
+ if ( m_statusWidths[i] >= 0 )
+ {
+ widths.Add(m_statusWidths[i]);
+ }
+ else
+ {
+ widths.Add(-m_statusWidths[i]*nVarWidth);
+ }
+ }
+ }
+
+ return widths;
+}
+
+#endif // wxUSE_STATUSBAR
+
m_nCount++;
}
+// expand the array
+void wxArrayString::SetCount(size_t count)
+{
+ Alloc(count);
+
+ wxString s;
+ while ( m_nCount < count )
+ m_pItems[m_nCount++] = (wxChar *)s.c_str();
+}
+
// removes item from array (by index)
void wxArrayString::Remove(size_t nIndex)
{
event.Skip();
}
-
+
bool ProcessEvent(wxEvent &event)
{
// Hand button down events to wxSpinCtrl. Doesn't work.
if (event.GetEventType() == wxEVT_LEFT_DOWN && m_spin->ProcessEvent( event ))
return TRUE;
-
+
return wxTextCtrl::ProcessEvent( event );
}
{
m_spin = spin;
- SetWindowStyle(style);
+ SetWindowStyle(style | wxSP_VERTICAL);
}
protected:
return FALSE;
}
+ // the string value overrides the numeric one (for backwards compatibility
+ // reasons and also because it is simpler to satisfy the string value which
+ // comes much sooner in the list of arguments and leave the initial
+ // parameter unspecified)
+ if ( !value.empty() )
+ {
+ long l;
+ if ( value.ToLong(&l) )
+ initial = l;
+ }
+
SetBackgroundColour(*wxRED);
m_text = new wxSpinCtrlText(this, value);
m_btn = new wxSpinCtrlButton(this, style);
IMPLEMENT_DYNAMIC_CLASS(wxStatusBarGeneric, wxWindow)
-#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)
SetFont(wxNullFont);
# endif // MSW
- if ( m_statusWidths )
- delete[] m_statusWidths;
if ( m_statusStrings )
delete[] m_statusStrings;
}
SetFont(m_defaultStatusBarFont);
+ // Set the height according to the font and the border size
+ wxClientDC dc(this);
+ dc.SetFont(GetFont());
+
+ wxCoord y;
+ dc.GetTextExtent(_T("X"), NULL, &y );
+
+ int height = (int)( (11*y)/10 + 2*GetBorderY());
+
+ SetSize(-1, -1, -1, height);
+
return success;
}
delete[] m_statusStrings;
m_statusStrings = new wxString[number];
-
-#if 0 // VZ: what is this for?
- int i;
- for (i = 0; i < number; i++)
- m_statusStrings[i] = "";
-#endif
}
SetStatusWidths(number, widths);
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());
-
- 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;
// ----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxStatusBar95, wxWindow);
-IMPLEMENT_DYNAMIC_CLASS(wxStatusBar, wxStatusBar95)
// ----------------------------------------------------------------------------
// macros
wxStatusBar95::~wxStatusBar95()
{
- delete [] m_statusWidths;
}
void wxStatusBar95::CopyFieldsWidth(const int widths[])
break;
#endif // __WIN32__
-#ifdef __WXUNIVERSAL__
+ // unfortunately this doesn't really work as then window which
+ // doesn't accept focus doesn't get any mouse events neither which
+ // means it can't get any input at all
+#if 0 //def __WXUNIVERSAL__
case WM_NCHITTEST:
// we shouldn't allow the windows which don't want to get focus to
// get it
}
void wxFrame::SendSizeEvent()
-{
+{
wxSizeEvent event(GetSize(), GetId());
event.SetEventObject(this);
GetEventHandler()->ProcessEvent(event);
{
if ( m_frameStatusBar )
{
- wxCoord heightBar = m_frameStatusBar->GetSize().y;
- m_frameStatusBar->SetSize(0, GetClientSize().y,
- GetClientSize().x, heightBar);
+ wxSize size = GetClientSize();
+ m_frameStatusBar->SetSize(0, size.y, size.x, -1);
}
}
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: univ/statusbr.cpp
+// Purpose: wxStatusBar implementation
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 14.10.01
+// RCS-ID: $Id$
+// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
+// Licence: wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#ifdef __GNUG__
+ #pragma implementation "univstatusbr.h"
+#endif
+
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#if wxUSE_STATUSBAR
+
+#ifndef WX_PRECOMP
+#endif
+
+#include "wx/statusbr.h"
+
+#include "wx/univ/renderer.h"
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+BEGIN_EVENT_TABLE(wxStatusBarUniv, wxStatusBarBase)
+ EVT_SIZE(wxStatusBarUniv::OnSize)
+
+ WX_EVENT_TABLE_INPUT_CONSUMER(wxStatusBarUniv)
+END_EVENT_TABLE()
+
+WX_FORWARD_TO_INPUT_CONSUMER(wxStatusBarUniv)
+
+// ----------------------------------------------------------------------------
+// creation
+// ----------------------------------------------------------------------------
+
+void wxStatusBarUniv::Init()
+{
+}
+
+bool wxStatusBarUniv::Create(wxWindow *parent,
+ wxWindowID id,
+ long style,
+ const wxString& name)
+{
+ if ( !wxWindow::Create(parent, id,
+ wxDefaultPosition, wxDefaultSize,
+ style, name) )
+ {
+ return FALSE;
+ }
+
+ SetFieldsCount(1);
+
+ CreateInputHandler(wxINP_HANDLER_STATUSBAR);
+
+ SetSize(DoGetBestSize());
+
+ return TRUE;
+}
+
+// ----------------------------------------------------------------------------
+// drawing
+// ----------------------------------------------------------------------------
+
+wxRect wxStatusBarUniv::GetTotalFieldRect(wxCoord *borderBetweenFields)
+{
+ // determine the space we have for the fields
+ wxSize sizeBorders = m_renderer->GetStatusBarBorders(borderBetweenFields);
+
+ wxRect rect = GetClientRect();
+
+ // no, don't do this - the borders are meant to be inside this rect
+ //rect.Deflate(sizeBorders.x, sizeBorders.y);
+
+ // recalc the field widths if needed
+ if ( m_widthsAbs.IsEmpty() )
+ {
+ // the total width for the fields doesn't include the borders between
+ // them
+ m_widthsAbs = CalculateAbsWidths(rect.width -
+ *borderBetweenFields*(m_nFields - 1));
+ }
+
+ return rect;
+}
+
+void wxStatusBarUniv::DoDraw(wxControlRenderer *renderer)
+{
+ // get the fields rect
+ wxCoord borderBetweenFields;
+ wxRect rect = GetTotalFieldRect(&borderBetweenFields);
+
+ // prepare the DC
+ wxDC& dc = renderer->GetDC();
+ dc.SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT));
+
+ // do draw the fields
+ int flags = IsEnabled() ? 0 : wxCONTROL_DISABLED;
+ for ( int n = 0; n < m_nFields; n++ )
+ {
+ rect.width = m_widthsAbs[n];
+
+ if ( IsExposed(rect) )
+ {
+ // the size grip may be drawn only on the last field and only if we
+ // have the corresponding style and even then only if we really can
+ // resize this frame
+ if ( n == m_nFields - 1 &&
+ HasFlag(wxST_SIZEGRIP) &&
+ GetParent()->HasFlag(wxRESIZE_BORDER) )
+ {
+ // NB: we use wxCONTROL_ISDEFAULT for this because it doesn't
+ // have any meaning for the status bar otherwise anyhow
+ // (it's still ugly, of course, but there are too few flags
+ // to squander them for things like this)
+ flags |= wxCONTROL_ISDEFAULT;
+ }
+
+ m_renderer->DrawStatusField(dc, rect, m_statusText[n], flags);
+ }
+
+ rect.x += rect.width + borderBetweenFields;
+ }
+}
+
+void wxStatusBarUniv::RefreshField(int i)
+{
+ wxRect rect;
+ if ( GetFieldRect(i, rect) )
+ {
+ RefreshRect(rect);
+ }
+}
+
+// ----------------------------------------------------------------------------
+// fields text
+// ----------------------------------------------------------------------------
+
+void wxStatusBarUniv::SetStatusText(const wxString& text, int number)
+{
+ wxCHECK_RET( number >= 0 && number < m_nFields,
+ _T("invalid status bar field index in SetStatusText()") );
+
+ if ( text == m_statusText[number] )
+ {
+ // nothing changed
+ return;
+ }
+
+ m_statusText[number] = text;
+
+ RefreshField(number);
+}
+
+wxString wxStatusBarUniv::GetStatusText(int number) const
+{
+ wxCHECK_MSG( number >= 0 && number < m_nFields, _T(""),
+ _T("invalid status bar field index") );
+
+ return m_statusText[number];
+}
+
+// ----------------------------------------------------------------------------
+// fields count/widths
+// ----------------------------------------------------------------------------
+
+void wxStatusBarUniv::SetFieldsCount(int number, const int *widths)
+{
+ wxStatusBarBase::SetFieldsCount(number, widths);
+
+ m_statusText.SetCount(number);
+ m_widthsAbs.Empty();
+}
+
+void wxStatusBarUniv::SetStatusWidths(int n, const int widths[])
+{
+ wxStatusBarBase::SetStatusWidths(n, widths);
+
+ m_widthsAbs.Empty();
+}
+
+// ----------------------------------------------------------------------------
+// geometry
+// ----------------------------------------------------------------------------
+
+void wxStatusBarUniv::OnSize(wxSizeEvent& event)
+{
+ // invalidate the widths, we'll have to recalc them
+ m_widthsAbs.Empty();
+
+ // refresh entirely, shouldn't matter much as the statusbar is quick to
+ // redraw and it would be difficult to avoid it as we'd need to find out
+ // which fields exactly were affected...
+ Refresh();
+
+ event.Skip();
+}
+
+bool wxStatusBarUniv::GetFieldRect(int n, wxRect& rect) const
+{
+ wxCHECK_MSG( n >= 0 && n < m_nFields, FALSE,
+ _T("invalid field index in GetFieldRect()") );
+
+ // this is a fix for a bug exhibited by the statbar sample: if
+ // GetFieldRect() is called from the derived class OnSize() handler, then
+ // our geometry info is wrong as our OnSize() didn't invalidate m_widthsAbs
+ // yet - so recalc it just in case
+ wxStatusBarUniv *self = wxConstCast(this, wxStatusBarUniv);
+ self->m_widthsAbs.Empty();
+
+ wxCoord borderBetweenFields;
+ rect = self->GetTotalFieldRect(&borderBetweenFields);
+ for ( int i = 0; i <= n; i++ )
+ {
+ rect.width = m_widthsAbs[i];
+
+ if ( i < n )
+ rect.x += rect.width + borderBetweenFields;
+ }
+
+ return TRUE;
+}
+
+wxCoord wxStatusBarUniv::GetHeight() const
+{
+ wxClientDC dc(wxConstCast(this, wxStatusBarUniv));
+ dc.SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT));
+
+ return dc.GetCharHeight() + 2*GetBorderY();
+}
+
+wxSize wxStatusBarUniv::DoGetBestSize() const
+{
+ return wxSize(100, GetHeight());
+}
+
+void wxStatusBarUniv::DoSetSize(int x, int y,
+ int width, int WXUNUSED(height),
+ int sizeFlags)
+{
+ wxStatusBarBase::DoSetSize(x, y, width, GetHeight(), sizeFlags);
+}
+
+// ----------------------------------------------------------------------------
+// misc
+// ----------------------------------------------------------------------------
+
+void wxStatusBarUniv::SetMinHeight(int WXUNUSED(height))
+{
+ // nothing to do here, we don't support it - and why would we?
+}
+
+int wxStatusBarUniv::GetBorderX() const
+{
+ return m_renderer->GetStatusBarBorders(NULL).x;
+}
+
+int wxStatusBarUniv::GetBorderY() const
+{
+ return m_renderer->GetStatusBarBorders(NULL).y;
+}
+
+#endif // wxUSE_STATUSBAR
+
// we don't have the ticks in GTK version
}
-#if wxUSE_MENUS
virtual void DrawMenuBarItem(wxDC& dc,
const wxRect& rect,
const wxString& label,
virtual void DrawMenuSeparator(wxDC& dc,
wxCoord y,
const wxMenuGeometryInfo& geomInfo);
-#endif
+
+ virtual void DrawStatusField(wxDC& dc,
+ const wxRect& rect,
+ const wxString& label,
+ int flags = 0);
virtual void DrawFrameTitleBar(wxDC& dc,
const wxRect& rect,
virtual wxSize GetSliderThumbSize(const wxRect& rect,
wxOrientation orient) const;
virtual wxSize GetProgressBarStep() const { return wxSize(16, 32); }
-#if wxUSE_MENUS
virtual wxSize GetMenuBarItemSize(const wxSize& sizeText) const;
virtual wxMenuGeometryInfo *GetMenuGeometry(wxWindow *win,
const wxMenu& menu) const;
-#endif
+
+ virtual wxSize GetStatusBarBorders(wxCoord *borderBetweenFields) const;
+
// helpers for "wxBitmap wxColourScheme::Get()"
void DrawCheckBitmap(wxDC& dc, const wxRect& rect);
void DrawUncheckBitmap(wxDC& dc, const wxRect& rect, bool isPressed);
DrawShadedRect(dc, &rect, m_penDarkGrey, m_penHighlight);
}
-#if wxUSE_MENUS
// ----------------------------------------------------------------------------
// menu and menubar
// ----------------------------------------------------------------------------
return NULL;
}
-#endif // wxUSE_MENUS
+
+// ----------------------------------------------------------------------------
+// status bar
+// ----------------------------------------------------------------------------
+
+wxSize wxGTKRenderer::GetStatusBarBorders(wxCoord *borderBetweenFields) const
+{
+ return wxSize(0, 0);
+}
+
+void wxGTKRenderer::DrawStatusField(wxDC& dc,
+ const wxRect& rect,
+ const wxString& label,
+ int flags)
+{
+}
// ----------------------------------------------------------------------------
// combobox
static const int FRAME_BUTTON_WIDTH = 16;
static const int FRAME_BUTTON_HEIGHT = 14;
+static const size_t NUM_STATUSBAR_GRIP_BANDS = 3;
+static const size_t WIDTH_STATUSBAR_GRIP_BAND = 4;
+static const size_t STATUSBAR_GRIP_SIZE =
+ WIDTH_STATUSBAR_GRIP_BAND*NUM_STATUSBAR_GRIP_BANDS;
+
enum IndicatorType
{
IndicatorType_Check,
int end,
int step = 1,
int flags = 0);
-#if wxUSE_MENUS
virtual void DrawMenuBarItem(wxDC& dc,
const wxRect& rect,
virtual void DrawMenuSeparator(wxDC& dc,
wxCoord y,
const wxMenuGeometryInfo& geomInfo);
-#endif
+
+ virtual void DrawStatusField(wxDC& dc,
+ const wxRect& rect,
+ const wxString& label,
+ int flags = 0);
+
// titlebars
virtual void DrawFrameTitleBar(wxDC& dc,
const wxRect& rect,
wxOrientation orient) const;
virtual wxSize GetProgressBarStep() const { return wxSize(16, 32); }
-#if wxUSE_MENUS
virtual wxSize GetMenuBarItemSize(const wxSize& sizeText) const;
virtual wxMenuGeometryInfo *GetMenuGeometry(wxWindow *win,
const wxMenu& menu) const;
-#endif
+
+ virtual wxSize GetStatusBarBorders(wxCoord *borderBetweenFields) const;
+
protected:
// helper of DrawLabel() and DrawCheckOrRadioButton()
void DoDrawLabel(wxDC& dc,
m_penDarkGrey,
m_penLightGrey,
m_penHighlight;
-
+
wxFont m_titlebarFont;
-
+
// titlebar icons:
wxBitmap m_bmpFrameButtons[FrameButton_Max];
bool pressed);
};
+class wxWin32StatusBarInputHandler : public wxStdInputHandler
+{
+public:
+ wxWin32StatusBarInputHandler(wxInputHandler *handler);
+
+ virtual bool HandleMouse(wxInputConsumer *consumer,
+ const wxMouseEvent& event);
+
+ virtual bool HandleMouseMove(wxInputConsumer *consumer,
+ const wxMouseEvent& event);
+
+protected:
+ // is the given point over the statusbar grip?
+ bool IsOnGrip(wxWindow *statbar, const wxPoint& pt) const;
+
+private:
+ // the cursor we had replaced with the resize one
+ wxCursor m_cursorOld;
+
+ // was the mouse over the grip last time we checked?
+ bool m_isOnGrip;
+};
+
// ----------------------------------------------------------------------------
// wxWin32ColourScheme: uses (default) Win32 colours
// ----------------------------------------------------------------------------
else if ( control == wxINP_HANDLER_NOTEBOOK )
handler = new wxStdNotebookInputHandler(GetDefaultInputHandler());
#endif // wxUSE_NOTEBOOK
+#if wxUSE_STATUSBAR
+ else if ( control == wxINP_HANDLER_STATUSBAR )
+ handler = new wxWin32StatusBarInputHandler(GetDefaultInputHandler());
+#endif // wxUSE_STATUSBAR
else if ( control == wxINP_HANDLER_TOPLEVEL )
handler = new wxStdFrameInputHandler(GetDefaultInputHandler());
else
case CONTROL_TEXT_DISABLED_SHADOW:
case SHADOW_OUT: return wxColour(GetSysColor(COLOR_BTNSHADOW));
-
+
case TITLEBAR: return wxColour(GetSysColor(COLOR_INACTIVECAPTION));
case TITLEBAR_ACTIVE: return wxColour(GetSysColor(COLOR_ACTIVECAPTION));
case TITLEBAR_TEXT: return wxColour(GetSysColor(COLOR_CAPTIONTEXT));
m_colHighlight = wxSCHEME_COLOUR(scheme, SHADOW_HIGHLIGHT);
m_penHighlight = wxPen(m_colHighlight, 0, wxSOLID);
-
+
m_titlebarFont = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
m_titlebarFont.SetWeight(wxFONTWEIGHT_BOLD);
m_bmpArrows[Arrow_Pressed][n] = m_bmpArrows[Arrow_Normal][n];
}
-
+
// init the frame buttons bitmaps
m_bmpFrameButtons[FrameButton_Close] = wxBitmap(frame_button_close_xpm);
m_bmpFrameButtons[FrameButton_Minimize] = wxBitmap(frame_button_minimize_xpm);
// menu and menubar
// ----------------------------------------------------------------------------
-#if wxUSE_MENUS
-
// wxWin32MenuGeometryInfo: the wxMenuGeometryInfo used by wxWin32Renderer
class WXDLLEXPORT wxWin32MenuGeometryInfo : public wxMenuGeometryInfo
{
// the height of a normal (not separator) item
wxCoord m_heightItem;
- friend wxMenuGeometryInfo *wxWin32Renderer::
- GetMenuGeometry(wxWindow *, const wxMenu&) const;
+ friend wxMenuGeometryInfo *
+ wxWin32Renderer::GetMenuGeometry(wxWindow *, const wxMenu&) const;
};
-#endif // wxUSE_MENUS
-
// FIXME: all constants are hardcoded but shouldn't be
static const wxCoord MENU_LEFT_MARGIN = 9;
static const wxCoord MENU_RIGHT_MARGIN = 18;
// the size of the standard checkmark bitmap
static const wxCoord MENU_CHECK_SIZE = 9;
-// we can't implement these methods without wxMenuGeometryInfo implementation
-// which we don't have if !wxUSE_MENUS
-#if wxUSE_MENUS
-
void wxWin32Renderer::DrawMenuBarItem(wxDC& dc,
const wxRect& rectOrig,
const wxString& label,
return gi;
}
-#else // !wxUSE_MENUS
+// ----------------------------------------------------------------------------
+// status bar
+// ----------------------------------------------------------------------------
-/*
-void wxWin32Renderer::DrawMenuBarItem(wxDC& WXUNUSED(dc),
- const wxRect& WXUNUSED(rectOrig),
- const wxString& WXUNUSED(label),
- int WXUNUSED(flags),
- int WXUNUSED(indexAccel))
-{
-}
+static const wxCoord STATBAR_BORDER_X = 2;
+static const wxCoord STATBAR_BORDER_Y = 2;
-void wxWin32Renderer::DrawMenuItem(wxDC& WXUNUSED(dc),
- wxCoord WXUNUSED(y),
- const wxMenuGeometryInfo& WXUNUSED(gi),
- const wxString& WXUNUSED(label),
- const wxString& WXUNUSED(accel),
- const wxBitmap& WXUNUSED(bitmap),
- int WXUNUSED(flags),
- int WXUNUSED(indexAccel))
+wxSize wxWin32Renderer::GetStatusBarBorders(wxCoord *borderBetweenFields) const
{
-}
+ if ( borderBetweenFields )
+ *borderBetweenFields = 2;
-void wxWin32Renderer::DrawMenuSeparator(wxDC& WXUNUSED(dc),
- wxCoord WXUNUSED(y),
- const wxMenuGeometryInfo& WXUNUSED(gi))
-{
+ return wxSize(STATBAR_BORDER_X, STATBAR_BORDER_Y);
}
-wxSize wxWin32Renderer::GetMenuBarItemSize(const wxSize& size) const
+void wxWin32Renderer::DrawStatusField(wxDC& dc,
+ const wxRect& rect,
+ const wxString& label,
+ int flags)
{
- return size;
-}
+ wxRect rectIn;
-wxMenuGeometryInfo *
-wxWin32Renderer::GetMenuGeometry(wxWindow *WXUNUSED(win),
- const wxMenu& WXUNUSED(menu)) const
-{
- return NULL;
-}
-*/
+ if ( flags & wxCONTROL_ISDEFAULT )
+ {
+ // draw the size grip: it is a normal rect except that in the lower
+ // right corner we have several bands which may be used for dragging
+ // the status bar corner
+ //
+ // each band consists of 4 stripes: m_penHighlight, double
+ // m_penDarkGrey and transparent one
+ wxCoord x2 = rect.GetRight(),
+ y2 = rect.GetBottom();
-#endif // wxUSE_MENUS/!wxUSE_MENUS
+ // draw the upper left part of the rect normally
+ dc.SetPen(m_penDarkGrey);
+ dc.DrawLine(rect.GetLeft(), rect.GetTop(), rect.GetLeft(), y2);
+ dc.DrawLine(rect.GetLeft() + 1, rect.GetTop(), x2, rect.GetTop());
+
+ // draw the grey stripes of the grip
+ size_t n;
+ wxCoord ofs = WIDTH_STATUSBAR_GRIP_BAND - 1;
+ for ( n = 0; n < NUM_STATUSBAR_GRIP_BANDS; n++, ofs += WIDTH_STATUSBAR_GRIP_BAND )
+ {
+ dc.DrawLine(x2 - ofs + 1, y2 - 1, x2, y2 - ofs);
+ dc.DrawLine(x2 - ofs, y2 - 1, x2, y2 - ofs - 1);
+ }
+
+ // draw the white stripes
+ dc.SetPen(m_penHighlight);
+ ofs = WIDTH_STATUSBAR_GRIP_BAND + 1;
+ for ( n = 0; n < NUM_STATUSBAR_GRIP_BANDS; n++, ofs += WIDTH_STATUSBAR_GRIP_BAND )
+ {
+ dc.DrawLine(x2 - ofs + 1, y2 - 1, x2, y2 - ofs);
+ }
+
+ // draw the remaining rect boundaries
+ ofs -= WIDTH_STATUSBAR_GRIP_BAND;
+ dc.DrawLine(x2, rect.GetTop(), x2, y2 - ofs + 1);
+ dc.DrawLine(rect.GetLeft(), y2, x2 - ofs + 1, y2);
+
+ rectIn = rect;
+ rectIn.Deflate(1);
+
+ rectIn.width -= STATUSBAR_GRIP_SIZE;
+ }
+ else // normal pane
+ {
+ DrawBorder(dc, wxBORDER_STATIC, rect, flags, &rectIn);
+ }
+
+ rectIn.Deflate(STATBAR_BORDER_X, STATBAR_BORDER_Y);
+
+ wxDCClipper clipper(dc, rectIn);
+ DrawLabel(dc, label, rectIn, flags, wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL);
+}
// ----------------------------------------------------------------------------
// combobox
int wxWin32Renderer::HitTestFrame(const wxRect& rect, const wxPoint& pt, int flags) const
{
wxRect client = GetFrameClientArea(rect, flags);
-
+
if ( client.Inside(pt) )
return wxHT_TOPLEVEL_CLIENT_AREA;
-
+
if ( flags & wxTOPLEVEL_TITLEBAR )
{
wxRect client = GetFrameClientArea(rect, flags & ~wxTOPLEVEL_TITLEBAR);
if ( wxRect(client.GetPosition(), GetFrameIconSize()).Inside(pt) )
return wxHT_TOPLEVEL_ICON;
}
-
+
wxRect btnRect(client.GetRight() - 2 - FRAME_BUTTON_WIDTH,
client.GetTop() + (FRAME_TITLEBAR_HEIGHT-FRAME_BUTTON_HEIGHT)/2,
FRAME_BUTTON_WIDTH, FRAME_BUTTON_HEIGHT);
-
+
if ( flags & wxTOPLEVEL_BUTTON_CLOSE )
{
if ( btnRect.Inside(pt) )
if ( (flags & wxTOPLEVEL_BORDER) && !(flags & wxTOPLEVEL_MAXIMIZED) )
{
// we are certainly at one of borders, lets decide which one:
-
+
int border = 0;
// dirty trick, relies on the way wxHT_TOPLEVEL_XXX are defined!
if ( pt.x < client.x )
border |= wxHT_TOPLEVEL_BORDER_S;
return border;
}
-
+
return wxHT_NOWHERE;
}
if ( flags & wxTOPLEVEL_ICON )
DrawFrameIcon(dc, rect, icon, flags);
DrawFrameTitle(dc, rect, title, flags);
-
+
wxRect client = GetFrameClientArea(rect, flags & ~wxTOPLEVEL_TITLEBAR);
wxCoord x,y;
x = client.GetRight() - 2 - FRAME_BUTTON_WIDTH;
y = client.GetTop() + (FRAME_TITLEBAR_HEIGHT-FRAME_BUTTON_HEIGHT)/2;
-
+
if ( flags & wxTOPLEVEL_BUTTON_CLOSE )
{
DrawFrameButton(dc, x, y, wxTOPLEVEL_BUTTON_CLOSE,
int flags)
{
if ( !(flags & wxTOPLEVEL_BORDER) ) return;
-
+
wxRect r(rect);
-
+
DrawShadedRect(dc, &r, m_penLightGrey, m_penBlack);
DrawShadedRect(dc, &r, m_penHighlight, m_penDarkGrey);
DrawShadedRect(dc, &r, m_penLightGrey, m_penLightGrey);
{
if ( !(flags & wxTOPLEVEL_TITLEBAR) ) return;
- wxColour col = (flags & wxTOPLEVEL_ACTIVE) ?
+ wxColour col = (flags & wxTOPLEVEL_ACTIVE) ?
wxSCHEME_COLOUR(m_scheme, TITLEBAR_ACTIVE) :
wxSCHEME_COLOUR(m_scheme, TITLEBAR);
wxRect r = GetFrameClientArea(rect, flags & ~wxTOPLEVEL_TITLEBAR);
r.height = FRAME_TITLEBAR_HEIGHT;
-
+
DrawBackground(dc, col, r);
}
r.x += FRAME_TITLEBAR_HEIGHT;
else
r.x += 1;
-
+
dc.SetFont(m_titlebarFont);
dc.SetTextForeground(wxSCHEME_COLOUR(m_scheme, TITLEBAR_TEXT));
dc.DrawLabel(title, wxNullBitmap, r, wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL);
default:
wxFAIL_MSG(wxT("incorrect button specification"));
}
-
- if ( flags & wxCONTROL_PRESSED )
+
+ if ( flags & wxCONTROL_PRESSED )
{
DrawShadedRect(dc, &r, m_penBlack, m_penHighlight);
DrawShadedRect(dc, &r, m_penDarkGrey, m_penLightGrey);
if ( (flags & wxTOPLEVEL_BORDER) && !(flags & wxTOPLEVEL_MAXIMIZED) )
{
- int border = (flags & wxTOPLEVEL_RESIZEABLE) ?
+ int border = (flags & wxTOPLEVEL_RESIZEABLE) ?
RESIZEABLE_FRAME_BORDER_THICKNESS :
FRAME_BORDER_THICKNESS;
r.Inflate(-border);
if ( (flags & wxTOPLEVEL_BORDER) && !(flags & wxTOPLEVEL_MAXIMIZED) )
{
- int border = (flags & wxTOPLEVEL_RESIZEABLE) ?
+ int border = (flags & wxTOPLEVEL_RESIZEABLE) ?
RESIZEABLE_FRAME_BORDER_THICKNESS :
FRAME_BORDER_THICKNESS;
s.x += 2*border;
const wxMouseEvent& event)
{
// clicking on the control gives it focus
- if ( event.ButtonDown() && wxWindow::FindFocus() != control->GetInputWindow() )
+ if ( event.ButtonDown() )
{
- control->GetInputWindow()->SetFocus();
+ wxWindow *win = control->GetInputWindow();
+ if ( wxWindow::FindFocus() != control->GetInputWindow() )
+ {
+ win->SetFocus();
- return TRUE;
+ return TRUE;
+ }
}
return FALSE;
return wxStdTextCtrlInputHandler::HandleKey(control, event, pressed);
}
+// ----------------------------------------------------------------------------
+// wxWin32StatusBarInputHandler
+// ----------------------------------------------------------------------------
+
+wxWin32StatusBarInputHandler::
+wxWin32StatusBarInputHandler(wxInputHandler *handler)
+ : wxStdInputHandler(handler)
+{
+ m_isOnGrip = FALSE;
+}
+
+bool wxWin32StatusBarInputHandler::IsOnGrip(wxWindow *statbar,
+ const wxPoint& pt) const
+{
+ if ( statbar->HasFlag(wxST_SIZEGRIP) &&
+ statbar->GetParent()->HasFlag(wxRESIZE_BORDER) )
+ {
+ wxSize sizeSbar = statbar->GetSize();
+
+ return (sizeSbar.x - pt.x) < STATUSBAR_GRIP_SIZE &&
+ (sizeSbar.y - pt.y) < STATUSBAR_GRIP_SIZE;
+ }
+
+ return FALSE;
+}
+
+bool wxWin32StatusBarInputHandler::HandleMouse(wxInputConsumer *consumer,
+ const wxMouseEvent& event)
+{
+ if ( event.Button(1) )
+ {
+ if ( event.ButtonDown(1) )
+ {
+ wxWindow *statbar = consumer->GetInputWindow();
+
+ if ( IsOnGrip(statbar, event.GetPosition()) )
+ {
+ wxTopLevelWindow *tlw = wxDynamicCast(statbar->GetParent(),
+ wxTopLevelWindow);
+ if ( tlw )
+ {
+ tlw->PerformAction(wxACTION_TOPLEVEL_RESIZE,
+ wxHT_TOPLEVEL_BORDER_SE);
+
+ statbar->SetCursor(m_cursorOld);
+
+ return TRUE;
+ }
+ }
+ }
+ }
+
+ return wxStdInputHandler::HandleMouse(consumer, event);
+}
+
+bool wxWin32StatusBarInputHandler::HandleMouseMove(wxInputConsumer *consumer,
+ const wxMouseEvent& event)
+{
+ wxWindow *statbar = consumer->GetInputWindow();
+
+ bool isOnGrip = IsOnGrip(statbar, event.GetPosition());
+ if ( isOnGrip != m_isOnGrip )
+ {
+ m_isOnGrip = isOnGrip;
+ if ( isOnGrip )
+ {
+ m_cursorOld = statbar->GetCursor();
+ statbar->SetCursor(wxCURSOR_SIZENWSE);
+ }
+ else
+ {
+ statbar->SetCursor(m_cursorOld);
+ }
+ }
+
+ return wxStdInputHandler::HandleMouseMove(consumer, event);
+}
+
ClickTitleBarButton(numArg);
return TRUE;
}
-
+
else if ( action == wxACTION_TOPLEVEL_MOVE )
{
InteractiveMove(wxINTERACTIVE_MOVE);
return TRUE;
}
-
+
else if ( action == wxACTION_TOPLEVEL_RESIZE )
{
int flags = wxINTERACTIVE_RESIZE;
InteractiveMove(flags);
return TRUE;
}
-
+
else
return FALSE;
}
}
else if ( consumer->GetInputWindow()->GetWindowStyle() & wxRESIZE_BORDER )
{
- wxTopLevelWindow *win = wxStaticCast(consumer->GetInputWindow(),
+ wxTopLevelWindow *win = wxStaticCast(consumer->GetInputWindow(),
wxTopLevelWindow);
long hit = win->HitTest(event.GetPosition());
-
+
if ( hit != m_winHitTest )
{
m_winHitTest = hit;
-
+
if ( m_borderCursorOn )
{
m_borderCursorOn = FALSE;
win->SetCursor(m_origCursor);
}
-
+
if ( hit & wxHT_TOPLEVEL_ANY_BORDER )
{
m_borderCursorOn = TRUE;
wxCursor cur;
-
+
switch (hit)
{
case wxHT_TOPLEVEL_BORDER_N:
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"..\lib\wxuniv.lib"
+# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "wxUniv - Win32 Debug"
# End Source File
# Begin Source File
+SOURCE=.\common\extended.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
SOURCE=.\common\fddlgcmn.cpp
# End Source File
# Begin Source File
# End Source File
# Begin Source File
+SOURCE=.\common\statbar.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\common\strconv.cpp
# End Source File
# Begin Source File
# End Source File
# Begin Source File
+SOURCE=.\common\unzip.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
SOURCE=.\common\url.cpp
# End Source File
# Begin Source File
SOURCE=.\common\zstream.cpp
# End Source File
-
-# Begin Source File
-
-SOURCE=.\common\extended.c
-# SUBTRACT CPP /YX /Yc /Yu
-# End Source File
-# Begin Source File
-
-SOURCE=.\common\unzip.c
-# SUBTRACT CPP /YX /Yc /Yu
-# End Source File
-
# End Group
# Begin Group "Generic Files"
# End Source File
# Begin Source File
-SOURCE=.\generic\statusbr.cpp
-# End Source File
-# Begin Source File
-
SOURCE=.\generic\tabg.cpp
# End Source File
# Begin Source File
SOURCE=.\generic\wizard.cpp
# End Source File
-
# End Group
# Begin Group "wxHTML Files"
SOURCE=.\html\winpars.cpp
# End Source File
-
# End Group
# Begin Group "MSW Files"
# PROP Default_Filter ""
# Begin Source File
-SOURCE=.\msw\dummy.cpp
-# ADD CPP /Yc"wx/wxprec.h"
-# End Source File
-# Begin Source File
-
SOURCE=.\msw\app.cpp
# End Source File
# Begin Source File
# End Source File
# Begin Source File
+SOURCE=.\msw\dummy.cpp
+# ADD CPP /Yc"wx/wxprec.h"
+# End Source File
+# Begin Source File
+
SOURCE=.\msw\evtloop.cpp
# End Source File
# Begin Source File
# End Source File
# Begin Source File
+SOURCE=.\msw\gsocket.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=.\msw\gsockmsw.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
SOURCE=.\msw\icon.cpp
# End Source File
# Begin Source File
SOURCE=.\msw\window.cpp
# End Source File
+# End Group
+# Begin Group "Universal Files"
+# PROP Default_Filter ""
+# Begin Group "Theme Files"
+
+# PROP Default_Filter ""
# Begin Source File
-SOURCE=.\msw\gsocket.c
-# SUBTRACT CPP /YX /Yc /Yu
+SOURCE=.\univ\themes\gtk.cpp
# End Source File
# Begin Source File
-SOURCE=.\msw\gsockmsw.c
-# SUBTRACT CPP /YX /Yc /Yu
+SOURCE=.\univ\themes\win32.cpp
# End Source File
-
# End Group
-# Begin Group "Universal Files"
-
-# PROP Default_Filter ""
# Begin Source File
SOURCE=.\univ\bmpbuttn.cpp
# End Source File
# Begin Source File
+SOURCE=.\univ\statusbr.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\univ\textctrl.cpp
# End Source File
# Begin Source File
SOURCE=.\univ\winuniv.cpp
# End Source File
-
-# Begin Group "Theme Files"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\univ\themes\gtk.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\univ\themes\win32.cpp
-# End Source File
-
-# End Group
# End Group
# Begin Group "Headers"
# Begin Source File
SOURCE=..\include\wx\univ\setup.h
+
!IF "$(CFG)" == "wxUniv - Win32 Release"
+
# Begin Custom Build - Creating wx/setup.h from $(InputPath)
InputPath=..\include\wx\univ\setup.h
copy $(InputPath) ..\lib\univ\wx\setup.h
# End Custom Build
+
!ELSEIF "$(CFG)" == "wxUniv - Win32 Debug"
+
# Begin Custom Build - Creating wx/setup.h from $(InputPath)
InputPath=..\include\wx\univ\setup.h
copy $(InputPath) ..\lib\univd\wx\setup.h
# End Custom Build
+
!ENDIF
+
# End Source File
# End Group
# Begin Group "Common"
SOURCE=..\include\wx\zstream.h
# End Source File
-
# End Group
# Begin Group "MSW"
SOURCE=..\include\wx\generic\wizard.h
# End Source File
-
# End Group
# Begin Group "HTML"
SOURCE=..\include\wx\html\winpars.h
# End Source File
-
# End Group
# Begin Group "Universal"