WXDLLEXPORT_DATA(extern const char*) wxChoiceNameStr;
// Choice item
-class WXDLLEXPORT wxChoice: public wxControl
+class WXDLLEXPORT wxChoice: public wxChoiceBase
{
DECLARE_DYNAMIC_CLASS(wxChoice)
/////////////////////////////////////////////////////////////////////////////
// Name: region.h
// Purpose: wxRegion class
-// Author: AUTHOR
+// Author: David Webster
// Modified by:
-// Created: ??/??/98
+// Created: 10/15/99
// RCS-ID: $Id$
-// Copyright: (c) AUTHOR
-// Licence: wxWindows licence
+// Copyright: (c) David Webster
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_REGION_H_
#define _WX_REGION_H_
-#ifdef __GNUG__
-#pragma interface "region.h"
-#endif
-
#include "wx/list.h"
#include "wx/gdiobj.h"
#include "wx/gdicmn.h"
class WXDLLEXPORT wxPoint;
enum wxRegionContain {
- wxOutRegion = 0, wxPartRegion = 1, wxInRegion = 2
+ wxOutRegion = 0, wxPartRegion = 1, wxInRegion = 2
};
// So far, for internal use only
class WXDLLEXPORT wxRegion : public wxGDIObject {
DECLARE_DYNAMIC_CLASS(wxRegion);
- friend class WXDLLEXPORT wxRegionIterator;
+ friend class WXDLLEXPORT wxRegionIterator;
public:
wxRegion(long x, long y, long w, long h);
wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight);
wxRegion(const wxRect& rect);
- wxRegion();
- ~wxRegion();
-
- //# Copying
- inline wxRegion(const wxRegion& r)
- { Ref(r); }
- inline wxRegion& operator = (const wxRegion& r)
- { Ref(r); return (*this); }
-
- //# Modify region
- // Clear current region
- void Clear();
-
- // Union rectangle or region with this.
- inline bool Union(long x, long y, long width, long height) { return Combine(x, y, width, height, wxRGN_OR); }
- inline bool Union(const wxRect& rect) { return Combine(rect, wxRGN_OR); }
- inline bool Union(const wxRegion& region) { return Combine(region, wxRGN_OR); }
-
- // Intersect rectangle or region with this.
- inline bool Intersect(long x, long y, long width, long height) { return Combine(x, y, width, height, wxRGN_AND); }
- inline bool Intersect(const wxRect& rect) { return Combine(rect, wxRGN_AND); }
- inline bool Intersect(const wxRegion& region) { return Combine(region, wxRGN_AND); }
-
- // Subtract rectangle or region from this:
+ wxRegion(WXHRGN hRegion); // Hangs on to this region
+
+ wxRegion();
+ ~wxRegion();
+
+ //# Copying
+ inline wxRegion(const wxRegion& r)
+ { Ref(r); }
+ inline wxRegion& operator = (const wxRegion& r)
+ { Ref(r); return (*this); }
+
+ //# Modify region
+ // Clear current region
+ void Clear();
+
+ // Union rectangle or region with this.
+ inline bool Union(long x, long y, long width, long height) { return Combine(x, y, width, height, wxRGN_OR); }
+ inline bool Union(const wxRect& rect) { return Combine(rect, wxRGN_OR); }
+ inline bool Union(const wxRegion& region) { return Combine(region, wxRGN_OR); }
+
+ // Intersect rectangle or region with this.
+ inline bool Intersect(long x, long y, long width, long height) { return Combine(x, y, width, height, wxRGN_AND); }
+ inline bool Intersect(const wxRect& rect) { return Combine(rect, wxRGN_AND); }
+ inline bool Intersect(const wxRegion& region) { return Combine(region, wxRGN_AND); }
+
+ // Subtract rectangle or region from this:
// Combines the parts of 'this' that are not part of the second region.
- inline bool Subtract(long x, long y, long width, long height) { return Combine(x, y, width, height, wxRGN_DIFF); }
- inline bool Subtract(const wxRect& rect) { return Combine(rect, wxRGN_DIFF); }
- inline bool Subtract(const wxRegion& region) { return Combine(region, wxRGN_DIFF); }
-
- // XOR: the union of two combined regions except for any overlapping areas.
- inline bool Xor(long x, long y, long width, long height) { return Combine(x, y, width, height, wxRGN_XOR); }
- inline bool Xor(const wxRect& rect) { return Combine(rect, wxRGN_XOR); }
- inline bool Xor(const wxRegion& region) { return Combine(region, wxRGN_XOR); }
-
- //# Information on region
- // Outer bounds of region
- void GetBox(long& x, long& y, long&w, long &h) const;
- wxRect GetBox() const ;
-
- // Is region empty?
- bool Empty() const;
+ inline bool Subtract(long x, long y, long width, long height) { return Combine(x, y, width, height, wxRGN_DIFF); }
+ inline bool Subtract(const wxRect& rect) { return Combine(rect, wxRGN_DIFF); }
+ inline bool Subtract(const wxRegion& region) { return Combine(region, wxRGN_DIFF); }
+
+ // XOR: the union of two combined regions except for any overlapping areas.
+ inline bool Xor(long x, long y, long width, long height) { return Combine(x, y, width, height, wxRGN_XOR); }
+ inline bool Xor(const wxRect& rect) { return Combine(rect, wxRGN_XOR); }
+ inline bool Xor(const wxRegion& region) { return Combine(region, wxRGN_XOR); }
+
+ //# Information on region
+ // Outer bounds of region
+ void GetBox(long& x, long& y, long&w, long &h) const;
+ wxRect GetBox() const ;
+
+ // Is region empty?
+ bool Empty() const;
inline bool IsEmpty() const { return Empty(); }
- //# Tests
- // Does the region contain the point (x,y)?
- wxRegionContain Contains(long x, long y) const;
- // Does the region contain the point pt?
- wxRegionContain Contains(const wxPoint& pt) const;
- // Does the region contain the rectangle (x, y, w, h)?
- wxRegionContain Contains(long x, long y, long w, long h) const;
- // Does the region contain the rectangle rect?
- wxRegionContain Contains(const wxRect& rect) const;
+ //# Tests
+ // Does the region contain the point (x,y)?
+ wxRegionContain Contains(long x, long y) const;
+ // Does the region contain the point pt?
+ wxRegionContain Contains(const wxPoint& pt) const;
+ // Does the region contain the rectangle (x, y, w, h)?
+ wxRegionContain Contains(long x, long y, long w, long h) const;
+ // Does the region contain the rectangle rect?
+ wxRegionContain Contains(const wxRect& rect) const;
// Internal
- bool Combine(long x, long y, long width, long height, wxRegionOp op);
- bool Combine(const wxRegion& region, wxRegionOp op);
- bool Combine(const wxRect& rect, wxRegionOp op);
+ bool Combine(long x, long y, long width, long height, wxRegionOp op);
+ bool Combine(const wxRegion& region, wxRegionOp op);
+ bool Combine(const wxRect& rect, wxRegionOp op);
+
+ // Get internal region handle
+ WXHRGN GetHRGN() const;
};
class WXDLLEXPORT wxRegionIterator : public wxObject {
DECLARE_DYNAMIC_CLASS(wxRegionIterator);
public:
- wxRegionIterator();
- wxRegionIterator(const wxRegion& region);
- ~wxRegionIterator();
+ wxRegionIterator();
+ wxRegionIterator(const wxRegion& region);
+ ~wxRegionIterator();
- void Reset() { m_current = 0; }
- void Reset(const wxRegion& region);
+ void Reset() { m_current = 0; }
+ void Reset(const wxRegion& region);
- operator bool () const { return m_current < m_numRects; }
- bool HaveRects() const { return m_current < m_numRects; }
+ operator bool () const { return m_current < m_numRects; }
+ bool HaveRects() const { return m_current < m_numRects; }
- void operator ++ ();
- void operator ++ (int);
+ void operator ++ ();
+ void operator ++ (int);
- long GetX() const;
- long GetY() const;
- long GetW() const;
- long GetWidth() const { return GetW(); }
- long GetH() const;
- long GetHeight() const { return GetH(); }
+ long GetX() const;
+ long GetY() const;
+ long GetW() const;
+ long GetWidth() const { return GetW(); }
+ long GetH() const;
+ long GetHeight() const { return GetH(); }
wxRect GetRect() const { return wxRect(GetX(), GetY(), GetWidth(), GetHeight()); }
private:
- long m_current;
- long m_numRects;
- wxRegion m_region;
+ long m_current;
+ long m_numRects;
+ wxRegion m_region;
wxRect* m_rects;
};
#endif
- // _WX_REGION_H_
+ // _WX_REGION_H_
/////////////////////////////////////////////////////////////////////////////
// Name: scrollbar.h
// Purpose: wxScrollBar class
-// Author: AUTHOR
+// Author: David Webster
// Modified by:
-// Created: ??/??/98
+// Created: 10/15/99
// RCS-ID: $Id$
-// Copyright: (c) AUTHOR
-// Licence: wxWindows licence
+// Copyright: (c) David Webster
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_SCROLBAR_H_
#define _WX_SCROLBAR_H_
-#ifdef __GNUG__
-#pragma interface "scrolbar.h"
-#endif
-
#include "wx/control.h"
WXDLLEXPORT_DATA(extern const char*) wxScrollBarNameStr;
virtual void SetScrollbar(int position, int thumbSize, int range, int pageSize,
bool refresh = TRUE);
+#if WXWIN_COMPATIBILITY
+ // Backward compatibility
+ int GetValue() const { return GetThumbPosition(); }
+ void SetValue(int viewStart) { SetThumbPosition(viewStart); }
+ void GetValues(int *viewStart, int *viewLength, int *objectLength,
+ int *pageLength) const ;
+ int GetViewLength() const { return m_viewSize; }
+ int GetObjectLength() const { return m_objectSize; }
+
+ void SetPageSize(int pageLength);
+ void SetObjectLength(int objectLength);
+ void SetViewLength(int viewLength);
+#endif
+
void Command(wxCommandEvent& event);
+ virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
+ WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
+ virtual bool OS2OnScroll(int orientation, WXWORD wParam,
+ WXWORD pos, WXHWND control);
+
+#if WXWIN_COMPATIBILITY
+ // Backward compatibility: generate an old-style scroll command
+ void OnScroll(wxScrollEvent& event);
+#endif // WXWIN_COMPATIBILITY
+
protected:
- int m_pageSize;
- int m_viewSize;
- int m_objectSize;
+ int m_pageSize;
+ int m_viewSize;
+ int m_objectSize;
DECLARE_EVENT_TABLE()
};
/////////////////////////////////////////////////////////////////////////////
// Name: settings.h
// Purpose: wxSystemSettings class
-// Author: AUTHOR
+// Author: David Webster
// Modified by:
-// Created: ??/??/98
+// Created: 10/15/98
// RCS-ID: $Id$
// Copyright: (c) AUTHOR
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_SETTINGS_H_
#define _WX_SETTINGS_H_
-#ifdef __GNUG__
-#pragma interface "settings.h"
-#endif
-
#include "wx/setup.h"
-#include "wx/defs.h"
-#include "wx/object.h"
#include "wx/colour.h"
#include "wx/font.h"
/////////////////////////////////////////////////////////////////////////////
// Name: slider.h
// Purpose: wxSlider class
-// Author: AUTHOR
+// Author: David Webster
// Modified by:
-// Created: ??/??/98
+// Created: 10/15/99
// RCS-ID: $Id$
-// Copyright: (c) AUTHOR
-// Licence: wxWindows licence
+// Copyright: (c) David Webster
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_SLIDER_H_
#define _WX_SLIDER_H_
-#ifdef __GNUG__
-#pragma interface "slider.h"
-#endif
-
#include "wx/control.h"
WXDLLEXPORT_DATA(extern const char*) wxSliderNameStr;
virtual int GetValue() const ;
virtual void SetValue(int);
+
void GetSize(int *x, int *y) const ;
- void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
void GetPosition(int *x, int *y) const ;
+
bool Show(bool show);
void SetRange(int minValue, int maxValue);
inline int GetMin() const { return m_rangeMin; }
inline int GetMax() const { return m_rangeMax; }
+ void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
+
+
+
// For trackbars only
void SetTickFreq(int n, int pos);
inline int GetTickFreq() const { return m_tickFreq; }
int GetThumbLength() const ;
void SetTick(int tickPos) ;
+ // IMPLEMENTATION
+ WXHWND GetStaticMin() const { return m_staticMin; }
+ WXHWND GetStaticMax() const { return m_staticMax; }
+ WXHWND GetEditValue() const { return m_staticValue; }
+ virtual bool ContainsHWND(WXHWND hWnd) const;
+
void Command(wxCommandEvent& event);
+ virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
+ WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
+ virtual bool OS2OnScroll(int orientation, WXWORD wParam,
+ WXWORD pos, WXHWND control);
+
protected:
+ WXHWND m_staticMin;
+ WXHWND m_staticMax;
+ WXHWND m_staticValue;
int m_rangeMin;
int m_rangeMax;
int m_pageSize;
int m_lineSize;
int m_tickFreq;
-DECLARE_EVENT_TABLE()
+
+ virtual void DoSetSize(int x, int y,
+ int width, int height,
+ int sizeFlags = wxSIZE_AUTO);
};
#endif
/////////////////////////////////////////////////////////////////////////////
// Name: spinbutt.h
// Purpose: wxSpinButton class
-// Author: AUTHOR
+// Author: David Webster
// Modified by:
-// Created: ??/??/98
+// Created: 10/15/99
// RCS-ID: $Id$
-// Copyright: (c) AUTHOR
-// Licence: wxWindows licence
+// Copyright: (c) David Webster
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_SPINBUTT_H_
#define _WX_SPINBUTT_H_
-#ifdef __GNUG__
-#pragma interface "spinbutt.h"
-#endif
-
#include "wx/control.h"
#include "wx/event.h"
-/*
- The wxSpinButton is like a small scrollbar than is often placed next
- to a text control.
-
- wxSP_HORIZONTAL: horizontal spin button
- wxSP_VERTICAL: vertical spin button (the default)
- wxSP_ARROW_KEYS: arrow keys increment/decrement value
- wxSP_WRAP: value wraps at either end
- */
-
class WXDLLEXPORT wxSpinButton: public wxControl
{
- DECLARE_DYNAMIC_CLASS(wxSpinButton)
- public:
- /*
- * Public interface
- */
-
- wxSpinButton();
-
- inline wxSpinButton(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
- long style = wxSP_VERTICAL, const wxString& name = "wxSpinButton")
- {
- Create(parent, id, pos, size, style, name);
- }
- ~wxSpinButton();
-
- bool Create(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
- long style = wxSP_VERTICAL, const wxString& name = "wxSpinButton");
-
-
- // Attributes
- ////////////////////////////////////////////////////////////////////////////
-
- int GetValue() const ;
- void SetValue(int val) ;
- void SetRange(int minVal, int maxVal) ;
- inline int GetMin() const { return m_min; }
- inline int GetMax() const { return m_max; }
-
- // Operations
- ////////////////////////////////////////////////////////////////////////////
-
- void Command(wxCommandEvent& event) { ProcessCommand(event); };
+public:
+ // Construction
+ wxSpinButton() { }
+
+ inline wxSpinButton( wxWindow *parent
+ ,wxWindowID id = -1
+ ,const wxPoint& pos = wxDefaultPosition
+ ,const wxSize& size = wxDefaultSize
+ ,long style = wxSP_VERTICAL
+ ,const wxString& name = "wxSpinButton"
+ )
+ {
+ Create(parent, id, pos, size, style, name);
+ }
+
+ virtual ~wxSpinButton();
+
+ bool Create( wxWindow *parent
+ ,wxWindowID id = -1
+ ,const wxPoint& pos = wxDefaultPosition
+ ,const wxSize& size = wxDefaultSize
+ ,long style = wxSP_VERTICAL
+ ,const wxString& name = "wxSpinButton"
+ );
+
+ // Accessors
+ virtual int GetValue() const ;
+ virtual void SetValue(int val) ;
+ virtual void SetRange( int minVal
+ ,int maxVal
+ );
+
+ // Implementation
+ virtual bool OS2Command( WXUINT param
+ ,WXWORD id
+ );
+ virtual bool OS2OnNotify( int idCtrl
+ ,WXLPARAM lParam
+ ,WXLPARAM* result
+ );
+ virtual bool OS2OnScroll( int orientation
+ ,WXWORD wParam
+ ,WXWORD pos
+ ,WXHWND control
+ );
protected:
- int m_min;
- int m_max;
+ virtual wxSize DoGetBestSize();
+private:
+ DECLARE_DYNAMIC_CLASS(wxSpinButton)
};
-
-// Spin events
-
-#define EVT_SPIN_UP(id, func) { wxEVT_SCROLL_LINEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func }
-#define EVT_SPIN_DOWN(id, func) { wxEVT_SCROLL_LINEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func }
-
-#define EVT_SPIN(id, func) \
- { wxEVT_SCROLL_TOP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
- { wxEVT_SCROLL_BOTTOM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
- { wxEVT_SCROLL_LINEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
- { wxEVT_SCROLL_LINEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
- { wxEVT_SCROLL_PAGEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
- { wxEVT_SCROLL_PAGEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
- { wxEVT_SCROLL_THUMBTRACK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },
-
#endif
// _WX_SPINBUTT_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: msw/spinctrl.h
+// Purpose: wxSpinCtrl class declaration for Win32
+// Author: David Webster
+// Modified by:
+// Created: 10/15/99
+// RCS-ID: $Id$
+// Copyright: (c) David Webster
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_MSW_SPINCTRL_H_
+#define _WX_MSW_SPINCTRL_H_
+
+#include "wx/spinbutt.h" // the base class
+
+// ----------------------------------------------------------------------------
+// Under Win32 and OS2 PM, wxSpinCtrl is a wxSpinButton with a buddy
+// text window whose contents is automatically updated when the spin
+// control is clicked.
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxSpinCtrl : public wxSpinButton
+{
+public:
+ wxSpinCtrl() { }
+
+ wxSpinCtrl(wxWindow *parent,
+ wxWindowID id = -1,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSP_ARROW_KEYS,
+ int min = 0, int max = 100, int initial = 0,
+ const wxString& name = _T("wxSpinCtrl"))
+ {
+ Create(parent, id, pos, size, style, min, max, initial, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id = -1,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSP_ARROW_KEYS,
+ int min = 0, int max = 100, int initial = 0,
+ const wxString& name = _T("wxSpinCtrl"));
+
+protected:
+ void DoMoveWindow(int x, int y, int width, int height);
+
+ WXHWND m_hwndBuddy;
+
+ DECLARE_DYNAMIC_CLASS(wxSpinCtrl)
+};
+
+#endif // _WX_MSW_SPINCTRL_H_
+
+
long style = 0,
const wxString& name = wxStaticBitmapNameStr);
+ virtual void SetIcon(const wxIcon& icon) { SetBitmap(icon); }
virtual void SetBitmap(const wxBitmap& bitmap);
- virtual void Command(wxCommandEvent& WXUNUSED(event)) {};
- virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {};
-
- void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
-
- inline wxBitmap& GetBitmap() const { return (wxBitmap&) m_messageBitmap; }
+ // assert failure is provoked by an attempt to get an icon from bitmap or
+ // vice versa
+ const wxIcon& GetIcon() const
+ { wxASSERT( m_isIcon ); return *m_image.icon; }
+ const wxBitmap& GetBitmap() const
+ { wxASSERT( !m_isIcon ); return *m_image.bitmap; }
// overriden base class virtuals
virtual bool AcceptsFocus() const { return FALSE; }
- protected:
- wxBitmap m_messageBitmap;
+protected:
+ void Init() { m_isIcon = TRUE; m_image.icon = NULL; }
+ void Free();
+
+ // TRUE if icon/bitmap is valid
+ bool ImageIsOk() const;
+
+ // we can have either an icon or a bitmap
+ bool m_isIcon;
+ union
+ {
+ wxIcon *icon;
+ wxBitmap *bitmap;
+ } m_image;
+ virtual wxSize DoGetBestSize();
};
#endif
/////////////////////////////////////////////////////////////////////////////
// Name: statbox.h
// Purpose: wxStaticBox class
-// Author: AUTHOR
+// Author: David Webster
// Modified by:
-// Created: ??/??/98
+// Created: 10/15/99
// RCS-ID: $Id$
-// Copyright: (c) AUTHOR
-// Licence: wxWindows licence
+// Copyright: (c) David Webster
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_STATBOX_H_
#define _WX_STATBOX_H_
-#ifdef __GNUG__
-#pragma interface "statbox.h"
-#endif
-
#include "wx/control.h"
WXDLLEXPORT_DATA(extern const char*) wxStaticBoxNameStr;
DECLARE_DYNAMIC_CLASS(wxStaticBox)
public:
- inline wxStaticBox() {}
- inline wxStaticBox(wxWindow *parent, wxWindowID id,
- const wxString& label,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize,
- long style = 0,
- const wxString& name = wxStaticBoxNameStr)
- {
- Create(parent, id, label, pos, size, style, name);
- }
-
- bool Create(wxWindow *parent, wxWindowID id,
- const wxString& label,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize,
- long style = 0,
- const wxString& name = wxStaticBoxNameStr);
-
- virtual void Command(wxCommandEvent& WXUNUSED(event)) {};
- virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {};
-
- void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
- void SetLabel(const wxString& label);
-
-DECLARE_EVENT_TABLE()
+ inline wxStaticBox() {}
+ inline wxStaticBox( wxWindow* parent
+ ,wxWindowID id
+ ,const wxString& label
+ ,const wxPoint& pos = wxDefaultPosition
+ ,const wxSize& size = wxDefaultSize
+ ,long style = 0
+ ,const wxString& name = wxStaticBoxNameStr
+ )
+ {
+ Create(parent, id, label, pos, size, style, name);
+ }
+
+ bool Create( wxWindow* parent
+ ,wxWindowID id
+ ,const wxString& label
+ ,const wxPoint& pos = wxDefaultPosition
+ ,const wxSize& size = wxDefaultSize
+ ,long style = 0
+ ,const wxString& name = wxStaticBoxNameStr
+ );
+
+ // implementation from now on
+ // --------------------------
+
+ void OnEraseBackground(wxEraseEvent& event);
+
+ virtual MRESULT OS2WindowProc(HWND hwnd, WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
+
+ virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
+ WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
+
+ // overriden base class virtuals
+ virtual bool AcceptsFocus() const { return FALSE; }
+
+protected:
+ virtual wxSize DoGetBestSize();
+
+private:
+ DECLARE_EVENT_TABLE()
};
#endif
// _WX_STATBOX_H_
+
..\os2\$D\print.obj \
..\os2\$D\radiobox.obj \
..\os2\$D\radiobut.obj \
+ ..\os2\$D\region.obj \
+ ..\os2\$D\scrolbar.obj \
+ ..\os2\$D\settings.obj \
+ ..\os2\$D\slider.obj \
+ ..\os2\$D\spinbutt.obj \
+ ..\os2\$D\spinctrl.obj \
+ ..\os2\$D\statbmp.obj \
+ ..\os2\$D\statbox.obj \
..\os2\$D\window.obj
OS2LIBOBJS1 = \
print.obj \
radiobox.obj \
radiobut.obj \
+ region.obj \
+ scrolbar.obj \
+ settings.obj \
+ slider.obj \
+ spinbutt.obj \
+ spinctrl.obj \
+ statbmp.obj \
+ statbox.obj \
window.obj
HTMLOBJS = \
copy ..\os2\$D\print.obj
copy ..\os2\$D\radiobox.obj
copy ..\os2\$D\radiobut.obj
+ copy ..\os2\$D\region.obj
+ copy ..\os2\$D\scrolbar.obj
+ copy ..\os2\$D\settings.obj
+ copy ..\os2\$D\slider.obj
+ copy ..\os2\$D\spinbutt.obj
+ copy ..\os2\$D\spinctrl.obj
+ copy ..\os2\$D\statbmp.obj
+ copy ..\os2\$D\statbox.obj
copy ..\os2\$D\window.obj
# wxWindows library as DLL
/////////////////////////////////////////////////////////////////////////////
// File: region.cpp
// Purpose: Region class
-// Author: Markus Holzem/Julian Smart/AUTHOR
-// Created: Fri Oct 24 10:46:34 MET 1997
+// Author: David Webster
+// Modified by:
+// Created: 10/15/99
// RCS-ID: $Id$
-// Copyright: (c) 1997 Markus Holzem/Julian Smart/AUTHOR
+// Copyright: (c) Davdi Webster
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
-#pragma implementation "region.h"
-#endif
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
-#include "wx/region.h"
+#include "wx/os2/region.h"
#include "wx/gdicmn.h"
+#include "wx/window.h"
+#include "wx/os2/private.h"
+
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject)
IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator, wxObject)
class WXDLLEXPORT wxRegionRefData : public wxGDIRefData {
public:
- wxRegionRefData()
- {
- }
+ wxRegionRefData()
+ {
+ m_region = 0;
+ }
- wxRegionRefData(const wxRegionRefData& data)
- {
+ wxRegionRefData(const wxRegionRefData& data)
+ {
// TODO
- }
+ }
- ~wxRegionRefData()
- {
+ ~wxRegionRefData()
+ {
// TODO
- }
+
+ }
};
// TODO create empty region
}
+wxRegion::wxRegion(WXHRGN hRegion)
+{
+ m_refData = new wxRegionRefData;
+ M_REGION = (HRGN) hRegion;
+}
+
wxRegion::wxRegion(long x, long y, long w, long h)
{
m_refData = new wxRegionRefData;
//! Combine rectangle (x, y, w, h) with this.
bool wxRegion::Combine(long x, long y, long width, long height, wxRegionOp op)
{
- // Don't change shared data
- if (!m_refData) {
- m_refData = new wxRegionRefData();
- } else if (m_refData->GetRefCount() > 1) {
- wxRegionRefData* ref = (wxRegionRefData*)m_refData;
- UnRef();
- m_refData = new wxRegionRefData(*ref);
- }
+ // Don't change shared data
+ if (!m_refData) {
+ m_refData = new wxRegionRefData();
+ } else if (m_refData->GetRefCount() > 1) {
+ wxRegionRefData* ref = (wxRegionRefData*)m_refData;
+ UnRef();
+ m_refData = new wxRegionRefData(*ref);
+ }
// If ref count is 1, that means it's 'ours' anyway so no action.
// TODO create rect region
//! Union /e region with this.
bool wxRegion::Combine(const wxRegion& region, wxRegionOp op)
{
- if (region.Empty())
- return FALSE;
-
- // Don't change shared data
- if (!m_refData) {
- m_refData = new wxRegionRefData();
- } else if (m_refData->GetRefCount() > 1) {
- wxRegionRefData* ref = (wxRegionRefData*)m_refData;
- UnRef();
- m_refData = new wxRegionRefData(*ref);
- }
+ if (region.Empty())
+ return FALSE;
+
+ // Don't change shared data
+ if (!m_refData) {
+ m_refData = new wxRegionRefData();
+ } else if (m_refData->GetRefCount() > 1) {
+ wxRegionRefData* ref = (wxRegionRefData*)m_refData;
+ UnRef();
+ m_refData = new wxRegionRefData(*ref);
+ }
int mode = 0; // TODO platform-specific code
switch (op)
// TODO combine region
- return FALSE;
+ return FALSE;
}
bool wxRegion::Combine(const wxRect& rect, wxRegionOp op)
// Outer bounds of region
void wxRegion::GetBox(long& x, long& y, long&w, long &h) const
{
- if (m_refData) {
+ if (m_refData) {
// TODO get box
- } else {
- x = y = w = h = 0;
- }
+ } else {
+ x = y = w = h = 0;
+ }
}
wxRect wxRegion::GetBox() const
// Does the region contain the point (x,y)?
wxRegionContain wxRegion::Contains(long x, long y) const
{
- if (!m_refData)
- return wxOutRegion;
+ if (!m_refData)
+ return wxOutRegion;
// TODO. Return wxInRegion if within region.
if (0)
// Does the region contain the point pt?
wxRegionContain wxRegion::Contains(const wxPoint& pt) const
{
- if (!m_refData)
- return wxOutRegion;
+ if (!m_refData)
+ return wxOutRegion;
// TODO. Return wxInRegion if within region.
if (0)
// Does the region contain the rectangle (x, y, w, h)?
wxRegionContain wxRegion::Contains(long x, long y, long w, long h) const
{
- if (!m_refData)
- return wxOutRegion;
+ if (!m_refData)
+ return wxOutRegion;
// TODO. Return wxInRegion if within region.
if (0)
// Does the region contain the rectangle rect
wxRegionContain wxRegion::Contains(const wxRect& rect) const
{
- if (!m_refData)
- return wxOutRegion;
+ if (!m_refData)
+ return wxOutRegion;
long x, y, w, h;
x = rect.x;
return Contains(x, y, w, h);
}
+// Get internal region handle
+WXHRGN wxRegion::GetHRGN() const
+{
+ if (!m_refData)
+ return (WXHRGN) 0;
+ return (WXHRGN) M_REGION;
+}
+
///////////////////////////////////////////////////////////////////////////////
-// //
-// wxRegionIterator //
-// //
+// //
+// wxRegionIterator //
+// //
///////////////////////////////////////////////////////////////////////////////
/*!
{
m_rects = NULL;
- Reset(region);
+ Reset(region);
}
/*!
*/
void wxRegionIterator::Reset(const wxRegion& region)
{
- m_current = 0;
- m_region = region;
+ m_current = 0;
+ m_region = region;
if (m_rects)
delete[] m_rects;
m_rects = NULL;
- if (m_region.Empty())
- m_numRects = 0;
- else
+ if (m_region.Empty())
+ m_numRects = 0;
+ else
{
// TODO create m_rects and fill with rectangles for this region
m_numRects = 0;
*/
void wxRegionIterator::operator ++ ()
{
- if (m_current < m_numRects)
- ++m_current;
+ if (m_current < m_numRects)
+ ++m_current;
}
/*!
*/
void wxRegionIterator::operator ++ (int)
{
- if (m_current < m_numRects)
- ++m_current;
+ if (m_current < m_numRects)
+ ++m_current;
}
long wxRegionIterator::GetX() const
{
- if (m_current < m_numRects)
- return m_rects[m_current].x;
- return 0;
+ if (m_current < m_numRects)
+ return m_rects[m_current].x;
+ return 0;
}
long wxRegionIterator::GetY() const
{
- if (m_current < m_numRects)
- return m_rects[m_current].y;
- return 0;
+ if (m_current < m_numRects)
+ return m_rects[m_current].y;
+ return 0;
}
long wxRegionIterator::GetW() const
{
- if (m_current < m_numRects)
- return m_rects[m_current].width ;
- return 0;
+ if (m_current < m_numRects)
+ return m_rects[m_current].width ;
+ return 0;
}
long wxRegionIterator::GetH() const
{
- if (m_current < m_numRects)
- return m_rects[m_current].height;
- return 0;
+ if (m_current < m_numRects)
+ return m_rects[m_current].height;
+ return 0;
}
/////////////////////////////////////////////////////////////////////////////
// Name: scrolbar.cpp
// Purpose: wxScrollBar
-// Author: AUTHOR
+// Author: David Webster
// Modified by:
-// Created: ??/??/98
+// Created: 10/15/99
// RCS-ID: $Id$
-// Copyright: (c) AUTHOR
-// Licence: wxWindows licence
+// Copyright: (c) David Webster
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
-#pragma implementation "scrolbar.h"
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifndef WX_PRECOMP
+#include "wx/defs.h"
+#include "wx/utils.h"
#endif
#include "wx/scrolbar.h"
+#include "wx/os2/private.h"
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxScrollBar, wxControl)
+BEGIN_EVENT_TABLE(wxScrollBar, wxControl)
+#if WXWIN_COMPATIBILITY
+ EVT_SCROLL(wxScrollBar::OnScroll)
+#endif
+END_EVENT_TABLE()
+
#endif
// Scrollbar
return FALSE;
parent->AddChild(this);
SetName(name);
- SetValidator(validator);
+ SetValidator(validator);
+ SetBackgroundColour(parent->GetBackgroundColour()) ;
+ SetForegroundColour(parent->GetForegroundColour()) ;
m_windowStyle = style;
if ( id == -1 )
- m_windowId = (int)NewControlId();
+ m_windowId = (int)NewControlId();
else
- m_windowId = id;
+ m_windowId = id;
+
+ int x = pos.x;
+ int y = pos.y;
+ int width = size.x;
+ int height = size.y;
+
+ if (width == -1)
+ {
+ if (style & wxHORIZONTAL)
+ width = 140;
+ else
+ width = 14;
+ }
+ if (height == -1)
+ {
+ if (style & wxVERTICAL)
+ height = 140;
+ else
+ height = 14;
+ }
// TODO create scrollbar
+
+ m_pageSize = 1;
+ m_viewSize = 1;
+ m_objectSize = 1;
+
+ SetFont(parent->GetFont());
+
+ m_hWnd = 0; // TODO: (WXHWND)scroll_bar;
+
+ // Subclass again for purposes of dialog editing mode
+ SubclassWin((WXHWND) scroll_bar);
+
+ SetSize(x, y, width, height);
+
return TRUE;
}
{
}
+bool wxScrollBar::OS2OnScroll(int WXUNUSED(orientation), WXWORD wParam,
+ WXWORD pos, WXHWND control)
+{
+ // TODO:
+/*
+ int position = ::GetScrollPos((HWND) control, SB_CTL);
+ int minPos, maxPos;
+ ::GetScrollRange((HWND) control, SB_CTL, &minPos, &maxPos);
+
+#if defined(__WIN95__)
+ // A page size greater than one has the effect of reducing the effective
+ // range, therefore the range has already been boosted artificially - so
+ // reduce it again.
+ if ( m_pageSize > 1 )
+ maxPos -= (m_pageSize - 1);
+#endif // __WIN95__
+
+ wxEventType scrollEvent = wxEVT_NULL;
+
+ int nScrollInc;
+ switch ( wParam )
+ {
+ case SB_TOP:
+ nScrollInc = maxPos - position;
+ scrollEvent = wxEVT_SCROLL_TOP;
+ break;
+
+ case SB_BOTTOM:
+ nScrollInc = - position;
+ scrollEvent = wxEVT_SCROLL_BOTTOM;
+ break;
+
+ case SB_LINEUP:
+ nScrollInc = -1;
+ scrollEvent = wxEVT_SCROLL_LINEUP;
+ break;
+
+ case SB_LINEDOWN:
+ nScrollInc = 1;
+ scrollEvent = wxEVT_SCROLL_LINEDOWN;
+ break;
+
+ case SB_PAGEUP:
+ nScrollInc = -GetPageSize();
+ scrollEvent = wxEVT_SCROLL_PAGEUP;
+ break;
+
+ case SB_PAGEDOWN:
+ nScrollInc = GetPageSize();
+ scrollEvent = wxEVT_SCROLL_PAGEDOWN;
+ break;
+
+ case SB_THUMBTRACK:
+ case SB_THUMBPOSITION:
+ nScrollInc = pos - position;
+ scrollEvent = wxEVT_SCROLL_THUMBTRACK;
+ break;
+
+ default:
+ nScrollInc = 0;
+ }
+
+ if ( nScrollInc == 0 )
+ {
+ // no event to process, so don't process it
+ return FALSE;
+ }
+
+ int new_pos = position + nScrollInc;
+
+ if (new_pos < 0)
+ new_pos = 0;
+ if (new_pos > maxPos)
+ new_pos = maxPos;
+
+ SetThumbPosition(new_pos);
+ wxScrollEvent event(scrollEvent, m_windowId);
+ event.SetPosition(new_pos);
+ event.SetEventObject( this );
+
+ return GetEventHandler()->ProcessEvent(event);
+*/
+ return FALSE;
+}
+
void wxScrollBar::SetThumbPosition(int viewStart)
{
// TODO
// TODO
}
+#if WXWIN_COMPATIBILITY
+void wxScrollBar::SetPageSize(int pageLength)
+{
+ m_pageSize = pageLength;
+
+ // TODO:
+}
+
+void wxScrollBar::SetObjectLength(int objectLength)
+{
+ m_objectSize = objectLength;
+
+ // The range (number of scroll steps) is the
+ // object length minus the view size.
+ int range = wxMax((objectLength - m_viewSize), 0) ;
+
+ // TODO:
+}
+
+void wxScrollBar::SetViewLength(int viewLength)
+{
+ m_viewSize = viewLength;
+}
+
+void wxScrollBar::GetValues(int *viewStart, int *viewLength, int *objectLength,
+ int *pageLength) const
+{
+// TODO:
+/*
+ *viewStart = ::GetScrollPos((HWND)m_hWnd, SB_CTL);
+ *viewLength = m_viewSize;
+ *objectLength = m_objectSize;
+ *pageLength = m_pageSize;
+*/
+}
+#endif
+
+WXHBRUSH wxScrollBar::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
+ WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
+{
+ return 0;
+}
void wxScrollBar::Command(wxCommandEvent& event)
{
ProcessCommand(event);
}
+#if WXWIN_COMPATIBILITY
+// Backward compatibility
+void wxScrollBar::OnScroll(wxScrollEvent& event)
+{
+ // TODO:
+/*
+ wxEventType oldEvent = event.GetEventType();
+ event.SetEventType( wxEVT_COMMAND_SCROLLBAR_UPDATED );
+ if ( !GetEventHandler()->ProcessEvent(event) )
+ {
+ event.SetEventType( oldEvent );
+ if (!GetParent()->GetEventHandler()->ProcessEvent(event))
+ event.Skip();
+ }
+*/
+}
+#endif
/////////////////////////////////////////////////////////////////////////////
// Name: settings.cpp
// Purpose: wxSettings
-// Author: AUTHOR
+// Author: David Webster
// Modified by:
-// Created: ??/??/98
+// Created: 10/15/99
// RCS-ID: $Id$
-// Copyright: (c) AUTHOR
-// Licence: wxWindows licence
+// Copyright: (c) David Webster
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
-#pragma implementation "settings.h"
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifndef WX_PRECOMP
+#include <stdio.h>
+#include "wx/defs.h"
+#include "wx/pen.h"
+#include "wx/brush.h"
+#include "wx/gdicmn.h"
#endif
#include "wx/settings.h"
+#include "wx/window.h"
+#include "wx/os2/private.h"
+// TODO: see ::SystemParametersInfo for all sorts of Windows settings.
+// Different args are required depending on the id. How does this differ
+// from GetSystemMetric, and should it? Perhaps call it GetSystemParameter
+// and pass an optional void* arg to get further info.
+// Should also have SetSystemParameter.
+// Also implement WM_WININICHANGE (NT) / WM_SETTINGCHANGE (Win95)
wxColour wxSystemSettings::GetSystemColour(int index)
{
// TODO
- return wxColour();
+ return wxColour();
}
wxFont wxSystemSettings::GetSystemFont(int index)
// Get a system metric, e.g. scrollbar size
int wxSystemSettings::GetSystemMetric(int index)
{
- switch ( index)
- {
+ switch ( index)
+ {
case wxSYS_MOUSE_BUTTONS:
// TODO
- return 0;
+ return 0;
case wxSYS_BORDER_X:
// TODO
- return 0;
+ return 0;
case wxSYS_BORDER_Y:
// TODO
- return 0;
+ return 0;
case wxSYS_CURSOR_X:
// TODO
- return 0;
+ return 0;
case wxSYS_CURSOR_Y:
// TODO
- return 0;
+ return 0;
case wxSYS_DCLICK_X:
// TODO
- return 0;
+ return 0;
case wxSYS_DCLICK_Y:
// TODO
- return 0;
+ return 0;
case wxSYS_DRAG_X:
// TODO
- return 0;
+ return 0;
case wxSYS_DRAG_Y:
// TODO
- return 0;
+ return 0;
case wxSYS_EDGE_X:
// TODO
- return 0;
+ return 0;
case wxSYS_EDGE_Y:
// TODO
- return 0;
+ return 0;
case wxSYS_HSCROLL_ARROW_X:
// TODO
- return 0;
+ return 0;
case wxSYS_HSCROLL_ARROW_Y:
// TODO
- return 0;
+ return 0;
case wxSYS_HTHUMB_X:
// TODO
- return 0;
+ return 0;
case wxSYS_ICON_X:
// TODO
- return 0;
+ return 0;
case wxSYS_ICON_Y:
// TODO
- return 0;
+ return 0;
case wxSYS_ICONSPACING_X:
// TODO
- return 0;
+ return 0;
case wxSYS_ICONSPACING_Y:
// TODO
- return 0;
+ return 0;
case wxSYS_WINDOWMIN_X:
// TODO
- return 0;
+ return 0;
case wxSYS_WINDOWMIN_Y:
// TODO
- return 0;
+ return 0;
case wxSYS_SCREEN_X:
// TODO
- return 0;
+ return 0;
case wxSYS_SCREEN_Y:
// TODO
- return 0;
+ return 0;
case wxSYS_FRAMESIZE_X:
// TODO
- return 0;
+ return 0;
case wxSYS_FRAMESIZE_Y:
// TODO
- return 0;
+ return 0;
case wxSYS_SMALLICON_X:
// TODO
- return 0;
+ return 0;
case wxSYS_SMALLICON_Y:
// TODO
- return 0;
+ return 0;
case wxSYS_HSCROLL_Y:
// TODO
- return 0;
+ return 0;
case wxSYS_VSCROLL_X:
// TODO
- return 0;
+ return 0;
case wxSYS_VSCROLL_ARROW_X:
// TODO
- return 0;
+ return 0;
case wxSYS_VSCROLL_ARROW_Y:
// TODO
- return 0;
+ return 0;
case wxSYS_VTHUMB_Y:
// TODO
- return 0;
+ return 0;
case wxSYS_CAPTION_Y:
// TODO
- return 0;
+ return 0;
case wxSYS_MENU_Y:
// TODO
- return 0;
+ return 0;
case wxSYS_NETWORK_PRESENT:
// TODO
- return 0;
+ return 0;
case wxSYS_PENWINDOWS_PRESENT:
// TODO
- return 0;
+ return 0;
case wxSYS_SHOW_SOUNDS:
// TODO
- return 0;
+ return 0;
case wxSYS_SWAP_BUTTONS:
// TODO
- return 0;
- default:
- return 0;
- }
- return 0;
+ return 0;
+ default:
+ return 0;
+ }
+ return 0;
}
/////////////////////////////////////////////////////////////////////////////
// Name: slider.cpp
// Purpose: wxSlider
-// Author: AUTHOR
+// Author: David Webster
// Modified by:
-// Created: ??/??/98
+// Created: 10/15/99
// RCS-ID: $Id$
-// Copyright: (c) AUTHOR
-// Licence: wxWindows licence
+// Copyright: (c) David Webster
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
-#pragma implementation "slider.h"
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include <stdio.h>
+#include <wx/utils.h>
+#include <wx/brush.h>
#endif
#include "wx/slider.h"
+#include "wx/os2/private.h"
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxSlider, wxControl)
-BEGIN_EVENT_TABLE(wxSlider, wxControl)
-END_EVENT_TABLE()
-#endif
-
-
-
// Slider
wxSlider::wxSlider()
{
+ m_staticValue = 0;
+ m_staticMin = 0;
+ m_staticMax = 0;
m_pageSize = 1;
m_lineSize = 1;
m_rangeMax = 0;
return FALSE;
}
+bool wxSlider::OS2OnScroll(int WXUNUSED(orientation), WXWORD wParam,
+ WXWORD pos, WXHWND control)
+{
+ int position = 0; // Dummy - not used in this mode
+
+ int nScrollInc;
+ wxEventType scrollEvent = wxEVT_NULL;
+// TODO:
+/*
+ switch ( wParam )
+ {
+ case SB_TOP:
+ nScrollInc = m_rangeMax - position;
+ scrollEvent = wxEVT_SCROLL_TOP;
+ break;
+
+ case SB_BOTTOM:
+ nScrollInc = - position;
+ scrollEvent = wxEVT_SCROLL_BOTTOM;
+ break;
+
+ case SB_LINEUP:
+ nScrollInc = - GetLineSize();
+ scrollEvent = wxEVT_SCROLL_LINEUP;
+ break;
+
+ case SB_LINEDOWN:
+ nScrollInc = GetLineSize();
+ scrollEvent = wxEVT_SCROLL_LINEDOWN;
+ break;
+
+ case SB_PAGEUP:
+ nScrollInc = -GetPageSize();
+ scrollEvent = wxEVT_SCROLL_PAGEUP;
+ break;
+
+ case SB_PAGEDOWN:
+ nScrollInc = GetPageSize();
+ scrollEvent = wxEVT_SCROLL_PAGEDOWN;
+ break;
+
+ case SB_THUMBTRACK:
+ case SB_THUMBPOSITION:
+#ifdef __WIN32__
+ nScrollInc = (signed short)pos - position;
+#else // Win16
+ nScrollInc = pos - position;
+#endif // Win32/16
+ scrollEvent = wxEVT_SCROLL_THUMBTRACK;
+ break;
+
+ default:
+ nScrollInc = 0;
+ }
+
+ if ( nScrollInc == 0 )
+ {
+ // no event...
+ return FALSE;
+ }
+
+ int newPos = (int)::SendMessage((HWND) control, TBM_GETPOS, 0, 0);
+ if ( (newPos < GetMin()) || (newPos > GetMax()) )
+ {
+ // out of range - but we did process it
+ return TRUE;
+ }
+*/
+ SetValue(newPos);
+
+ wxScrollEvent event(scrollEvent, m_windowId);
+ event.SetPosition(newPos);
+ event.SetEventObject( this );
+ GetEventHandler()->ProcessEvent(event);
+
+ wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, GetId() );
+ cevent.SetEventObject( this );
+
+ return GetEventHandler()->ProcessEvent( cevent );
+}
+
wxSlider::~wxSlider()
{
+ // TODO:
}
int wxSlider::GetValue() const
// TODO
}
-void wxSlider::SetSize(int x, int y, int width, int height, int sizeFlags)
+// TODO one day, make sense of all this horros and replace it with a readable
+// DoGetBestSize()
+void wxSlider::DoSetSize(int x, int y, int width, int height, int sizeFlags)
{
- // TODO
+ int x1 = x;
+ int y1 = y;
+ int w1 = width;
+ int h1 = height;
+
+ int currentX, currentY;
+ GetPosition(¤tX, ¤tY);
+ if (x == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
+ x1 = currentX;
+ if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
+ y1 = currentY;
+
+// TODO:
+/*
+
+ AdjustForParentClientOrigin(x1, y1, sizeFlags);
+
+ wxChar buf[300];
+
+ int x_offset = x;
+ int y_offset = y;
+
+ int cx; // slider,min,max sizes
+ int cy;
+ int cyf;
+
+ wxGetCharSize(GetHWND(), &cx, &cy, & this->GetFont());
+
+ if ((m_windowStyle & wxSL_VERTICAL) != wxSL_VERTICAL)
+ {
+ if ( m_windowStyle & wxSL_LABELS )
+ {
+ int min_len = 0;
+
+ GetWindowText((HWND) m_staticMin, buf, 300);
+ GetTextExtent(buf, &min_len, &cyf,NULL,NULL, & this->GetFont());
+
+ int max_len = 0;
+
+ GetWindowText((HWND) m_staticMax, buf, 300);
+ GetTextExtent(buf, &max_len, &cyf,NULL,NULL, & this->GetFont());
+ if (m_staticValue)
+ {
+ int new_width = (int)(wxMax(min_len, max_len));
+ int valueHeight = (int)cyf;
+#ifdef __WIN32__
+ // For some reason, under Win95, the text edit control has
+ // a lot of space before the first character
+ new_width += 3*cx;
+#endif
+ // The height needs to be a bit bigger under Win95 if using native
+ // 3D effects.
+ valueHeight = (int) (valueHeight * 1.5) ;
+ MoveWindow((HWND) m_staticValue, x_offset, y_offset, new_width, valueHeight, TRUE);
+ x_offset += new_width + cx;
+ }
+
+ MoveWindow((HWND) m_staticMin, x_offset, y_offset, (int)min_len, cy, TRUE);
+ x_offset += (int)(min_len + cx);
+
+ int slider_length = (int)(w1 - x_offset - max_len - cx);
+
+ int slider_height = h1;
+ if (slider_height < 0 )
+ slider_height = 20;
+
+ // Slider must have a minimum/default length/height
+ if (slider_length < 100)
+ slider_length = 100;
+
+ MoveWindow(GetHwnd(), x_offset, y_offset, slider_length, slider_height, TRUE);
+ x_offset += slider_length + cx;
+
+ MoveWindow((HWND) m_staticMax, x_offset, y_offset, (int)max_len, cy, TRUE);
+ }
+ else
+ {
+ // No labels
+ // If we're prepared to use the existing size, then...
+ if (width == -1 && height == -1 && ((sizeFlags & wxSIZE_AUTO) != wxSIZE_AUTO))
+ {
+ GetSize(&w1, &h1);
+ }
+ if ( w1 < 0 )
+ w1 = 200;
+ if ( h1 < 0 )
+ h1 = 20;
+ MoveWindow(GetHwnd(), x1, y1, w1, h1, TRUE);
+ }
+ }
+ else
+ {
+ if ( m_windowStyle & wxSL_LABELS )
+ {
+ int min_len;
+ GetWindowText((HWND) m_staticMin, buf, 300);
+ GetTextExtent(buf, &min_len, &cyf,NULL,NULL, & this->GetFont());
+
+ int max_len;
+ GetWindowText((HWND) m_staticMax, buf, 300);
+ GetTextExtent(buf, &max_len, &cyf,NULL,NULL, & this->GetFont());
+
+ if (m_staticValue)
+ {
+ int new_width = (int)(wxMax(min_len, max_len));
+ int valueHeight = (int)cyf;
+//// Suggested change by George Tasker - remove this block...
+#ifdef __WIN32__
+ // For some reason, under Win95, the text edit control has
+ // a lot of space before the first character
+ new_width += 3*cx;
+#endif
+ ... and replace with following line:
+ new_width += cx;
+
+ // The height needs to be a bit bigger under Win95 if using native
+ // 3D effects.
+ valueHeight = (int) (valueHeight * 1.5) ;
+
+ MoveWindow((HWND) m_staticValue, x_offset, y_offset, new_width, valueHeight, TRUE);
+ y_offset += valueHeight;
+ }
+
+ MoveWindow((HWND) m_staticMin, x_offset, y_offset, (int)min_len, cy, TRUE);
+ y_offset += cy;
+
+ int slider_length = (int)(h1 - y_offset - cy - cy);
+
+ int slider_width = w1;
+ if (slider_width < 0 )
+ slider_width = 20;
+
+ // Slider must have a minimum/default length
+ if (slider_length < 100)
+ slider_length = 100;
+
+ MoveWindow(GetHwnd(), x_offset, y_offset, slider_width, slider_length, TRUE);
+ y_offset += slider_length;
+
+ MoveWindow((HWND) m_staticMax, x_offset, y_offset, (int)max_len, cy, TRUE);
+ }
+ else
+ {
+ // No labels
+ // If we're prepared to use the existing size, then...
+ if (width == -1 && height == -1 && ((sizeFlags & wxSIZE_AUTO) != wxSIZE_AUTO))
+ {
+ GetSize(&w1, &h1);
+ }
+ if ( w1 < 0 )
+ w1 = 20;
+ if ( h1 < 0 )
+ h1 = 200;
+ MoveWindow(GetHwnd(), x1, y1, w1, h1, TRUE);
+ }
+ }
+*/
}
void wxSlider::SetRange(int minValue, int maxValue)
// TODO
}
+WXHBRUSH wxSlider::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
+ WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
+{
+ // TODO:
+/*
+ if ( nCtlColor == CTLCOLOR_SCROLLBAR )
+ return 0;
+
+ // Otherwise, it's a static
+ if (GetParent()->GetTransparentBackground())
+ SetBkMode((HDC) pDC, TRANSPARENT);
+ else
+ SetBkMode((HDC) pDC, OPAQUE);
+
+ ::SetBkColor((HDC) pDC, RGB(GetBackgroundColour().Red(), GetBackgroundColour().Green(), GetBackgroundColour().Blue()));
+ ::SetTextColor((HDC) pDC, RGB(GetForegroundColour().Red(), GetForegroundColour().Green(), GetForegroundColour().Blue()));
+
+ wxBrush *backgroundBrush = wxTheBrushList->FindOrCreateBrush(GetBackgroundColour(), wxSOLID);
+ return (WXHBRUSH) backgroundBrush->GetResourceHandle();
+*/
+ return (WXHBRUSH)0;
+}
+
// For trackbars only
void wxSlider::SetTickFreq(int n, int pos)
{
// TODO
}
+bool wxSlider::ContainsHWND(WXHWND hWnd) const
+{
+ return ( hWnd == GetStaticMin() || hWnd == GetStaticMax() || hWnd == GetEditValue() );
+}
+
void wxSlider::Command (wxCommandEvent & event)
{
SetValue (event.GetInt());
/////////////////////////////////////////////////////////////////////////////
// Name: spinbutt.cpp
// Purpose: wxSpinButton
-// Author: AUTHOR
+// Author: David Webster
// Modified by:
-// Created: ??/??/98
+// Created: 10/15/99
// RCS-ID: $Id$
-// Copyright: (c) AUTHOR
-// Licence: wxWindows licence
+// Copyright: (c) David Webster
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
-#pragma implementation "spinbutt.h"
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+
+#ifndef WX_PRECOMP
+ #include "wx/wx.h"
#endif
+// Can't resolve reference to CreateUpDownControl in
+// TWIN32, but could probably use normal CreateWindow instead.
+
+
#include "wx/spinbutt.h"
+#include "wx/os2/private.h"
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// wxWin macros
+// ----------------------------------------------------------------------------
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxSpinButton, wxControl)
#endif
-wxSpinButton::wxSpinButton()
-{
- m_min = 0;
- m_max = 100;
-}
-
-bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
- long style, const wxString& name)
+bool wxSpinButton::Create(
+ wxWindow* parent
+, wxWindowID id
+, const wxPoint& pos
+, const wxSize& size
+, long style
+, const wxString& name
+)
{
SetName(name);
{
}
+// ----------------------------------------------------------------------------
+// size calculation
+// ----------------------------------------------------------------------------
+
+wxSize wxSpinButton::DoGetBestSize()
+{
+ // TODO:
+/*
+ if ( (GetWindowStyle() & wxSP_VERTICAL) != 0 )
+ {
+ // vertical control
+ return wxSize(GetSystemMetrics(SM_CXVSCROLL),
+ 2*GetSystemMetrics(SM_CYVSCROLL));
+ }
+ else
+ {
+ // horizontal control
+ return wxSize(2*GetSystemMetrics(SM_CXHSCROLL),
+ GetSystemMetrics(SM_CYHSCROLL));
+ }
+*/
+ return wxSize(0, 0);
+}
+
+// ----------------------------------------------------------------------------
// Attributes
-////////////////////////////////////////////////////////////////////////////
+// ----------------------------------------------------------------------------
int wxSpinButton::GetValue() const
{
- // TODO
+ // TODO
return 0;
}
void wxSpinButton::SetValue(int val)
{
- // TODO
+ // TODO
}
void wxSpinButton::SetRange(int minVal, int maxVal)
{
- m_min = minVal;
- m_max = maxVal;
- // TODO
+ // TODO
}
-// Spin event
-IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxScrollEvent)
+bool wxSpinButton::OS2OnScroll(int orientation, WXWORD wParam,
+ WXWORD pos, WXHWND control)
+{
+ wxCHECK_MSG( control, FALSE, wxT("scrolling what?") )
+// TODO:
+/*
+ if ( wParam != SB_THUMBPOSITION )
+ {
+ // probable SB_ENDSCROLL - we don't react to it
+ return FALSE;
+ }
+
+ wxSpinEvent event(wxEVT_SCROLL_THUMBTRACK, m_windowId);
+ event.SetPosition((short)pos); // cast is important for negative values!
+ event.SetEventObject(this);
+
+ return GetEventHandler()->ProcessEvent(event);
+*/
+ return FALSE;
+}
+
+bool wxSpinButton::OS2OnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
+{
+ // TODO:
+/*
+ LPNM_UPDOWN lpnmud = (LPNM_UPDOWN)lParam;
+
+ wxSpinEvent event(lpnmud->iDelta > 0 ? wxEVT_SCROLL_LINEUP
+ : wxEVT_SCROLL_LINEDOWN,
+ m_windowId);
+ event.SetPosition(lpnmud->iPos + lpnmud->iDelta);
+ event.SetEventObject(this);
-wxSpinEvent::wxSpinEvent(wxEventType commandType, int id):
- wxScrollEvent(commandType, id)
+ bool processed = GetEventHandler()->ProcessEvent(event);
+
+ *result = event.IsAllowed() ? 0 : 1;
+
+ return processed;
+*/
+ return FALSE;
+}
+
+bool wxSpinButton::MSWCommand(WXUINT cmd, WXWORD id)
{
+ // No command messages
+ return FALSE;
}
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: msw/spinctrl.cpp
+// Purpose: wxSpinCtrl class implementation for Win32
+// Author: David Webster
+// Modified by:
+// Created: 10/15/99
+// RCS-ID: $Id$
+// Copyright: (c) David Webster
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+// for compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+
+#ifndef WX_PRECOMP
+ #include "wx/wx.h"
+#endif
+
+#include "wx/spinctrl.h"
+#include "wx/os2/private.h"
+
+// ----------------------------------------------------------------------------
+// macros
+// ----------------------------------------------------------------------------
+
+#if !USE_SHARED_LIBRARY
+ IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrl, wxControl)
+#endif
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// the margin between the up-down control and its buddy
+static const int MARGIN_BETWEEN = 5;
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// construction
+// ----------------------------------------------------------------------------
+
+bool wxSpinCtrl::Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style,
+ int min, int max, int initial,
+ const wxString& name)
+{
+ // TODO:
+/*
+ // before using DoGetBestSize(), have to set style to let the base class
+ // know whether this is a horizontal or vertical control (we're always
+ // vertical)
+ SetWindowStyle(style | wxSP_VERTICAL);
+
+ // calculate the sizes: the size given is the toal size for both controls
+ // and we need to fit them both in the given width (height is the same)
+ wxSize sizeText(size), sizeBtn(size);
+ sizeBtn.x = wxSpinButton::DoGetBestSize().x;
+ sizeText.x -= sizeBtn.x + MARGIN_BETWEEN;
+ if ( sizeText.x <= 0 )
+ {
+ wxLogDebug(_T("not enough space for wxSpinCtrl!"));
+ }
+
+ wxPoint posBtn(pos);
+ posBtn.x += sizeText.x + MARGIN_BETWEEN;
+
+ // create the spin button
+ if ( !wxSpinButton::Create(parent, id, posBtn, sizeBtn, style, name) )
+ {
+ return FALSE;
+ }
+
+ SetRange(min, max);
+ SetValue(initial);
+
+ // create the text window
+ if ( sizeText.y <= 0 )
+ {
+ // make it the same height as the button then
+ int x, y;
+ wxSpinButton::DoGetSize(&x, &y);
+
+ sizeText.y = y;
+ }
+
+ m_hwndBuddy = (WXHWND)::CreateWindowEx
+ (
+ WS_EX_CLIENTEDGE, // sunken border
+ _T("EDIT"), // window class
+ NULL, // no window title
+ WS_CHILD | WS_VISIBLE | WS_BORDER, // style
+ pos.x, pos.y, // position
+ sizeText.x, sizeText.y, // size
+ GetHwndOf(parent), // parent
+ (HMENU)-1, // control id
+ wxGetInstance(), // app instance
+ NULL // unused client data
+ );
+
+ if ( !m_hwndBuddy )
+ {
+ wxLogLastError("CreateWindow(buddy text window)");
+
+ return FALSE;
+ }
+
+ // should have the same font as the other controls
+ WXHANDLE hFont = GetParent()->GetFont().GetResourceHandle();
+ ::SendMessage((HWND)m_hwndBuddy, WM_SETFONT, (WPARAM)hFont, TRUE);
+
+ // associate the text window with the spin button
+ (void)SendMessage(GetHwnd(), UDM_SETBUDDY, (WPARAM)m_hwndBuddy, 0);
+*/
+ return FALSE;
+}
+
+// ----------------------------------------------------------------------------
+// size calculations
+// ----------------------------------------------------------------------------
+
+void wxSpinCtrl::DoMoveWindow(int x, int y, int width, int height)
+{
+ int widthBtn = DoGetBestSize().x;
+ int widthText = width - widthBtn - MARGIN_BETWEEN;
+ if ( widthText <= 0 )
+ {
+ wxLogDebug(_T("not enough space for wxSpinCtrl!"));
+ }
+// TODO:
+/*
+ if ( !::MoveWindow((HWND)m_hwndBuddy, x, y, widthText, height, TRUE) )
+ {
+ wxLogLastError("MoveWindow(buddy)");
+ }
+
+ x += widthText + MARGIN_BETWEEN;
+ if ( !::MoveWindow(GetHwnd(), x, y, widthBtn, height, TRUE) )
+ {
+ wxLogLastError("MoveWindow");
+ }
+*/
+}
/////////////////////////////////////////////////////////////////////////////
// Name: statbmp.cpp
// Purpose: wxStaticBitmap
-// Author: AUTHOR
+// Author: David Webster
// Modified by:
// Created: ??/??/98
// RCS-ID: $Id$
-// Copyright: (c) AUTHOR
-// Licence: wxWindows licence
+// Copyright: (c) David Webster
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
-#pragma implementation "statbmp.h"
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#include "wx/window.h"
+#include "wx/os2/private.h"
+
+#ifndef WX_PRECOMP
+ #include "wx/icon.h"
+ #include "wx/statbmp.h"
#endif
-#include "wx/statbmp.h"
+#include <stdio.h>
+
+// ---------------------------------------------------------------------------
+// macors
+// ---------------------------------------------------------------------------
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl)
#endif
-/*
- * wxStaticBitmap
- */
+// ---------------------------------------------------------------------------
+// wxStaticBitmap
+// ---------------------------------------------------------------------------
bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id,
const wxBitmap& bitmap,
if (parent) parent->AddChild(this);
if ( id == -1 )
- m_windowId = (int)NewControlId();
+ m_windowId = (int)NewControlId();
else
- m_windowId = id;
+ m_windowId = id;
m_windowStyle = style;
return FALSE;
}
-void wxStaticBitmap::SetSize(int x, int y, int width, int height, int sizeFlags)
+bool wxStaticBitmap::ImageIsOk() const
{
- // TODO
+ if ( m_isIcon && m_image.icon )
+ return m_image.icon->Ok();
+ else if ( m_image.bitmap )
+ return m_image.bitmap->Ok();
+ else
+ return FALSE;
+}
+
+void wxStaticBitmap::Free()
+{
+ if ( m_isIcon )
+ delete m_image.icon;
+ else
+ delete m_image.bitmap;
+
+ m_image.icon = NULL;
+}
+
+wxSize wxStaticBitmap::DoGetBestSize()
+{
+ // reuse the current size (as wxWindow does) instead of using some
+ // arbitrary default size (as wxControl, our immediate base class, does)
+ return wxWindow::DoGetBestSize();
}
void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
{
- m_messageBitmap = bitmap;
+ Free();
+
+ m_isIcon = bitmap.IsKindOf(CLASSINFO(wxIcon));
+ if ( m_isIcon )
+ m_image.icon = new wxIcon((const wxIcon&)bitmap);
+ else
+ m_image.bitmap = new wxBitmap(bitmap);
+
+ int x, y;
+ int w, h;
+ GetPosition(&x, &y);
+ GetSize(&w, &h);
// TODO: redraw bitmap
}
+
/////////////////////////////////////////////////////////////////////////////
// Name: statbox.cpp
// Purpose: wxStaticBox
-// Author: AUTHOR
+// Author: David Webster
// Modified by:
// Created: ??/??/98
// RCS-ID: $Id$
-// Copyright: (c) AUTHOR
-// Licence: wxWindows licence
+// Copyright: (c) David Webster
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
-#pragma implementation "statbox.h"
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#include "wx/window.h"
+#include "wx/os2/private.h"
+
+#ifndef WX_PRECOMP
+#include "wx/app.h"
+#include "wx/dcclient.h"
#endif
#include "wx/statbox.h"
IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl)
BEGIN_EVENT_TABLE(wxStaticBox, wxControl)
- EVT_ERASE_BACKGROUND(wxStaticBox::OnEraseBackground)
+ EVT_ERASE_BACKGROUND(wxStaticBox::OnEraseBackground)
END_EVENT_TABLE()
#endif
/*
- * Static box
+ * Group box
*/
bool wxStaticBox::Create(wxWindow *parent, wxWindowID id,
long style,
const wxString& name)
{
- SetName(name);
+ SetName(name);
- if (parent) parent->AddChild(this);
+ if (parent) parent->AddChild(this);
- if ( id == -1 )
- m_windowId = (int)NewControlId();
- else
- m_windowId = id;
+ SetBackgroundColour(parent->GetBackgroundColour()) ;
+ SetForegroundColour(parent->GetForegroundColour()) ;
+
+ if ( id == -1 )
+ m_windowId = (int)NewControlId();
+ else
+ m_windowId = id;
+
+ int x = pos.x;
+ int y = pos.y;
+ int width = size.x;
+ int height = size.y;
+
+ m_windowStyle = style;
+
+// TODO:
+/*
+ long msStyle = BS_GROUPBOX | WS_CHILD | WS_VISIBLE ; // GROUP_FLAGS;
+
+ bool want3D;
+ WXDWORD exStyle = Determine3DEffects(0, &want3D) ;
+
+ HWND wx_button =
+ CreateWindowEx(exStyle, wxT("BUTTON"), (const wxChar *)label, msStyle,
+ 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId,
+ wxGetInstance(), NULL);
+#if wxUSE_CTL3D
+ if (want3D)
+ {
+ Ctl3dSubclassCtl(wx_button);
+ m_useCtl3D = TRUE;
+ }
+#endif
+
+ m_hWnd = (WXHWND)wx_button;
+
+ // Subclass again for purposes of dialog editing mode
+ SubclassWin(GetHWND());
+
+ SetFont(parent->GetFont());
+
+ SetSize(x, y, width, height);
+ ShowWindow(wx_button, SW_SHOW);
+*/
+ return FALSE;
+}
+
+wxSize wxStaticBox::DoGetBestSize()
+{
+ int cx, cy;
+ wxGetCharSize(GetHWND(), &cx, &cy, &GetFont());
+
+ int wBox;
+ GetTextExtent(wxGetWindowText(m_hWnd), &wBox, &cy);
- m_windowStyle = style;
+ wBox += 3*cx;
+ int hBox = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy);
- // TODO: create static box
- return FALSE;
+ return wxSize(wBox, hBox);
}
-void wxStaticBox::SetLabel(const wxString& label)
+WXHBRUSH wxStaticBox::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
+ WXUINT message,
+ WXWPARAM wParam,
+ WXLPARAM lParam)
{
- // TODO
+ // TODO:
+/*
+ if (GetParent()->GetTransparentBackground())
+ SetBkMode((HDC) pDC, TRANSPARENT);
+ else
+ SetBkMode((HDC) pDC, OPAQUE);
+
+ ::SetBkColor((HDC) pDC, RGB(GetBackgroundColour().Red(), GetBackgroundColour().Green(), GetBackgroundColour().Blue()));
+ ::SetTextColor((HDC) pDC, RGB(GetForegroundColour().Red(), GetForegroundColour().Green(), GetForegroundColour().Blue()));
+
+ wxBrush *backgroundBrush = wxTheBrushList->FindOrCreateBrush(GetBackgroundColour(), wxSOLID);
+
+ // Note that this will be cleaned up in wxApp::OnIdle, if backgroundBrush
+ // has a zero usage count.
+// backgroundBrush->RealizeResource();
+ return (WXHBRUSH) backgroundBrush->GetResourceHandle();
+*/
+ return (WXHBRUSH)0;
}
-void wxStaticBox::SetSize(int x, int y, int width, int height, int sizeFlags)
+// Shouldn't erase the whole window, since the static box must only paint its
+// outline.
+void wxStaticBox::OnEraseBackground(wxEraseEvent& event)
{
- // TODO
+ // If we don't have this (call Default()), we don't paint the background properly.
+ // If we do have this, we seem to overwrite enclosed controls.
+ // Is it the WS_CLIPCHILDREN style that's causing the problems?
+ // Probably - without this style, the background of the window will show through,
+ // so the control doesn't have to paint it. The window background will always be
+ // painted before all other controls, therefore there are no problems with
+ // controls being hidden by the static box.
+ // So, if we could specify wxCLIP_CHILDREN in window, or not, we could optimise painting better.
+ // We would assume wxCLIP_CHILDREN in a frame and a scrolled window, but not in a panel.
+ // Is this too platform-specific?? What else can we do? Not a lot, since we have to pass
+ // this information from arbitrary wxWindow derivatives, and it depends on what you wish to
+ // do with the windows.
+ // Alternatively, just make sure that wxStaticBox is always at the back! There are probably
+ // few other circumstances where it matters about child clipping. But what about painting onto
+ // to panel, inside a groupbox? Doesn't appear, because the box wipes it out.
+ wxWindow *parent = GetParent();
+// TODO:
+/*
+ if ( parent && parent->GetHWND() && (::GetWindowLong((HWND) parent->GetHWND(), GWL_STYLE) & WS_CLIPCHILDREN) )
+ {
+ // TODO: May in fact need to generate a paint event for inside this
+ // control's rectangle, otherwise all controls are going to be clipped -
+ // ugh.
+ HBRUSH hBrush = ::CreateSolidBrush(PALETTERGB(GetBackgroundColour().Red(), GetBackgroundColour().Green(), GetBackgroundColour().Blue()));
+ int mode = ::SetMapMode((HDC) event.GetDC()->GetHDC(), MM_TEXT);
+
+ RECT rect;
+
+ ::GetClientRect(GetHwnd(), &rect);
+ ::FillRect ((HDC) event.GetDC()->GetHDC(), &rect, hBrush);
+ ::DeleteObject(hBrush);
+ ::SetMapMode((HDC) event.GetDC()->GetHDC(), mode);
+ }
+ else
+ {
+ event.Skip();
+ }
+*/
+}
+
+MRESULT wxStaticBox::OS2WindowProc(HWND hwnd, WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
+{
+ if ( nMsg == WM_NCHITTEST)
+ {
+ int xPos = LOWORD(lParam); // horizontal position of cursor
+ int yPos = HIWORD(lParam); // vertical position of cursor
+
+// ScreenToClient(&xPos, &yPos);
+
+ // Make sure you can drag by the top of the groupbox, but let
+ // other (enclosed) controls get mouse events also
+ if (yPos < 10)
+ return (long)HTCLIENT;
+ }
+
+ return wxControl::OS2WindowProc(hwnd, nMsg, wParam, lParam);
}
+