diff --git a/distrib/msw/tmake/filelist.txt b/distrib/msw/tmake/filelist.txt index dbeeb7d64e..c301287e44 100644 --- a/distrib/msw/tmake/filelist.txt +++ b/distrib/msw/tmake/filelist.txt @@ -10,24 +10,24 @@ # 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 @@ -36,27 +36,28 @@ # # '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 @@ -207,6 +208,7 @@ sckstrm.cpp Common Socket,Base 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 @@ -383,6 +385,7 @@ statbmp.cpp Univ statbox.cpp Univ statline.cpp Univ stattext.cpp Univ +statusbr.cpp Univ textctrl.cpp Univ theme.cpp Univ gtk.cpp Univ Theme @@ -1410,6 +1413,7 @@ statbmp.h UnivH statbox.h UnivH statline.h UnivH stattext.h UnivH +statusbr.h UnivH textctrl.h UnivH theme.h UnivH window.h UnivH diff --git a/docs/latex/wx/statusbr.tex b/docs/latex/wx/statusbr.tex index 7c1c99b309..6985cc883e 100644 --- a/docs/latex/wx/statusbr.tex +++ b/docs/latex/wx/statusbr.tex @@ -135,68 +135,71 @@ The status field string if the field is valid, otherwise the empty string. \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} @@ -246,15 +249,27 @@ Sets the text for one field. \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} diff --git a/include/wx/statusbr.h b/include/wx/statusbr.h index 56e9096737..adc1bf5946 100644 --- a/include/wx/statusbr.h +++ b/include/wx/statusbr.h @@ -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_ diff --git a/include/wx/string.h b/include/wx/string.h index 31a9a2b30c..dc244ec1d8 100644 --- a/include/wx/string.h +++ b/include/wx/string.h @@ -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 diff --git a/include/wx/univ/inphand.h b/include/wx/univ/inphand.h index d26a6e9ea4..ea16294242 100644 --- a/include/wx/univ/inphand.h +++ b/include/wx/univ/inphand.h @@ -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") diff --git a/include/wx/univ/menu.h b/include/wx/univ/menu.h index 1f507c6303..3daa74e772 100644 --- a/include/wx/univ/menu.h +++ b/include/wx/univ/menu.h @@ -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 // ---------------------------------------------------------------------------- diff --git a/include/wx/univ/renderer.h b/include/wx/univ/renderer.h index cfcdccf9c8..a22d6466f6 100644 --- a/include/wx/univ/renderer.h +++ b/include/wx/univ/renderer.h @@ -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 diff --git a/include/wx/univ/setup.h b/include/wx/univ/setup.h index b115ff9e58..d03467448f 100644 --- a/include/wx/univ/setup.h +++ b/include/wx/univ/setup.h @@ -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 diff --git a/include/wx/univ/statusbr.h b/include/wx/univ/statusbr.h new file mode 100644 index 0000000000..804029fbc1 --- /dev/null +++ b/include/wx/univ/statusbr.h @@ -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_ + diff --git a/include/wx/univ/toplevel.h b/include/wx/univ/toplevel.h index 60ff4e0fa8..ef740f21d7 100644 --- a/include/wx/univ/toplevel.h +++ b/include/wx/univ/toplevel.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); diff --git a/samples/statbar/statbar.cpp b/samples/statbar/statbar.cpp index 1d9ded23ac..12405daf5f 100644 --- a/samples/statbar/statbar.cpp +++ b/samples/statbar/statbar.cpp @@ -341,16 +341,20 @@ void MyFrame::OnSetStatusFields(wxCommandEvent& WXUNUSED(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[2] = { 200, -1 }; - widths = widthsFor2Fields; - } + static const int widthsFor2Fields[] = { 200, -1 }; + static const int widthsFor3Fields[] = { -1, -2, -1 }; + static const int widthsFor4Fields[] = { 100, -1, 100, -2, 100 }; - sb->SetFieldsCount(nFields, widths); + static const int *widths[] = + { + 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[nFields - 1]); wxLogStatus(this, wxString::Format(wxT("Status bar now has %ld fields"), @@ -447,7 +451,9 @@ MyStatusBar::MyStatusBar(wxWindow *parent) #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); @@ -497,11 +503,7 @@ void MyStatusBar::OnSize(wxSizeEvent& event) 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); diff --git a/src/common/framecmn.cpp b/src/common/framecmn.cpp index 4b12d0e9a3..55ce182110 100644 --- a/src/common/framecmn.cpp +++ b/src/common/framecmn.cpp @@ -244,17 +244,6 @@ wxStatusBar *wxFrameBase::OnCreateStatusBar(int number, { 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; diff --git a/src/common/statbar.cpp b/src/common/statbar.cpp new file mode 100644 index 0000000000..bd3a277d88 --- /dev/null +++ b/src/common/statbar.cpp @@ -0,0 +1,186 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: common/statbar.cpp +// Purpose: wxStatusBarBase implementation +// Author: Vadim Zeitlin +// Modified by: +// Created: 14.10.01 +// RCS-ID: $Id$ +// Copyright: (c) 2001 Vadim Zeitlin +// 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 + diff --git a/src/common/string.cpp b/src/common/string.cpp index c7ce4c3d1c..3fdcf1e0de 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -2156,6 +2156,16 @@ void wxArrayString::Insert(const wxString& str, size_t nIndex) 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) { diff --git a/src/generic/spinctlg.cpp b/src/generic/spinctlg.cpp index cea2e0b054..ebe1b3760b 100644 --- a/src/generic/spinctlg.cpp +++ b/src/generic/spinctlg.cpp @@ -69,13 +69,13 @@ protected: 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 ); } @@ -101,7 +101,7 @@ public: { m_spin = spin; - SetWindowStyle(style); + SetWindowStyle(style | wxSP_VERTICAL); } protected: @@ -155,6 +155,17 @@ bool wxSpinCtrl::Create(wxWindow *parent, 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); diff --git a/src/generic/statusbr.cpp b/src/generic/statusbr.cpp index e1739aa5c3..8880c2ebac 100644 --- a/src/generic/statusbr.cpp +++ b/src/generic/statusbr.cpp @@ -36,10 +36,6 @@ 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) @@ -64,8 +60,6 @@ wxStatusBarGeneric::~wxStatusBarGeneric() SetFont(wxNullFont); # endif // MSW - if ( m_statusWidths ) - delete[] m_statusWidths; if ( m_statusStrings ) delete[] m_statusStrings; } @@ -93,6 +87,17 @@ bool wxStatusBarGeneric::Create(wxWindow *parent, 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; } @@ -104,12 +109,6 @@ void wxStatusBarGeneric::SetFieldsCount(int number, const int *widths) 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); diff --git a/src/msw/frame.cpp b/src/msw/frame.cpp index abb54f3ef5..fc5e2f5a53 100644 --- a/src/msw/frame.cpp +++ b/src/msw/frame.cpp @@ -231,17 +231,6 @@ wxStatusBar *wxFrameMSW::OnCreateStatusBar(int number, 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; diff --git a/src/msw/statbr95.cpp b/src/msw/statbr95.cpp index 6fc87c0d1c..b0f3413153 100644 --- a/src/msw/statbr95.cpp +++ b/src/msw/statbr95.cpp @@ -45,7 +45,6 @@ // ---------------------------------------------------------------------------- IMPLEMENT_DYNAMIC_CLASS(wxStatusBar95, wxWindow); -IMPLEMENT_DYNAMIC_CLASS(wxStatusBar, wxStatusBar95) // ---------------------------------------------------------------------------- // macros @@ -127,7 +126,6 @@ bool wxStatusBar95::Create(wxWindow *parent, wxStatusBar95::~wxStatusBar95() { - delete [] m_statusWidths; } void wxStatusBar95::CopyFieldsWidth(const int widths[]) diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 742aa707aa..dc8a956358 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -2562,7 +2562,10 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam 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 diff --git a/src/univ/framuniv.cpp b/src/univ/framuniv.cpp index 19b2c610cb..4f5bca178c 100644 --- a/src/univ/framuniv.cpp +++ b/src/univ/framuniv.cpp @@ -77,7 +77,7 @@ void wxFrame::OnSize(wxSizeEvent& event) } void wxFrame::SendSizeEvent() -{ +{ wxSizeEvent event(GetSize(), GetId()); event.SetEventObject(this); GetEventHandler()->ProcessEvent(event); @@ -117,9 +117,8 @@ void wxFrame::PositionStatusBar() { 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); } } diff --git a/src/univ/statusbr.cpp b/src/univ/statusbr.cpp new file mode 100644 index 0000000000..679e664bce --- /dev/null +++ b/src/univ/statusbr.cpp @@ -0,0 +1,283 @@ +///////////////////////////////////////////////////////////////////////////// +// 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 + diff --git a/src/univ/themes/gtk.cpp b/src/univ/themes/gtk.cpp index 776d9cd4e7..f7d2c1f91f 100644 --- a/src/univ/themes/gtk.cpp +++ b/src/univ/themes/gtk.cpp @@ -188,7 +188,6 @@ public: // we don't have the ticks in GTK version } -#if wxUSE_MENUS virtual void DrawMenuBarItem(wxDC& dc, const wxRect& rect, const wxString& label, @@ -205,7 +204,11 @@ public: 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, @@ -285,12 +288,13 @@ public: 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); @@ -1817,7 +1821,6 @@ void wxGTKRenderer::DrawSliderThumb(wxDC& dc, DrawShadedRect(dc, &rect, m_penDarkGrey, m_penHighlight); } -#if wxUSE_MENUS // ---------------------------------------------------------------------------- // menu and menubar // ---------------------------------------------------------------------------- @@ -1862,7 +1865,22 @@ wxMenuGeometryInfo *wxGTKRenderer::GetMenuGeometry(wxWindow *win, 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 diff --git a/src/univ/themes/win32.cpp b/src/univ/themes/win32.cpp index 911234b009..b87fbd89bf 100644 --- a/src/univ/themes/win32.cpp +++ b/src/univ/themes/win32.cpp @@ -73,6 +73,11 @@ static const int FRAME_TITLEBAR_HEIGHT = 18; 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, @@ -255,7 +260,6 @@ public: int end, int step = 1, int flags = 0); -#if wxUSE_MENUS virtual void DrawMenuBarItem(wxDC& dc, const wxRect& rect, @@ -273,7 +277,12 @@ public: 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, @@ -351,11 +360,12 @@ public: 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, @@ -459,9 +469,9 @@ private: m_penDarkGrey, m_penLightGrey, m_penHighlight; - + wxFont m_titlebarFont; - + // titlebar icons: wxBitmap m_bmpFrameButtons[FrameButton_Max]; @@ -542,6 +552,29 @@ public: 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 // ---------------------------------------------------------------------------- @@ -1152,6 +1185,10 @@ wxInputHandler *wxWin32Theme::GetInputHandler(const wxString& control) 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 @@ -1254,7 +1291,7 @@ wxColour wxWin32ColourScheme::Get(wxWin32ColourScheme::StdColour col) const 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)); @@ -1320,7 +1357,7 @@ wxWin32Renderer::wxWin32Renderer(const wxColourScheme *scheme) 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); @@ -1493,7 +1530,7 @@ wxWin32Renderer::wxWin32Renderer(const wxColourScheme *scheme) 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); @@ -2599,8 +2636,6 @@ void wxWin32Renderer::DrawSliderTicks(wxDC& dc, // menu and menubar // ---------------------------------------------------------------------------- -#if wxUSE_MENUS - // wxWin32MenuGeometryInfo: the wxMenuGeometryInfo used by wxWin32Renderer class WXDLLEXPORT wxWin32MenuGeometryInfo : public wxMenuGeometryInfo { @@ -2625,12 +2660,10 @@ private: // 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; @@ -2650,10 +2683,6 @@ static const wxCoord MENU_SEPARATOR_HEIGHT = 3; // 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, @@ -2865,48 +2894,81 @@ wxMenuGeometryInfo *wxWin32Renderer::GetMenuGeometry(wxWindow *win, 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; + +wxSize wxWin32Renderer::GetStatusBarBorders(wxCoord *borderBetweenFields) const { + if ( borderBetweenFields ) + *borderBetweenFields = 2; + + return wxSize(STATBAR_BORDER_X, STATBAR_BORDER_Y); } -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)) +void wxWin32Renderer::DrawStatusField(wxDC& dc, + const wxRect& rect, + const wxString& label, + int flags) { -} + wxRect rectIn; -void wxWin32Renderer::DrawMenuSeparator(wxDC& WXUNUSED(dc), - wxCoord WXUNUSED(y), - const wxMenuGeometryInfo& WXUNUSED(gi)) -{ -} + 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(); -wxSize wxWin32Renderer::GetMenuBarItemSize(const wxSize& size) const -{ - return size; -} + // 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()); -wxMenuGeometryInfo * -wxWin32Renderer::GetMenuGeometry(wxWindow *WXUNUSED(win), - const wxMenu& WXUNUSED(menu)) const -{ - return NULL; -} -*/ + // 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); + } -#endif // wxUSE_MENUS/!wxUSE_MENUS + // 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 @@ -3104,10 +3166,10 @@ int wxWin32Renderer::PixelToScrollbar(const wxScrollBar *scrollbar, 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); @@ -3117,11 +3179,11 @@ int wxWin32Renderer::HitTestFrame(const wxRect& rect, const wxPoint& pt, int fla 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) ) @@ -3160,7 +3222,7 @@ int wxWin32Renderer::HitTestFrame(const wxRect& rect, const wxPoint& pt, int fla 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 ) @@ -3173,7 +3235,7 @@ int wxWin32Renderer::HitTestFrame(const wxRect& rect, const wxPoint& pt, int fla border |= wxHT_TOPLEVEL_BORDER_S; return border; } - + return wxHT_NOWHERE; } @@ -3195,12 +3257,12 @@ void wxWin32Renderer::DrawFrameTitleBar(wxDC& dc, 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, @@ -3244,9 +3306,9 @@ void wxWin32Renderer::DrawFrameBorder(wxDC& dc, 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); @@ -3260,13 +3322,13 @@ void wxWin32Renderer::DrawFrameBackground(wxDC& dc, { 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); } @@ -3281,7 +3343,7 @@ void wxWin32Renderer::DrawFrameTitle(wxDC& dc, 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); @@ -3317,8 +3379,8 @@ void wxWin32Renderer::DrawFrameButton(wxDC& dc, 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); @@ -3342,7 +3404,7 @@ wxRect wxWin32Renderer::GetFrameClientArea(const wxRect& rect, 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); @@ -3363,7 +3425,7 @@ wxSize wxWin32Renderer::GetFrameTotalSize(const wxSize& clientSize, 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; @@ -3495,11 +3557,15 @@ bool wxWin32InputHandler::HandleMouse(wxInputConsumer *control, 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; @@ -3749,3 +3815,81 @@ bool wxWin32TextCtrlInputHandler::HandleKey(wxInputConsumer *control, 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); +} + diff --git a/src/univ/topluniv.cpp b/src/univ/topluniv.cpp index 556873599f..c68373a528 100644 --- a/src/univ/topluniv.cpp +++ b/src/univ/topluniv.cpp @@ -365,13 +365,13 @@ bool wxTopLevelWindow::PerformAction(const wxControlAction& action, 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; @@ -386,7 +386,7 @@ bool wxTopLevelWindow::PerformAction(const wxControlAction& action, InteractiveMove(flags); return TRUE; } - + else return FALSE; } @@ -486,25 +486,25 @@ bool wxStdFrameInputHandler::HandleMouseMove(wxInputConsumer *consumer, } 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: diff --git a/src/wxUniv.dsp b/src/wxUniv.dsp index 7953d45543..2a21340399 100644 --- a/src/wxUniv.dsp +++ b/src/wxUniv.dsp @@ -49,7 +49,7 @@ BSC32=bscmake.exe # 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" @@ -197,6 +197,11 @@ SOURCE=.\common\event.cpp # 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 @@ -453,6 +458,10 @@ SOURCE=.\common\socket.cpp # 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 @@ -501,6 +510,11 @@ SOURCE=.\common\txtstrm.cpp # 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 @@ -551,18 +565,6 @@ SOURCE=.\common\zipstrm.cpp 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" @@ -709,10 +711,6 @@ SOURCE=.\generic\splitter.cpp # 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 @@ -743,7 +741,6 @@ SOURCE=.\generic\treelay.cpp SOURCE=.\generic\wizard.cpp # End Source File - # End Group # Begin Group "wxHTML Files" @@ -828,18 +825,12 @@ SOURCE=.\html\m_tables.cpp 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 @@ -904,6 +895,11 @@ SOURCE=.\msw\dir.cpp # 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 @@ -928,6 +924,16 @@ SOURCE=.\msw\gdiobj.cpp # 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 @@ -994,22 +1000,22 @@ SOURCE=.\msw\utilsexc.cpp SOURCE=.\msw\window.cpp # 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 - # End Group # Begin Group "Universal Files" # PROP Default_Filter "" +# 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 # Begin Source File SOURCE=.\univ\bmpbuttn.cpp @@ -1120,6 +1126,10 @@ SOURCE=.\univ\stattext.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 @@ -1134,20 +1144,6 @@ SOURCE=.\univ\topluniv.cpp 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" @@ -1158,7 +1154,9 @@ SOURCE=.\univ\themes\win32.cpp # 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 @@ -1166,7 +1164,9 @@ 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 @@ -1174,7 +1174,9 @@ 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" @@ -2064,7 +2066,6 @@ SOURCE=..\include\wx\zipstrm.h SOURCE=..\include\wx\zstream.h # End Source File - # End Group # Begin Group "MSW" @@ -2221,7 +2222,6 @@ SOURCE=..\include\wx\generic\treectlg.h SOURCE=..\include\wx\generic\wizard.h # End Source File - # End Group # Begin Group "HTML" @@ -2278,7 +2278,6 @@ SOURCE=..\include\wx\html\m_templ.h SOURCE=..\include\wx\html\winpars.h # End Source File - # End Group # Begin Group "Universal"