OS/2 common controls code
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13065 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -18,52 +18,68 @@ WXDLLEXPORT_DATA(extern const char*) wxGaugeNameStr;
|
|||||||
|
|
||||||
class WXDLLEXPORT wxGauge: public wxControl
|
class WXDLLEXPORT wxGauge: public wxControl
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxGauge)
|
public:
|
||||||
public:
|
inline wxGauge() { m_nRangeMax = 0; m_nGaugePos = 0; }
|
||||||
inline wxGauge() { m_rangeMax = 0; m_gaugePos = 0; }
|
|
||||||
|
|
||||||
inline wxGauge(wxWindow *parent, wxWindowID id,
|
inline wxGauge( wxWindow* pParent
|
||||||
int range,
|
,wxWindowID vId
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
,int nRange
|
||||||
const wxSize& size = wxDefaultSize,
|
,const wxPoint& rPos = wxDefaultPosition
|
||||||
long style = wxGA_HORIZONTAL,
|
,const wxSize& rSize = wxDefaultSize
|
||||||
|
,long lStyle = wxGA_HORIZONTAL
|
||||||
#if wxUSE_VALIDATORS
|
#if wxUSE_VALIDATORS
|
||||||
const wxValidator& validator = wxDefaultValidator,
|
,const wxValidator& rValidator = wxDefaultValidator
|
||||||
#endif
|
#endif
|
||||||
const wxString& name = wxGaugeNameStr)
|
,const wxString& rsName = wxGaugeNameStr
|
||||||
{
|
)
|
||||||
Create(parent, id, range, pos, size, style, validator, name);
|
{
|
||||||
}
|
Create( pParent
|
||||||
|
,vId
|
||||||
bool Create(wxWindow *parent, wxWindowID id,
|
,nRange
|
||||||
int range,
|
,rPos
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
,rSize
|
||||||
const wxSize& size = wxDefaultSize,
|
,lStyle
|
||||||
long style = wxGA_HORIZONTAL,
|
|
||||||
#if wxUSE_VALIDATORS
|
#if wxUSE_VALIDATORS
|
||||||
const wxValidator& validator = wxDefaultValidator,
|
,rValidator
|
||||||
#endif
|
#endif
|
||||||
const wxString& name = wxGaugeNameStr);
|
,rsName
|
||||||
|
);
|
||||||
void SetShadowWidth(int w);
|
}
|
||||||
void SetBezelFace(int w);
|
|
||||||
void SetRange(int r);
|
|
||||||
void SetValue(int pos);
|
|
||||||
|
|
||||||
int GetShadowWidth() const ;
|
|
||||||
int GetBezelFace() const ;
|
|
||||||
int GetRange() const ;
|
|
||||||
int GetValue() const ;
|
|
||||||
|
|
||||||
bool SetForegroundColour(const wxColour& col);
|
|
||||||
bool SetBackgroundColour(const wxColour& col);
|
|
||||||
|
|
||||||
virtual void Command(wxCommandEvent& WXUNUSED(event)) {} ;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
int m_rangeMax;
|
|
||||||
int m_gaugePos;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
bool Create( wxWindow* pParent
|
||||||
|
,wxWindowID vId
|
||||||
|
,int nRange
|
||||||
|
,const wxPoint& rPos = wxDefaultPosition
|
||||||
|
,const wxSize& rSize = wxDefaultSize
|
||||||
|
,long lStyle = wxGA_HORIZONTAL
|
||||||
|
#if wxUSE_VALIDATORS
|
||||||
|
,const wxValidator& rValidator = wxDefaultValidator
|
||||||
#endif
|
#endif
|
||||||
// _WX_GAUGE_H_
|
,const wxString& rsName = wxGaugeNameStr
|
||||||
|
);
|
||||||
|
|
||||||
|
int GetShadowWidth(void) const;
|
||||||
|
int GetBezelFace(void) const;
|
||||||
|
int GetRange(void) const;
|
||||||
|
int GetValue(void) const;
|
||||||
|
|
||||||
|
bool SetBackgroundColour(const wxColour& rColour);
|
||||||
|
void SetBezelFace(int nWidth);
|
||||||
|
bool SetForegroundColour(const wxColour& rColour);
|
||||||
|
void SetRange(int nRange);
|
||||||
|
void SetShadowWidth(int nWidth);
|
||||||
|
void SetValue(int nPos);
|
||||||
|
|
||||||
|
inline virtual bool AcceptsFocus(void) const { return FALSE; }
|
||||||
|
inline virtual void Command(wxCommandEvent& WXUNUSED(rEvent)) {};
|
||||||
|
|
||||||
|
protected:
|
||||||
|
int m_nRangeMax;
|
||||||
|
int m_nGaugePos;
|
||||||
|
|
||||||
|
private:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxGauge)
|
||||||
|
}; // end of CLASS wxGauge
|
||||||
|
|
||||||
|
#endif // _WX_GAUGE_H_
|
||||||
|
|
||||||
|
@@ -232,6 +232,10 @@ inline bool wxStyleHasBorder(long style)
|
|||||||
wxSUNKEN_BORDER | wxDOUBLE_BORDER)) != 0;
|
wxSUNKEN_BORDER | wxDOUBLE_BORDER)) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WXDLLEXPORT extern void wxOS2SetFont( HWND hWnd
|
||||||
|
,const wxFont& rFont
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// _WX_PRIVATE_H_
|
// _WX_PRIVATE_H_
|
||||||
|
@@ -19,105 +19,168 @@ class WXDLLEXPORT wxBitmap ;
|
|||||||
|
|
||||||
class WXDLLEXPORT wxRadioBox: public wxControl, public wxRadioBoxBase
|
class WXDLLEXPORT wxRadioBox: public wxControl, public wxRadioBoxBase
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxRadioBox)
|
|
||||||
public:
|
public:
|
||||||
wxRadioBox();
|
wxRadioBox();
|
||||||
|
|
||||||
inline wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title,
|
inline wxRadioBox( wxWindow* pParent
|
||||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
,wxWindowID vId
|
||||||
int n = 0, const wxString choices[] = NULL,
|
,const wxString& rsTitle
|
||||||
int majorDim = 0, long style = wxRA_HORIZONTAL,
|
,const wxPoint& rPos = wxDefaultPosition
|
||||||
|
,const wxSize& rSize = wxDefaultSize
|
||||||
|
,int nNum = 0
|
||||||
|
,const wxString asChoices[] = NULL
|
||||||
|
,int nMajorDim = 0
|
||||||
|
,long lStyle = wxRA_HORIZONTAL
|
||||||
#if wxUSE_VALIDATORS
|
#if wxUSE_VALIDATORS
|
||||||
const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr)
|
,const wxValidator& rVal = wxDefaultValidator
|
||||||
#endif
|
#endif
|
||||||
{
|
,const wxString& rsName = wxRadioBoxNameStr
|
||||||
Create(parent, id, title, pos, size, n, choices, majorDim, style, val, name);
|
)
|
||||||
}
|
{
|
||||||
|
Create( pParent
|
||||||
~wxRadioBox();
|
,vId
|
||||||
|
,rsTitle
|
||||||
bool Create(wxWindow *parent, wxWindowID id, const wxString& title,
|
,rPos
|
||||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
,rSize
|
||||||
int n = 0, const wxString choices[] = NULL,
|
,nNum
|
||||||
int majorDim = 0, long style = wxRA_HORIZONTAL,
|
,asChoices
|
||||||
|
,nMajorDim
|
||||||
|
,lStyle
|
||||||
#if wxUSE_VALIDATORS
|
#if wxUSE_VALIDATORS
|
||||||
const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr);
|
,rVal
|
||||||
#endif
|
#endif
|
||||||
|
,rsName
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
virtual bool OS2Command(WXUINT param, WXWORD id);
|
~wxRadioBox();
|
||||||
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
|
||||||
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
|
||||||
|
|
||||||
int FindString(const wxString& s) const;
|
bool Create( wxWindow* pParent
|
||||||
void SetSelection(int N);
|
,wxWindowID vId
|
||||||
int GetSelection() const;
|
,const wxString& rsTitle
|
||||||
virtual int GetCount() const;
|
,const wxPoint& rPos = wxDefaultPosition
|
||||||
wxString GetString(int N) const;
|
,const wxSize& rSize = wxDefaultSize
|
||||||
virtual void SetString(int n, const wxString& label);
|
,int nNum = 0
|
||||||
virtual int GetColumnCount() const;
|
,const wxString asChoices[] = NULL
|
||||||
virtual int GetRowCount() const;
|
,int nMajorDim = 0
|
||||||
|
,long lStyle = wxRA_HORIZONTAL
|
||||||
|
#if wxUSE_VALIDATORS
|
||||||
|
,const wxValidator& rVal = wxDefaultValidator
|
||||||
|
#endif
|
||||||
|
,const wxString& rsName = wxRadioBoxNameStr
|
||||||
|
);
|
||||||
|
|
||||||
void GetSize(int *x, int *y) const;
|
void Command(wxCommandEvent& rEvent);
|
||||||
void GetPosition(int *x, int *y) const;
|
bool ContainsHWND(WXHWND hWnd) const;
|
||||||
|
bool Enable(bool bEnable);
|
||||||
|
void Enable( int nItem
|
||||||
|
,bool bEnable
|
||||||
|
);
|
||||||
|
int FindString(const wxString& sStr) const;
|
||||||
|
|
||||||
void SetLabel(int item, const wxString& label);
|
virtual WXHBRUSH OnCtlColor( WXHDC hDC
|
||||||
void SetLabel(int item, wxBitmap *bitmap);
|
,WXHWND hWnd
|
||||||
wxString GetLabel(int item) const;
|
,WXUINT uCtlColor
|
||||||
bool Show(bool show);
|
,WXUINT uMessage
|
||||||
void SetFocus();
|
,WXWPARAM wParam
|
||||||
bool Enable(bool enable);
|
,WXLPARAM lParam
|
||||||
void Enable(int item, bool enable);
|
);
|
||||||
void Show(int item, bool show) ;
|
virtual bool OS2Command( WXUINT uParam
|
||||||
inline void SetLabelFont(const wxFont& WXUNUSED(font)) {};
|
,WXWORD wId
|
||||||
inline void SetButtonFont(const wxFont& font) { SetFont(font); }
|
);
|
||||||
|
void SendNotificationEvent(void);
|
||||||
|
void Show( int nItem
|
||||||
|
,bool bShow = TRUE
|
||||||
|
) ;
|
||||||
|
bool Show(bool bShow);
|
||||||
|
MRESULT WindowProc( WXUINT uMsg
|
||||||
|
,WXWPARAM wParam
|
||||||
|
,WXLPARAM lParam
|
||||||
|
);
|
||||||
|
|
||||||
virtual wxString GetStringSelection() const;
|
|
||||||
virtual bool SetStringSelection(const wxString& s);
|
|
||||||
inline virtual int Number() const { return m_noItems; } ;
|
|
||||||
void Command(wxCommandEvent& event);
|
|
||||||
|
|
||||||
inline int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; }
|
|
||||||
inline void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; }
|
|
||||||
|
|
||||||
// implementation only from now on
|
|
||||||
// -------------------------------
|
|
||||||
|
|
||||||
WXHWND *GetRadioButtons() const { return m_radioButtons; }
|
virtual int GetColumnCount(void) const;
|
||||||
bool ContainsHWND(WXHWND hWnd) const;
|
virtual int GetCount(void) const;
|
||||||
void SendNotificationEvent();
|
inline int GetNumberOfRowsOrCols(void) const { return m_nNoRowsOrCols; }
|
||||||
|
int GetNumHor(void) const;
|
||||||
|
int GetNumVer(void) const;
|
||||||
|
void GetPosition( int* pnX
|
||||||
|
,int* pnY
|
||||||
|
) const;
|
||||||
|
inline WXHWND* GetRadioButtons(void) const { return m_ahRadioButtons; }
|
||||||
|
virtual int GetRowCount(void) const;
|
||||||
|
int GetSelection(void) const;
|
||||||
|
void GetSize( int* pnX
|
||||||
|
,int* pnY
|
||||||
|
) const;
|
||||||
|
void GetSizeFlags(void) const;
|
||||||
|
void AdjustButtons( int nX
|
||||||
|
,int nY
|
||||||
|
,int nWidth
|
||||||
|
,int nHeight
|
||||||
|
,int lSizeFlags
|
||||||
|
);
|
||||||
|
wxString GetString(int nIndex) const;
|
||||||
|
virtual wxString GetStringSelection(void) const;
|
||||||
|
|
||||||
// get the number of buttons per column/row
|
inline void SetButtonFont(const wxFont& rFont) { SetFont(rFont); }
|
||||||
int GetNumVer() const;
|
void SetFocus(void);
|
||||||
int GetNumHor() const;
|
virtual bool SetFont(const wxFont& rFont);
|
||||||
|
inline void SetLabelFont(const wxFont& WXUNUSED(font)) {};
|
||||||
|
inline void SetNumberOfRowsOrCols(int nNum) { m_nNoRowsOrCols = nNum; }
|
||||||
|
void SetSelection(int nIndex);
|
||||||
|
virtual void SetString( int nNum
|
||||||
|
,const wxString& rsLabel
|
||||||
|
);
|
||||||
|
virtual bool SetStringSelection(const wxString& rsStr);
|
||||||
|
|
||||||
|
void SetLabel( int nItem
|
||||||
|
,const wxString& rsLabel
|
||||||
|
);
|
||||||
|
void SetLabel( int item
|
||||||
|
,wxBitmap* pBitmap
|
||||||
|
);
|
||||||
|
wxString GetLabel(int nItem) const;
|
||||||
|
|
||||||
#if WXWIN_COMPATIBILITY
|
|
||||||
wxRadioBox(wxWindow *parent, wxFunction func, const char *title,
|
|
||||||
int x = -1, int y = -1, int width = -1, int height = -1,
|
|
||||||
int n = 0, char **choices = NULL,
|
|
||||||
int majorDim = 0, long style = wxRA_HORIZONTAL, const char *name = wxRadioBoxNameStr);
|
|
||||||
#endif // WXWIN_COMPATIBILITY
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void SubclassRadioButton(WXHWND hWndBtn);
|
void AdjustButtons( int nX
|
||||||
|
,int nY
|
||||||
|
,int nWidth
|
||||||
|
,int nHeight
|
||||||
|
,long lSizeFlags
|
||||||
|
);
|
||||||
|
virtual wxSize DoGetBestSize(void) const;
|
||||||
|
virtual void DoSetSize( int nX
|
||||||
|
,int nY
|
||||||
|
,int nWidth
|
||||||
|
,int nHeight
|
||||||
|
,int nSizeFlags = wxSIZE_AUTO
|
||||||
|
);
|
||||||
|
wxSize GetMaxButtonSize(void) const;
|
||||||
|
wxSize GetTotalButtonSize(const wxSize& rSizeBtn) const;
|
||||||
|
void SubclassRadioButton(WXHWND hWndBtn);
|
||||||
|
|
||||||
WXHWND * m_radioButtons;
|
|
||||||
int m_majorDim ;
|
|
||||||
int * m_radioWidth; // for bitmaps
|
|
||||||
int * m_radioHeight;
|
|
||||||
|
|
||||||
int m_noItems;
|
WXHWND* m_ahRadioButtons;
|
||||||
int m_noRowsOrCols;
|
int m_nMajorDim ;
|
||||||
int m_selectedButton;
|
int* m_pnRadioWidth; // for bitmaps
|
||||||
|
int* m_pnRadioHeight;
|
||||||
|
int m_nNoItems;
|
||||||
|
int m_nNoRowsOrCols;
|
||||||
|
int m_nSelectedButton;
|
||||||
|
int m_nSizeFlags;
|
||||||
|
|
||||||
virtual void DoSetSize(int x, int y,
|
|
||||||
int width, int height,
|
|
||||||
int sizeFlags = wxSIZE_AUTO);
|
|
||||||
private:
|
private:
|
||||||
virtual void SetLabel(const wxString& label)
|
inline wxString GetLabel() const
|
||||||
{ wxWindowBase::SetLabel(label); }
|
{ return wxWindowBase::GetLabel(); }
|
||||||
wxString GetLabel() const
|
inline void SetLabel(const wxString& rsLabel)
|
||||||
{ return(wxWindowBase::GetLabel()); }
|
{ wxWindowBase::SetLabel(rsLabel); }
|
||||||
};
|
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxRadioBox)
|
||||||
|
}; // end of wxRadioBox
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// _WX_RADIOBOX_H_
|
// _WX_RADIOBOX_H_
|
||||||
|
@@ -18,38 +18,55 @@ WXDLLEXPORT_DATA(extern const char*) wxRadioButtonNameStr;
|
|||||||
|
|
||||||
class WXDLLEXPORT wxRadioButton: public wxControl
|
class WXDLLEXPORT wxRadioButton: public wxControl
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxRadioButton)
|
public:
|
||||||
protected:
|
inline wxRadioButton() {}
|
||||||
public:
|
inline wxRadioButton( wxWindow* pParent
|
||||||
inline wxRadioButton() {}
|
,wxWindowID vId
|
||||||
inline wxRadioButton(wxWindow *parent, wxWindowID id,
|
,const wxString& rsLabel
|
||||||
const wxString& label,
|
,const wxPoint& rPos = wxDefaultPosition
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
,const wxSize& rSize = wxDefaultSize
|
||||||
const wxSize& size = wxDefaultSize, long style = 0,
|
,long lStyle = 0
|
||||||
#if wxUSE_VALIDATORS
|
#if wxUSE_VALIDATORS
|
||||||
const wxValidator& validator = wxDefaultValidator,
|
,const wxValidator& rValidator = wxDefaultValidator
|
||||||
#endif
|
#endif
|
||||||
const wxString& name = wxRadioButtonNameStr)
|
,const wxString& rsName = wxRadioButtonNameStr
|
||||||
{
|
)
|
||||||
Create(parent, id, label, pos, size, style, validator, name);
|
{
|
||||||
}
|
Create( pParent
|
||||||
|
,vId
|
||||||
bool Create(wxWindow *parent, wxWindowID id,
|
,rsLabel
|
||||||
const wxString& label,
|
,rPos
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
,rSize
|
||||||
const wxSize& size = wxDefaultSize, long style = 0,
|
,lStyle
|
||||||
#if wxUSE_VALIDATORS
|
#if wxUSE_VALIDATORS
|
||||||
const wxValidator& validator = wxDefaultValidator,
|
,rValidator
|
||||||
#endif
|
#endif
|
||||||
const wxString& name = wxRadioButtonNameStr);
|
,rsName
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
virtual void SetLabel(const wxString& label);
|
bool Create( wxWindow* pParent
|
||||||
virtual void SetValue(bool val);
|
,wxWindowID vId
|
||||||
virtual bool GetValue() const ;
|
,const wxString& rsLabel
|
||||||
|
,const wxPoint& rPos = wxDefaultPosition
|
||||||
|
,const wxSize& rSize = wxDefaultSize
|
||||||
|
,long lStyle = 0
|
||||||
|
#if wxUSE_VALIDATORS
|
||||||
|
,const wxValidator& rValidator = wxDefaultValidator
|
||||||
|
#endif
|
||||||
|
,const wxString& rsName = wxRadioButtonNameStr
|
||||||
|
);
|
||||||
|
virtual void SetLabel(const wxString& rsLabel);
|
||||||
|
virtual void SetValue(bool bVal);
|
||||||
|
virtual bool GetValue(void) const ;
|
||||||
|
|
||||||
bool OS2Command(WXUINT param, WXWORD id);
|
bool OS2Command( WXUINT wParam
|
||||||
void Command(wxCommandEvent& event);
|
,WXWORD wId
|
||||||
};
|
);
|
||||||
|
void Command(wxCommandEvent& rEvent);
|
||||||
|
private:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxRadioButton)
|
||||||
|
}; // end of wxRadioButton
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// _WX_RADIOBUT_H_
|
// _WX_RADIOBUT_H_
|
||||||
|
@@ -376,5 +376,8 @@
|
|||||||
#define NO_TEXT_WINDOW_STREAM 1 // defined in textctrl.h for DLL builds
|
#define NO_TEXT_WINDOW_STREAM 1 // defined in textctrl.h for DLL builds
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define wxUSE_UNICODE 0
|
||||||
|
#define wxUSE_UNICODE_MSLU 0
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// _WX_SETUP_H_
|
// _WX_SETUP_H_
|
||||||
|
@@ -19,95 +19,135 @@ WXDLLEXPORT_DATA(extern const char*) wxSliderNameStr;
|
|||||||
// Slider
|
// Slider
|
||||||
class WXDLLEXPORT wxSlider: public wxSliderBase
|
class WXDLLEXPORT wxSlider: public wxSliderBase
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxSlider)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxSlider();
|
wxSlider();
|
||||||
|
inline wxSlider( wxWindow* pParent
|
||||||
inline wxSlider(wxWindow *parent, wxWindowID id,
|
,wxWindowID vId
|
||||||
int value, int minValue, int maxValue,
|
,int nValue
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
,int nMinValue
|
||||||
const wxSize& size = wxDefaultSize,
|
,int nMaxValue
|
||||||
long style = wxSL_HORIZONTAL,
|
,const wxPoint& rPos = wxDefaultPosition
|
||||||
|
,const wxSize& rSize = wxDefaultSize
|
||||||
|
,long lStyle = wxSL_HORIZONTAL
|
||||||
#if wxUSE_VALIDATORS
|
#if wxUSE_VALIDATORS
|
||||||
const wxValidator& validator = wxDefaultValidator,
|
,const wxValidator& rValidator = wxDefaultValidator
|
||||||
#endif
|
#endif
|
||||||
const wxString& name = wxSliderNameStr)
|
,const wxString& rsName = wxSliderNameStr
|
||||||
{
|
)
|
||||||
Create(parent, id, value, minValue, maxValue, pos, size, style, validator, name);
|
{
|
||||||
}
|
Create( pParent
|
||||||
|
,vId
|
||||||
~wxSlider();
|
,nValue
|
||||||
|
,nMinValue
|
||||||
bool Create(wxWindow *parent, wxWindowID id,
|
,nMaxValue
|
||||||
int value, int minValue, int maxValue,
|
,rPos
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
,rSize
|
||||||
const wxSize& size = wxDefaultSize,
|
,lStyle
|
||||||
long style = wxSL_HORIZONTAL,
|
|
||||||
#if wxUSE_VALIDATORS
|
#if wxUSE_VALIDATORS
|
||||||
const wxValidator& validator = wxDefaultValidator,
|
,rValidator
|
||||||
#endif
|
#endif
|
||||||
const wxString& name = wxSliderNameStr);
|
,rsName
|
||||||
|
);
|
||||||
|
}
|
||||||
|
~wxSlider();
|
||||||
|
|
||||||
virtual int GetValue() const ;
|
bool Create( wxWindow* pParent
|
||||||
virtual void SetValue(int);
|
,wxWindowID vId
|
||||||
|
,int nValue
|
||||||
|
,int nMinValue
|
||||||
|
,int nMaxValue
|
||||||
|
,const wxPoint& rPos = wxDefaultPosition
|
||||||
|
,const wxSize& rSize = wxDefaultSize
|
||||||
|
,long lStyle = wxSL_HORIZONTAL
|
||||||
|
#if wxUSE_VALIDATORS
|
||||||
|
,const wxValidator& rValidator = wxDefaultValidator
|
||||||
|
#endif
|
||||||
|
,const wxString& rsName = wxSliderNameStr
|
||||||
|
);
|
||||||
|
|
||||||
void GetSize(int *x, int *y) const ;
|
virtual int GetValue(void) const ;
|
||||||
void GetPosition(int *x, int *y) const ;
|
virtual void SetValue(int);
|
||||||
|
|
||||||
bool Show(bool show);
|
void GetSize( int* pnX
|
||||||
|
,int* pnY
|
||||||
|
) const;
|
||||||
|
void GetPosition( int* pnX
|
||||||
|
,int* pnY
|
||||||
|
) const ;
|
||||||
|
bool Show(bool bShow);
|
||||||
|
void SetRange( int nMinValue
|
||||||
|
,int nMaxValue
|
||||||
|
);
|
||||||
|
|
||||||
void SetRange(int minValue, int maxValue);
|
inline int GetMin(void) const { return m_nRangeMin; }
|
||||||
|
inline int GetMax(void) const { return m_nRangeMax; }
|
||||||
|
|
||||||
inline int GetMin() const { return m_rangeMin; }
|
//
|
||||||
inline int GetMax() const { return m_rangeMax; }
|
// For trackbars only
|
||||||
|
//
|
||||||
|
void ClearSel(void);
|
||||||
|
void ClearTicks(void);
|
||||||
|
|
||||||
void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
|
int GetLineSize(void) const;
|
||||||
|
int GetPageSize(void) const ;
|
||||||
|
int GetSelEnd(void) const;
|
||||||
|
int GetSelStart(void) const;
|
||||||
|
inline int GetTickFreq(void) const { return m_nTickFreq; }
|
||||||
|
int GetThumbLength(void) const ;
|
||||||
|
|
||||||
|
void SetLineSize(int nLineSize);
|
||||||
|
void SetPageSize(int nPageSize);
|
||||||
|
void SetSelection( int nMinPos
|
||||||
|
,int nMaxPos
|
||||||
|
);
|
||||||
|
void SetThumbLength(int nLen) ;
|
||||||
|
void SetTick(int ntickPos) ;
|
||||||
|
void SetTickFreq( int n
|
||||||
|
,int nPos
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// IMPLEMENTATION
|
||||||
|
//
|
||||||
|
inline WXHWND GetStaticMin(void) const { return m_hStaticMin; }
|
||||||
|
inline WXHWND GetStaticMax(void) const { return m_hStaticMax; }
|
||||||
|
inline WXHWND GetEditValue(void) const { return m_hStaticValue; }
|
||||||
|
virtual bool ContainsHWND(WXHWND hWnd) const;
|
||||||
|
void Command(wxCommandEvent& rEvent);
|
||||||
|
virtual WXHBRUSH OnCtlColor( WXHDC hDC
|
||||||
|
,WXHWND hWnd
|
||||||
|
,WXUINT uCtlColor
|
||||||
|
,WXUINT uMessage
|
||||||
|
,WXWPARAM wParam
|
||||||
|
,WXLPARAM lParam
|
||||||
|
);
|
||||||
|
virtual bool OS2OnScroll( int nOrientation
|
||||||
|
,WXWORD wParam
|
||||||
|
,WXWORD wPos
|
||||||
|
,WXHWND hControl
|
||||||
|
);
|
||||||
|
|
||||||
// For trackbars only
|
protected:
|
||||||
void SetTickFreq(int n, int pos);
|
WXHWND m_hStaticMin;
|
||||||
inline int GetTickFreq() const { return m_tickFreq; }
|
WXHWND m_hStaticMax;
|
||||||
void SetPageSize(int pageSize);
|
WXHWND m_hStaticValue;
|
||||||
int GetPageSize() const ;
|
int m_nRangeMin;
|
||||||
void ClearSel() ;
|
int m_nRangeMax;
|
||||||
void ClearTicks() ;
|
int m_nPageSize;
|
||||||
void SetLineSize(int lineSize);
|
int m_nLineSize;
|
||||||
int GetLineSize() const ;
|
int m_nTickFreq;
|
||||||
int GetSelEnd() const ;
|
double m_dPixelToRange;
|
||||||
int GetSelStart() const ;
|
int m_nThumbLength;
|
||||||
void SetSelection(int minPos, int maxPos);
|
|
||||||
void SetThumbLength(int len) ;
|
|
||||||
int GetThumbLength() const ;
|
|
||||||
void SetTick(int tickPos) ;
|
|
||||||
|
|
||||||
// IMPLEMENTATION
|
virtual void DoSetSize( int nX
|
||||||
WXHWND GetStaticMin() const { return m_staticMin; }
|
,int nY
|
||||||
WXHWND GetStaticMax() const { return m_staticMax; }
|
,int nWidth
|
||||||
WXHWND GetEditValue() const { return m_staticValue; }
|
,int nHeight
|
||||||
virtual bool ContainsHWND(WXHWND hWnd) const;
|
,int nSizeFlags = wxSIZE_AUTO
|
||||||
|
);
|
||||||
void Command(wxCommandEvent& event);
|
private:
|
||||||
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
DECLARE_DYNAMIC_CLASS(wxSlider)
|
||||||
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
}; // end of CLASS wxSlider
|
||||||
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;
|
|
||||||
|
|
||||||
virtual void DoSetSize(int x, int y,
|
|
||||||
int width, int height,
|
|
||||||
int sizeFlags = wxSIZE_AUTO);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// _WX_SLIDER_H_
|
// _WX_SLIDER_H_
|
||||||
|
@@ -15,58 +15,66 @@
|
|||||||
#include "wx/control.h"
|
#include "wx/control.h"
|
||||||
#include "wx/event.h"
|
#include "wx/event.h"
|
||||||
|
|
||||||
|
extern MRESULT EXPENTRY wxSpinCtrlWndProc(
|
||||||
|
HWND hWnd
|
||||||
|
, UINT uMessage
|
||||||
|
, MPARAM wParam
|
||||||
|
, MPARAM lParam
|
||||||
|
);
|
||||||
|
|
||||||
class WXDLLEXPORT wxSpinButton: public wxSpinButtonBase
|
class WXDLLEXPORT wxSpinButton: public wxSpinButtonBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Construction
|
// Construction
|
||||||
wxSpinButton() { }
|
wxSpinButton() { }
|
||||||
|
inline wxSpinButton( wxWindow* pParent
|
||||||
inline wxSpinButton( wxWindow *parent
|
,wxWindowID vId = -1
|
||||||
,wxWindowID id = -1
|
,const wxPoint& rPos = wxDefaultPosition
|
||||||
,const wxPoint& pos = wxDefaultPosition
|
,const wxSize& rSize = wxDefaultSize
|
||||||
,const wxSize& size = wxDefaultSize
|
,long lStyle = wxSP_VERTICAL
|
||||||
,long style = wxSP_VERTICAL
|
,const wxString& rsName = "wxSpinButton"
|
||||||
,const wxString& name = "wxSpinButton"
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Create(parent, id, pos, size, style, name);
|
Create(pParent, vId, rPos, rSize, lStyle, rsName);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~wxSpinButton();
|
virtual ~wxSpinButton();
|
||||||
|
|
||||||
bool Create( wxWindow *parent
|
|
||||||
,wxWindowID id = -1
|
bool Create( wxWindow* pParent
|
||||||
,const wxPoint& pos = wxDefaultPosition
|
,wxWindowID vId = -1
|
||||||
,const wxSize& size = wxDefaultSize
|
,const wxPoint& rPos = wxDefaultPosition
|
||||||
,long style = wxSP_VERTICAL
|
,const wxSize& rSize = wxDefaultSize
|
||||||
,const wxString& name = "wxSpinButton"
|
,long lStyle = wxSP_VERTICAL
|
||||||
|
,const wxString& rsName = "wxSpinButton"
|
||||||
);
|
);
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
virtual int GetValue() const ;
|
inline virtual int GetMax(void) const { return m_max; }
|
||||||
virtual void SetValue(int val) ;
|
inline virtual int GetMin(void) const { return m_min; }
|
||||||
virtual void SetRange( int minVal
|
virtual int GetValue(void) const;
|
||||||
,int maxVal
|
inline bool IsVertical(void) const {return ((m_windowStyle & wxSP_VERTICAL) != 0); }
|
||||||
);
|
virtual void SetValue(int nVal);
|
||||||
|
virtual void SetRange( int nMinVal
|
||||||
|
,int nMaxVal
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
// Implementation
|
// Implementation
|
||||||
virtual bool OS2Command( WXUINT param
|
//
|
||||||
,WXWORD id
|
virtual bool OS2Command( WXUINT wParam
|
||||||
|
,WXWORD wId
|
||||||
);
|
);
|
||||||
virtual bool OS2OnNotify( int idCtrl
|
virtual bool OS2OnScroll( int nOrientation
|
||||||
,WXLPARAM lParam
|
|
||||||
,WXLPARAM* result
|
|
||||||
);
|
|
||||||
virtual bool OS2OnScroll( int orientation
|
|
||||||
,WXWORD wParam
|
,WXWORD wParam
|
||||||
,WXWORD pos
|
,WXWORD wPos
|
||||||
,WXHWND control
|
,WXHWND hControl
|
||||||
);
|
);
|
||||||
|
|
||||||
|
inline virtual bool AcceptsFocus(void) const { return FALSE; }
|
||||||
protected:
|
protected:
|
||||||
virtual wxSize DoGetBestSize() const;
|
virtual wxSize DoGetBestSize() const;
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxSpinButton)
|
DECLARE_DYNAMIC_CLASS(wxSpinButton)
|
||||||
};
|
}; // end of CLASS wxSpinButton
|
||||||
#endif
|
|
||||||
// _WX_SPINBUTT_H_
|
#endif // _WX_SPINBUTT_H_
|
||||||
|
@@ -13,6 +13,9 @@
|
|||||||
#define _WX_MSW_SPINCTRL_H_
|
#define _WX_MSW_SPINCTRL_H_
|
||||||
|
|
||||||
#include "wx/spinbutt.h" // the base class
|
#include "wx/spinbutt.h" // the base class
|
||||||
|
#include "wx/dynarray.h"
|
||||||
|
class WXDLLEXPORT wxSpinCtrl;
|
||||||
|
WX_DEFINE_EXPORTED_ARRAY(wxSpinCtrl *, wxArraySpins);
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// Under Win32 and OS2 PM, wxSpinCtrl is a wxSpinButton with a buddy
|
// Under Win32 and OS2 PM, wxSpinCtrl is a wxSpinButton with a buddy
|
||||||
@@ -24,55 +27,99 @@ class WXDLLEXPORT wxSpinCtrl : public wxSpinButton
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxSpinCtrl() { }
|
wxSpinCtrl() { }
|
||||||
|
wxSpinCtrl( wxWindow* pParent
|
||||||
wxSpinCtrl(wxWindow *parent,
|
,wxWindowID vId = -1
|
||||||
wxWindowID id = -1,
|
,const wxString& rsValue = wxEmptyString
|
||||||
const wxString& value = wxEmptyString,
|
,const wxPoint& rPos = wxDefaultPosition
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
,const wxSize& rSize = wxDefaultSize
|
||||||
const wxSize& size = wxDefaultSize,
|
,long lStyle = wxSP_ARROW_KEYS
|
||||||
long style = wxSP_ARROW_KEYS,
|
,int nMin = 0
|
||||||
int min = 0, int max = 100, int initial = 0,
|
,int nMax = 100
|
||||||
const wxString& name = _T("wxSpinCtrl"))
|
,int nInitial = 0
|
||||||
|
,const wxString& rsName = _T("wxSpinCtrl")
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Create(parent, id, value, pos, size, style, min, max, initial, name);
|
Create(pParent, vId, rsValue, rPos, rSize, lStyle, nMin, nMax, nInitial, rsName);
|
||||||
}
|
}
|
||||||
|
virtual ~wxSpinCtrl();
|
||||||
|
|
||||||
bool Create(wxWindow *parent,
|
bool Create(wxWindow* pParent
|
||||||
wxWindowID id = -1,
|
,wxWindowID vId = -1
|
||||||
const wxString& value = wxEmptyString,
|
,const wxString& rsValue = wxEmptyString
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
,const wxPoint& rPos = wxDefaultPosition
|
||||||
const wxSize& size = wxDefaultSize,
|
,const wxSize& rSize = wxDefaultSize
|
||||||
long style = wxSP_ARROW_KEYS,
|
,long lStyle = wxSP_ARROW_KEYS
|
||||||
int min = 0, int max = 100, int initial = 0,
|
,int nMin = 0
|
||||||
const wxString& name = _T("wxSpinCtrl"));
|
,int nMax = 100
|
||||||
|
,int nInitial = 0
|
||||||
|
,const wxString& rsName = _T("wxSpinCtrl")
|
||||||
|
);
|
||||||
|
|
||||||
// a wxTextCtrl-like method (but we can't have GetValue returning wxString
|
//
|
||||||
|
// A wxTextCtrl-like method (but we can't have GetValue returning wxString
|
||||||
// because the base class already has one returning int!)
|
// because the base class already has one returning int!)
|
||||||
void SetValue(const wxString& text);
|
//
|
||||||
|
void SetValue(const wxString& rsText);
|
||||||
|
|
||||||
|
//
|
||||||
// implementation only from now on
|
// implementation only from now on
|
||||||
// -------------------------------
|
// -------------------------------
|
||||||
|
//
|
||||||
|
virtual bool Enable(bool bEnable = TRUE);
|
||||||
|
|
||||||
virtual void SetValue(int val) { wxSpinButton::SetValue(val); }
|
virtual int GetValue(void) const;
|
||||||
virtual int GetValue() const;
|
|
||||||
virtual bool SetFont(const wxFont &font);
|
virtual bool SetFont(const wxFont &rFont);
|
||||||
|
virtual void SetFocus(void);
|
||||||
|
inline virtual void SetValue(int nVal) { wxSpinButton::SetValue(nVal); }
|
||||||
|
|
||||||
|
virtual bool Show(bool bShow = TRUE);
|
||||||
|
|
||||||
|
//
|
||||||
|
// wxSpinButton doesn't accept focus, but we do
|
||||||
|
//
|
||||||
|
inline virtual bool AcceptsFocus(void) const { return FALSE; }
|
||||||
|
|
||||||
|
//
|
||||||
|
// Return the spinctrl object whose buddy is the given window or NULL
|
||||||
|
// Doesn't really do much under OS/2
|
||||||
|
//
|
||||||
|
static wxSpinCtrl* GetSpinForTextCtrl(WXHWND hWndBuddy);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Process a WM_COMMAND generated by the buddy text control
|
||||||
|
//
|
||||||
|
bool ProcessTextCommand( WXWORD wCmd
|
||||||
|
,WXWORD wId
|
||||||
|
);
|
||||||
|
|
||||||
virtual bool Enable(bool enable = TRUE);
|
|
||||||
virtual bool Show(bool show = TRUE);
|
|
||||||
protected:
|
protected:
|
||||||
void DoMoveWindow(int x, int y, int width, int height);
|
virtual void DoGetPosition( int* nlX
|
||||||
|
,int* nlY
|
||||||
|
) const;
|
||||||
|
void DoMoveWindow( int nX
|
||||||
|
,int nY
|
||||||
|
,int nWidth
|
||||||
|
,int nHeight
|
||||||
|
);
|
||||||
|
virtual wxSize DoGetBestSize(void) const;
|
||||||
|
virtual void DoGetSize( int* pnWidth
|
||||||
|
,int* pnHeight
|
||||||
|
) const;
|
||||||
|
|
||||||
virtual wxSize DoGetBestSize() const;
|
//
|
||||||
|
// The handler for wxSpinButton events
|
||||||
|
//
|
||||||
|
void OnSpinChange(wxSpinEvent& rEvent);
|
||||||
|
void OnChar(wxKeyEvent& rEvent);
|
||||||
|
|
||||||
// the handler for wxSpinButton events
|
WXHWND m_hWndBuddy;
|
||||||
void OnSpinChange(wxSpinEvent& event);
|
static wxArraySpins m_svAllSpins;
|
||||||
|
|
||||||
WXHWND m_hwndBuddy;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxSpinCtrl)
|
DECLARE_DYNAMIC_CLASS(wxSpinCtrl)
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
}; // end of CLASS wxSpinCtrl
|
||||||
|
|
||||||
#endif // _WX_MSW_SPINCTRL_H_
|
#endif // _WX_MSW_SPINCTRL_H_
|
||||||
|
|
||||||
|
@@ -60,6 +60,10 @@ class WXDLLEXPORT wxStaticBitmap : public wxStaticBitmapBase
|
|||||||
|
|
||||||
// overriden base class virtuals
|
// overriden base class virtuals
|
||||||
virtual bool AcceptsFocus() const { return FALSE; }
|
virtual bool AcceptsFocus() const { return FALSE; }
|
||||||
|
virtual MRESULT OS2WindowProc( WXUINT uMsg
|
||||||
|
,WXWPARAM wParam
|
||||||
|
,WXLPARAM lParam
|
||||||
|
);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual wxSize DoGetBestSize() const;
|
virtual wxSize DoGetBestSize() const;
|
||||||
@@ -77,7 +81,7 @@ protected:
|
|||||||
wxGDIImage* m_pImage;
|
wxGDIImage* m_pImage;
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxStaticBitmap)
|
DECLARE_DYNAMIC_CLASS(wxStaticBitmap)
|
||||||
};
|
}; // end of wxStaticBitmap
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// _WX_STATBMP_H_
|
// _WX_STATBMP_H_
|
||||||
|
@@ -19,50 +19,49 @@ WXDLLEXPORT_DATA(extern const char*) wxStaticBoxNameStr;
|
|||||||
// Group box
|
// Group box
|
||||||
class WXDLLEXPORT wxStaticBox : public wxStaticBoxBase
|
class WXDLLEXPORT wxStaticBox : public wxStaticBoxBase
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxStaticBox)
|
public:
|
||||||
|
|
||||||
public:
|
|
||||||
inline wxStaticBox() {}
|
inline wxStaticBox() {}
|
||||||
inline wxStaticBox( wxWindow* parent
|
inline wxStaticBox( wxWindow* pParent
|
||||||
,wxWindowID id
|
,wxWindowID vId
|
||||||
,const wxString& label
|
,const wxString& rsLabel
|
||||||
,const wxPoint& pos = wxDefaultPosition
|
,const wxPoint& rPos = wxDefaultPosition
|
||||||
,const wxSize& size = wxDefaultSize
|
,const wxSize& rSize = wxDefaultSize
|
||||||
,long style = 0
|
,long lStyle = 0
|
||||||
,const wxString& name = wxStaticBoxNameStr
|
,const wxString& rsName = wxStaticBoxNameStr
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Create(parent, id, label, pos, size, style, name);
|
Create(pParent, vId, rsLabel, rPos, rSize, lStyle, rsName);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Create( wxWindow* parent
|
bool Create( wxWindow* pParent
|
||||||
,wxWindowID id
|
,wxWindowID vId
|
||||||
,const wxString& label
|
,const wxString& rsLabel
|
||||||
,const wxPoint& pos = wxDefaultPosition
|
,const wxPoint& rPos = wxDefaultPosition
|
||||||
,const wxSize& size = wxDefaultSize
|
,const wxSize& rSize = wxDefaultSize
|
||||||
,long style = 0
|
,long lStyle = 0
|
||||||
,const wxString& name = wxStaticBoxNameStr
|
,const wxString& rsName = wxStaticBoxNameStr
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
// implementation from now on
|
// implementation from now on
|
||||||
// --------------------------
|
// --------------------------
|
||||||
|
//
|
||||||
|
virtual MRESULT OS2WindowProc( WXUINT uMsg
|
||||||
|
,WXWPARAM wParam
|
||||||
|
,WXLPARAM lParam
|
||||||
|
);
|
||||||
|
|
||||||
void OnEraseBackground(wxEraseEvent& event);
|
//
|
||||||
|
|
||||||
virtual MRESULT OS2WindowProc(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
|
// overriden base class virtuals
|
||||||
virtual bool AcceptsFocus() const { return FALSE; }
|
//
|
||||||
|
inline virtual bool AcceptsFocus(void) const { return FALSE; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual wxSize DoGetBestSize() const;
|
virtual wxSize DoGetBestSize(void) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_DYNAMIC_CLASS(wxStaticBox)
|
||||||
};
|
}; // end of CLASS wxStaticBox
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// _WX_STATBOX_H_
|
// _WX_STATBOX_H_
|
||||||
|
@@ -21,29 +21,62 @@
|
|||||||
|
|
||||||
class WXDLLEXPORT wxStaticLine : public wxStaticLineBase
|
class WXDLLEXPORT wxStaticLine : public wxStaticLineBase
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxStaticLine)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// constructors and pseudo-constructors
|
// constructors and pseudo-constructors
|
||||||
wxStaticLine() { }
|
wxStaticLine() { }
|
||||||
|
wxStaticLine( wxWindow* pParent
|
||||||
wxStaticLine( wxWindow *parent,
|
,wxWindowID vId
|
||||||
wxWindowID id,
|
,const wxPoint& rPos = wxDefaultPosition
|
||||||
const wxPoint &pos = wxDefaultPosition,
|
,const wxSize& rSize = wxDefaultSize
|
||||||
const wxSize &size = wxDefaultSize,
|
,long lStyle = wxLI_HORIZONTAL
|
||||||
long style = wxLI_HORIZONTAL,
|
,const wxString& rsName = wxStaticTextNameStr
|
||||||
const wxString &name = wxStaticTextNameStr )
|
)
|
||||||
{
|
{
|
||||||
Create(parent, id, pos, size, style, name);
|
Create(pParent, vId, rPos, rSize, lStyle, rsName);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Create( wxWindow *parent,
|
bool Create( wxWindow* pParent
|
||||||
wxWindowID id,
|
,wxWindowID vId
|
||||||
const wxPoint &pos = wxDefaultPosition,
|
,const wxPoint& rPos = wxDefaultPosition
|
||||||
const wxSize &size = wxDefaultSize,
|
,const wxSize& rSize = wxDefaultSize
|
||||||
long style = wxLI_HORIZONTAL,
|
,long lStyle = wxLI_HORIZONTAL
|
||||||
const wxString &name = wxStaticTextNameStr );
|
,const wxString& rsName = wxStaticTextNameStr
|
||||||
};
|
);
|
||||||
|
|
||||||
|
inline bool IsVertical(void) const { return((GetWindowStyleFlag() & wxLI_VERTICAL) != 0); }
|
||||||
|
inline static int GetDefaultSize(void) { return 2; }
|
||||||
|
|
||||||
|
//
|
||||||
|
// Overriden base class virtuals
|
||||||
|
//
|
||||||
|
inline virtual bool AcceptsFocus(void) const {return FALSE;}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
inline wxSize AdjustSize(const wxSize& rSize) const
|
||||||
|
{
|
||||||
|
wxSize vSizeReal( rSize.x
|
||||||
|
,rSize.y
|
||||||
|
);
|
||||||
|
|
||||||
|
if (IsVertical())
|
||||||
|
{
|
||||||
|
if (rSize.x == -1 )
|
||||||
|
vSizeReal.x = GetDefaultSize();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (rSize.y == -1)
|
||||||
|
vSizeReal.y = GetDefaultSize();
|
||||||
|
}
|
||||||
|
return vSizeReal;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline wxSize DoGetBestSize(void) const { return (AdjustSize(wxDefaultSize)); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxStaticLine)
|
||||||
|
}; // end of CLASS wxStaticLine
|
||||||
|
|
||||||
#endif // _WX_OS2_STATLINE_H_
|
#endif // _WX_OS2_STATLINE_H_
|
||||||
|
|
||||||
|
@@ -22,11 +22,8 @@ WXDLLEXPORT_DATA(extern const char*) wxStaticTextNameStr;
|
|||||||
|
|
||||||
class WXDLLEXPORT wxStaticText : public wxControl
|
class WXDLLEXPORT wxStaticText : public wxControl
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxStaticText)
|
public:
|
||||||
|
|
||||||
public:
|
|
||||||
inline wxStaticText() { }
|
inline wxStaticText() { }
|
||||||
|
|
||||||
inline wxStaticText( wxWindow* pParent
|
inline wxStaticText( wxWindow* pParent
|
||||||
,wxWindowID vId
|
,wxWindowID vId
|
||||||
,const wxString& rsLabel
|
,const wxString& rsLabel
|
||||||
@@ -69,6 +66,9 @@ class WXDLLEXPORT wxStaticText : public wxControl
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual wxSize DoGetBestSize(void) const;
|
virtual wxSize DoGetBestSize(void) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxStaticText)
|
||||||
}; // end of CLASS wxStaticText
|
}; // end of CLASS wxStaticText
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -134,6 +134,8 @@ bool wxControl::OS2CreateControl(
|
|||||||
|
|
||||||
if ((strcmp(zClassname, "COMBOBOX")) == 0)
|
if ((strcmp(zClassname, "COMBOBOX")) == 0)
|
||||||
zClass = WC_COMBOBOX;
|
zClass = WC_COMBOBOX;
|
||||||
|
else if ((strcmp(zClassname, "STATIC")) == 0)
|
||||||
|
zClass = WC_STATIC;
|
||||||
dwStyle |= WS_VISIBLE;
|
dwStyle |= WS_VISIBLE;
|
||||||
m_hWnd = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(GetParent()) // Parent window handle
|
m_hWnd = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(GetParent()) // Parent window handle
|
||||||
,(PSZ)zClassname // Window class
|
,(PSZ)zClassname // Window class
|
||||||
|
1296
src/os2/gauge.cpp
1296
src/os2/gauge.cpp
File diff suppressed because it is too large
Load Diff
1741
src/os2/radiobox.cpp
1741
src/os2/radiobox.cpp
File diff suppressed because it is too large
Load Diff
@@ -27,197 +27,153 @@
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxRadioButton, wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxRadioButton, wxControl)
|
||||||
|
|
||||||
bool wxRadioButton::OS2Command(WXUINT param, WXWORD id)
|
void wxRadioButton::Command (
|
||||||
|
wxCommandEvent& rEvent
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if (param == BN_CLICKED)
|
SetValue ((rEvent.GetInt() != 0) );
|
||||||
{
|
ProcessCommand (rEvent);
|
||||||
wxCommandEvent event(wxEVT_COMMAND_RADIOBUTTON_SELECTED, m_windowId);
|
} // end of wxRadioButton::Command
|
||||||
event.SetEventObject( this );
|
|
||||||
ProcessCommand(event);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
else return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxRadioButton::Create(wxWindow *parent, wxWindowID id,
|
bool wxRadioButton::Create(
|
||||||
const wxString& label,
|
wxWindow* pParent
|
||||||
const wxPoint& pos,
|
, wxWindowID vId
|
||||||
const wxSize& size, long style,
|
, const wxString& rsLabel
|
||||||
|
, const wxPoint& rPos
|
||||||
|
, const wxSize& rSize
|
||||||
|
, long lStyle
|
||||||
#if wxUSE_VALIDATORS
|
#if wxUSE_VALIDATORS
|
||||||
const wxValidator& validator,
|
, const wxValidator& rValidator
|
||||||
#endif
|
#endif
|
||||||
const wxString& name)
|
, const wxString& rsName
|
||||||
|
)
|
||||||
{
|
{
|
||||||
SetName(name);
|
int nX = rPos.x;
|
||||||
|
int nY = rPos.y;
|
||||||
|
int nWidth = rSize.x;
|
||||||
|
int nHeight = rSize.y;
|
||||||
|
long lsStyle = 0L;
|
||||||
|
long lGroupStyle = 0L;
|
||||||
|
|
||||||
|
SetName(rsName);
|
||||||
#if wxUSE_VALIDATORS
|
#if wxUSE_VALIDATORS
|
||||||
SetValidator(validator);
|
SetValidator(rValidator);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (parent) parent->AddChild(this);
|
if (pParent)
|
||||||
|
pParent->AddChild(this);
|
||||||
|
|
||||||
SetBackgroundColour(parent->GetBackgroundColour());
|
SetBackgroundColour(pParent->GetBackgroundColour());
|
||||||
SetForegroundColour(parent->GetForegroundColour());
|
SetForegroundColour(pParent->GetForegroundColour());
|
||||||
|
|
||||||
if ( id == -1 )
|
if (vId == -1)
|
||||||
m_windowId = (int)NewControlId();
|
m_windowId = (int)NewControlId();
|
||||||
else
|
else
|
||||||
m_windowId = id;
|
m_windowId = vId;
|
||||||
|
|
||||||
int x = pos.x;
|
|
||||||
int y = pos.y;
|
|
||||||
int width = size.x;
|
|
||||||
int height = size.y;
|
|
||||||
|
|
||||||
m_windowStyle = style ;
|
|
||||||
|
|
||||||
// TODO create radiobutton
|
|
||||||
/*
|
|
||||||
long groupStyle = 0;
|
|
||||||
if (m_windowStyle & wxRB_GROUP)
|
|
||||||
groupStyle = WS_GROUP;
|
|
||||||
|
|
||||||
// long msStyle = groupStyle | RADIO_FLAGS;
|
|
||||||
long msStyle = groupStyle | BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE ;
|
|
||||||
|
|
||||||
bool want3D;
|
|
||||||
WXDWORD exStyle = Determine3DEffects(0, &want3D) ;
|
|
||||||
|
|
||||||
m_hWnd = (WXHWND) CreateWindowEx(exStyle, RADIO_CLASS, (const wxChar *)label,
|
|
||||||
msStyle,0,0,0,0,
|
|
||||||
(HWND) parent->GetHWND(), (HMENU)m_windowId, wxGetInstance(), NULL);
|
|
||||||
|
|
||||||
wxCHECK_MSG( m_hWnd, FALSE, wxT("Failed to create radiobutton") );
|
|
||||||
|
|
||||||
|
|
||||||
SetFont(parent->GetFont());
|
m_windowStyle = lStyle ;
|
||||||
|
|
||||||
// Subclass again for purposes of dialog editing mode
|
if (m_windowStyle & wxRB_GROUP)
|
||||||
SubclassWin((WXHWND)m_hWnd);
|
lGroupStyle = WS_GROUP;
|
||||||
|
|
||||||
// SetValue(value);
|
lsStyle = lGroupStyle | BS_AUTORADIOBUTTON | WS_VISIBLE ;
|
||||||
*/
|
|
||||||
|
|
||||||
// start GRW fix
|
if (m_windowStyle & wxCLIP_SIBLINGS )
|
||||||
if (label != wxT(""))
|
lsStyle |= WS_CLIPSIBLINGS;
|
||||||
{
|
m_hWnd = (WXHWND)::WinCreateWindow ( GetHwndOf(pParent)
|
||||||
int label_width, label_height;
|
,WC_BUTTON
|
||||||
GetTextExtent(label, &label_width, &label_height, NULL, NULL, & this->GetFont());
|
,rsLabel.c_str()
|
||||||
if (width < 0)
|
,lsStyle
|
||||||
width = (int)(label_width + RADIO_SIZE);
|
,0, 0, 0, 0
|
||||||
if (height<0)
|
,GetWinHwnd(pParent)
|
||||||
|
,HWND_TOP
|
||||||
|
,(HMENU)m_windowId
|
||||||
|
,NULL
|
||||||
|
,NULL
|
||||||
|
);
|
||||||
|
wxCHECK_MSG(m_hWnd, FALSE, wxT("Failed to create radiobutton"));
|
||||||
|
|
||||||
|
if (rsLabel != wxT(""))
|
||||||
{
|
{
|
||||||
height = (int)(label_height);
|
int nLabelWidth;
|
||||||
if (height < RADIO_SIZE)
|
int nLabelHeight;
|
||||||
height = RADIO_SIZE;
|
|
||||||
|
GetTextExtent( rsLabel
|
||||||
|
,&nLabelWidth
|
||||||
|
,&nLabelHeight
|
||||||
|
,NULL
|
||||||
|
,NULL
|
||||||
|
,&this->GetFont()
|
||||||
|
);
|
||||||
|
if (nWidth < 0)
|
||||||
|
nWidth = (int)(nLabelWidth + RADIO_SIZE);
|
||||||
|
if (nHeight<0)
|
||||||
|
{
|
||||||
|
nHeight = (int)(nLabelHeight);
|
||||||
|
if (nHeight < RADIO_SIZE)
|
||||||
|
nHeight = RADIO_SIZE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (nWidth < 0)
|
||||||
|
nWidth = RADIO_SIZE;
|
||||||
|
if (nHeight < 0)
|
||||||
|
nHeight = RADIO_SIZE;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (width < 0)
|
|
||||||
width = RADIO_SIZE;
|
|
||||||
if (height < 0)
|
|
||||||
height = RADIO_SIZE;
|
|
||||||
}
|
|
||||||
// end GRW fix
|
|
||||||
|
|
||||||
SetSize(x, y, width, height);
|
//
|
||||||
return FALSE;
|
// Subclass again for purposes of dialog editing mode
|
||||||
}
|
//
|
||||||
|
SubclassWin((WXHWND)m_hWnd);
|
||||||
void wxRadioButton::SetLabel(const wxString& label)
|
SetFont(pParent->GetFont());
|
||||||
{
|
SetSize( nX
|
||||||
// TODO
|
,nY
|
||||||
}
|
,nWidth
|
||||||
|
,nHeight
|
||||||
void wxRadioButton::SetValue(bool value)
|
);
|
||||||
{
|
return FALSE;
|
||||||
// TODO
|
} // end of wxRadioButton::Create
|
||||||
}
|
|
||||||
|
|
||||||
|
//
|
||||||
// Get single selection, for single choice list items
|
// Get single selection, for single choice list items
|
||||||
|
//
|
||||||
bool wxRadioButton::GetValue() const
|
bool wxRadioButton::GetValue() const
|
||||||
{
|
{
|
||||||
// TODO
|
return((::WinSendMsg((HWND) GetHWND(), BM_QUERYCHECK, (MPARAM)0L, (MPARAM)0L) != 0));
|
||||||
return FALSE;
|
} // end of wxRadioButton::GetValue
|
||||||
}
|
|
||||||
|
|
||||||
void wxRadioButton::Command (wxCommandEvent & event)
|
bool wxRadioButton::OS2Command(
|
||||||
|
WXUINT wParam
|
||||||
|
, WXWORD wId
|
||||||
|
)
|
||||||
{
|
{
|
||||||
SetValue ( (event.m_commandInt != 0) );
|
if (wParam == BN_CLICKED)
|
||||||
ProcessCommand (event);
|
{
|
||||||
}
|
wxCommandEvent rEvent( wxEVT_COMMAND_RADIOBUTTON_SELECTED
|
||||||
|
,m_windowId
|
||||||
|
);
|
||||||
|
|
||||||
// Not implemented
|
rEvent.SetEventObject(this);
|
||||||
#if 0
|
ProcessCommand(rEvent);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return FALSE;
|
||||||
|
} // end of wxRadioButton::OS2Command
|
||||||
|
|
||||||
bool wxBitmapRadioButton::Create(wxWindow *parent, wxWindowID id,
|
void wxRadioButton::SetLabel(
|
||||||
const wxBitmap *bitmap,
|
const wxString& rsLabel
|
||||||
const wxPoint& pos,
|
)
|
||||||
const wxSize& size, long style,
|
|
||||||
#if wxUSE_VALIDATORS
|
|
||||||
const wxValidator& validator,
|
|
||||||
#endif
|
|
||||||
const wxString& name)
|
|
||||||
{
|
{
|
||||||
SetName(name);
|
::WinSetWindowText((HWND)GetHWND(), (const char *)rsLabel.c_str());
|
||||||
#if wxUSE_VALIDATORS
|
} // end of wxRadioButton::SetLabel
|
||||||
SetValidator(validator);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (parent) parent->AddChild(this);
|
void wxRadioButton::SetValue(
|
||||||
SetBackgroundColour(parent->GetBackgroundColour());
|
bool bValue
|
||||||
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 ;
|
|
||||||
|
|
||||||
long groupStyle = 0;
|
|
||||||
if (m_windowStyle & wxRB_GROUP)
|
|
||||||
groupStyle = WS_GROUP;
|
|
||||||
|
|
||||||
// TODO:
|
|
||||||
/*
|
|
||||||
// long msStyle = groupStyle | RADIO_FLAGS;
|
|
||||||
// long msStyle = groupStyle | BS_RADIOBUTTON | WS_CHILD | WS_VISIBLE ;
|
|
||||||
|
|
||||||
m_hWnd = (WXHWND) CreateWindowEx(MakeExtendedStyle(m_windowStyle), RADIO_CLASS, "toggle",
|
|
||||||
msStyle,0,0,0,0,
|
|
||||||
(HWND) parent->GetHWND(), (HMENU)m_windowId, wxGetInstance(), NULL);
|
|
||||||
|
|
||||||
wxCHECK_MSG( m_hWnd, "Failed to create radio button", FALSE );
|
|
||||||
|
|
||||||
*/
|
|
||||||
// Subclass again for purposes of dialog editing mode
|
|
||||||
SubclassWin(GetHWND());
|
|
||||||
|
|
||||||
SetSize(x, y, width, height);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxBitmapRadioButton::SetLabel(const wxBitmap *bitmap)
|
|
||||||
{
|
{
|
||||||
}
|
::WinSendMsg((HWND)GetHWND(), BM_SETCHECK, (MPARAM)bValue, (MPARAM)0);
|
||||||
|
} // end of wxRadioButton::SetValue
|
||||||
|
|
||||||
void wxBitmapRadioButton::SetValue(bool value)
|
|
||||||
{
|
|
||||||
// Following necessary for Win32s, because Win32s translate BM_SETCHECK
|
|
||||||
// SendMessage((HWND) GetHWND(), BM_SETCHECK, (WPARAM)value, 0L);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get single selection, for single choice list items
|
|
||||||
bool wxBitmapRadioButton::GetValue(void) const
|
|
||||||
{
|
|
||||||
// return (bool)SendMessage((HWND) GetHWND(), BM_GETCHECK, 0, 0L);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
1355
src/os2/slider.cpp
1355
src/os2/slider.cpp
File diff suppressed because it is too large
Load Diff
@@ -29,6 +29,11 @@
|
|||||||
|
|
||||||
#include "wx/spinbutt.h"
|
#include "wx/spinbutt.h"
|
||||||
|
|
||||||
|
extern void wxAssociateWinWithHandle( HWND hWnd
|
||||||
|
,wxWindowOS2* pWin
|
||||||
|
);
|
||||||
|
static WXFARPROC fnWndProcSpinCtrl = (WXFARPROC)NULL;
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxNotifyEvent)
|
IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxNotifyEvent)
|
||||||
|
|
||||||
#include "wx/os2/private.h"
|
#include "wx/os2/private.h"
|
||||||
@@ -44,29 +49,106 @@ IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxNotifyEvent)
|
|||||||
IMPLEMENT_DYNAMIC_CLASS(wxSpinButton, wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxSpinButton, wxControl)
|
||||||
|
|
||||||
bool wxSpinButton::Create(
|
bool wxSpinButton::Create(
|
||||||
wxWindow* parent
|
wxWindow* pParent
|
||||||
, wxWindowID id
|
, wxWindowID vId
|
||||||
, const wxPoint& pos
|
, const wxPoint& rPos
|
||||||
, const wxSize& size
|
, const wxSize& rSize
|
||||||
, long style
|
, long lStyle
|
||||||
, const wxString& name
|
, const wxString& rsName
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
SetName(name);
|
int nX = rPos.x;
|
||||||
|
int nY = rPos.y;
|
||||||
|
int nWidth = rSize.x;
|
||||||
|
int nHeight = rSize.y;
|
||||||
|
|
||||||
m_windowStyle = style;
|
m_min = 0;
|
||||||
|
m_max = 100;
|
||||||
|
if (vId == -1)
|
||||||
|
m_windowId = NewControlId();
|
||||||
|
else
|
||||||
|
m_windowId = vId;
|
||||||
|
m_backgroundColour = pParent->GetBackgroundColour();
|
||||||
|
m_foregroundColour = pParent->GetForegroundColour();
|
||||||
|
SetName(rsName);
|
||||||
|
SetParent(pParent);
|
||||||
|
m_windowStyle = lStyle;
|
||||||
|
|
||||||
SetParent(parent);
|
//
|
||||||
|
// Get the right size for the control
|
||||||
|
//
|
||||||
|
if (nWidth <= 0 || nHeight <= 0 )
|
||||||
|
{
|
||||||
|
wxSize vSize = DoGetBestSize();
|
||||||
|
|
||||||
m_windowId = (id == -1) ? NewControlId() : id;
|
if (nWidth <= 0 )
|
||||||
|
nWidth = vSize.x;
|
||||||
|
if (nHeight <= 0 )
|
||||||
|
nHeight = vSize.y;
|
||||||
|
}
|
||||||
|
if (nX < 0 )
|
||||||
|
nX = 0;
|
||||||
|
if (nY < 0 )
|
||||||
|
nY = 0;
|
||||||
|
|
||||||
// TODO create spin button
|
long lSstyle = 0L;
|
||||||
return FALSE;
|
|
||||||
}
|
lSstyle = WS_VISIBLE |
|
||||||
|
WS_TABSTOP |
|
||||||
|
SPBS_MASTER | // We use only single field spin buttons
|
||||||
|
SPBS_NUMERICONLY; // We default to numeric data
|
||||||
|
|
||||||
|
if (m_windowStyle & wxCLIP_SIBLINGS )
|
||||||
|
lSstyle |= WS_CLIPSIBLINGS;
|
||||||
|
|
||||||
|
SPBCDATA vCtrlData;
|
||||||
|
|
||||||
|
vCtrlData.cbSize = sizeof(SPBCDATA);
|
||||||
|
vCtrlData.ulTextLimit = 10L;
|
||||||
|
vCtrlData.lLowerLimit = 0L;
|
||||||
|
vCtrlData.lUpperLimit = 100L;
|
||||||
|
vCtrlData.idMasterSpb = vId;
|
||||||
|
vCtrlData.pHWXCtlData = NULL;
|
||||||
|
|
||||||
|
m_hWnd = (WXHWND)::WinCreateWindow( GetWinHwnd(pParent)
|
||||||
|
,WC_SPINBUTTON
|
||||||
|
,(PSZ)NULL
|
||||||
|
,lSstyle
|
||||||
|
,0L, 0L, 0L, 0L
|
||||||
|
,GetWinHwnd(pParent)
|
||||||
|
,HWND_TOP
|
||||||
|
,(HMENU)vId
|
||||||
|
,(PVOID)&vCtrlData
|
||||||
|
,NULL
|
||||||
|
);
|
||||||
|
if (m_hWnd == 0)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
if(pParent)
|
||||||
|
pParent->AddChild((wxSpinButton *)this);
|
||||||
|
|
||||||
|
SetFont(pParent->GetFont());
|
||||||
|
//
|
||||||
|
// For OS/2 we want to hide the text portion so we can substitute an
|
||||||
|
// independent text ctrl in its place. 10 device units does this
|
||||||
|
//
|
||||||
|
SetSize( nX
|
||||||
|
,nY
|
||||||
|
,10L
|
||||||
|
,nHeight
|
||||||
|
);
|
||||||
|
wxAssociateWinWithHandle( m_hWnd
|
||||||
|
,(wxWindowOS2*)this
|
||||||
|
);
|
||||||
|
::WinSetWindowULong(GetHwnd(), QWL_USER, (LONG)this);
|
||||||
|
fnWndProcSpinCtrl = (WXFARPROC)::WinSubclassWindow(m_hWnd, (PFNWP)wxSpinCtrlWndProc);
|
||||||
|
return TRUE;
|
||||||
|
} // end of wxSpinButton::Create
|
||||||
|
|
||||||
wxSpinButton::~wxSpinButton()
|
wxSpinButton::~wxSpinButton()
|
||||||
{
|
{
|
||||||
}
|
} // end of wxSpinButton::~wxSpinButton
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// size calculation
|
// size calculation
|
||||||
@@ -74,23 +156,12 @@ wxSpinButton::~wxSpinButton()
|
|||||||
|
|
||||||
wxSize wxSpinButton::DoGetBestSize() const
|
wxSize wxSpinButton::DoGetBestSize() const
|
||||||
{
|
{
|
||||||
// TODO:
|
//
|
||||||
/*
|
// OS/2 PM does not really have system metrics so we'll just set our best guess
|
||||||
if ( (GetWindowStyle() & wxSP_VERTICAL) != 0 )
|
// Also we have no horizontal spin buttons.
|
||||||
{
|
//
|
||||||
// vertical control
|
return (wxSize(10,20));
|
||||||
return wxSize(GetSystemMetrics(SM_CXVSCROLL),
|
} // end of wxSpinButton::DoGetBestSize
|
||||||
2*GetSystemMetrics(SM_CYVSCROLL));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// horizontal control
|
|
||||||
return wxSize(2*GetSystemMetrics(SM_CXHSCROLL),
|
|
||||||
GetSystemMetrics(SM_CYHSCROLL));
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
return wxSize(0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// Attributes
|
// Attributes
|
||||||
@@ -98,66 +169,68 @@ wxSize wxSpinButton::DoGetBestSize() const
|
|||||||
|
|
||||||
int wxSpinButton::GetValue() const
|
int wxSpinButton::GetValue() const
|
||||||
{
|
{
|
||||||
// TODO
|
int nVal = 0;
|
||||||
return 0;
|
long lVal = 0L;
|
||||||
}
|
char zVal[10];
|
||||||
|
|
||||||
void wxSpinButton::SetValue(int val)
|
::WinSendMsg( GetHwnd()
|
||||||
|
,SPBM_QUERYVALUE
|
||||||
|
,MPFROMP(zVal)
|
||||||
|
,MPFROM2SHORT( (USHORT)10
|
||||||
|
,SPBQ_UPDATEIFVALID
|
||||||
|
)
|
||||||
|
);
|
||||||
|
lVal = atol(zVal);
|
||||||
|
return ((int)lVal);
|
||||||
|
} // end of wxSpinButton::GetValue
|
||||||
|
|
||||||
|
bool wxSpinButton::OS2OnScroll(
|
||||||
|
int nOrientation
|
||||||
|
, WXWORD wParam
|
||||||
|
, WXWORD wPos
|
||||||
|
, WXHWND hControl
|
||||||
|
)
|
||||||
{
|
{
|
||||||
// TODO
|
wxCHECK_MSG(hControl, FALSE, wxT("scrolling what?") )
|
||||||
}
|
|
||||||
|
|
||||||
void wxSpinButton::SetRange(int minVal, int maxVal)
|
wxSpinEvent vEvent( wxEVT_SCROLL_THUMBTRACK
|
||||||
|
,m_windowId
|
||||||
|
);
|
||||||
|
int nVal = (int)wPos; // cast is important for negative values!
|
||||||
|
|
||||||
|
vEvent.SetPosition(nVal);
|
||||||
|
vEvent.SetEventObject(this);
|
||||||
|
return(GetEventHandler()->ProcessEvent(vEvent));
|
||||||
|
} // end of wxSpinButton::OS2OnScroll
|
||||||
|
|
||||||
|
bool wxSpinButton::OS2Command(
|
||||||
|
WXUINT uCmd
|
||||||
|
, WXWORD wId
|
||||||
|
)
|
||||||
{
|
{
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
return FALSE;
|
||||||
}
|
} // end of wxSpinButton::OS2Command
|
||||||
|
|
||||||
bool wxSpinButton::OS2OnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
|
void wxSpinButton::SetRange(
|
||||||
|
int nMinVal
|
||||||
|
, int nMaxVal
|
||||||
|
)
|
||||||
{
|
{
|
||||||
// TODO:
|
m_min = nMinVal;
|
||||||
/*
|
m_max = nMaxVal;
|
||||||
LPNM_UPDOWN lpnmud = (LPNM_UPDOWN)lParam;
|
|
||||||
|
|
||||||
wxSpinEvent event(lpnmud->iDelta > 0 ? wxEVT_SCROLL_LINEUP
|
::WinSendMsg( GetHwnd()
|
||||||
: wxEVT_SCROLL_LINEDOWN,
|
,SPBM_SETLIMITS
|
||||||
m_windowId);
|
,MPFROMLONG(nMaxVal)
|
||||||
event.SetPosition(lpnmud->iPos + lpnmud->iDelta);
|
,MPFROMLONG(nMinVal)
|
||||||
event.SetEventObject(this);
|
);
|
||||||
|
} // end of wxSpinButton::SetRange
|
||||||
|
|
||||||
bool processed = GetEventHandler()->ProcessEvent(event);
|
void wxSpinButton::SetValue(
|
||||||
|
int nValue
|
||||||
*result = event.IsAllowed() ? 0 : 1;
|
)
|
||||||
|
|
||||||
return processed;
|
|
||||||
*/
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxSpinButton::OS2Command(WXUINT cmd, WXWORD id)
|
|
||||||
{
|
{
|
||||||
// No command messages
|
::WinSendMsg(GetHwnd(), SPBM_SETCURRENTVALUE, MPFROMLONG(nValue), MPARAM(0));
|
||||||
return FALSE;
|
} // end of wxSpinButton::SetValue
|
||||||
}
|
|
||||||
|
|
||||||
#endif //wxUSE_SPINBTN
|
#endif //wxUSE_SPINBTN
|
||||||
|
@@ -40,6 +40,11 @@
|
|||||||
// macros
|
// macros
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
extern void wxAssociateWinWithHandle( HWND hWnd
|
||||||
|
,wxWindowOS2* pWin
|
||||||
|
);
|
||||||
|
static WXFARPROC fnWndProcSpinCtrl = (WXFARPROC)NULL;
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrl, wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrl, wxControl)
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxSpinCtrl, wxSpinButton)
|
BEGIN_EVENT_TABLE(wxSpinCtrl, wxSpinButton)
|
||||||
@@ -55,244 +60,423 @@ static const int MARGIN_BETWEEN = 5;
|
|||||||
// ============================================================================
|
// ============================================================================
|
||||||
// implementation
|
// implementation
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
MRESULT EXPENTRY wxSpinCtrlWndProc(
|
||||||
|
HWND hWnd
|
||||||
|
, UINT uMessage
|
||||||
|
, MPARAM wParam
|
||||||
|
, MPARAM lParam
|
||||||
|
)
|
||||||
|
{
|
||||||
|
wxSpinCtrl* pSpin = (wxSpinCtrl *)::WinQueryWindowULong( hWnd
|
||||||
|
,QWL_USER
|
||||||
|
);
|
||||||
|
bool bProccesed = FALSE;
|
||||||
|
MRESULT rc = (MRESULT)0;
|
||||||
|
//
|
||||||
|
// Forward some messages (the key ones only so far) to the spin ctrl
|
||||||
|
//
|
||||||
|
switch (uMessage )
|
||||||
|
{
|
||||||
|
case WM_CHAR:
|
||||||
|
pSpin->OS2WindowProc( uMessage
|
||||||
|
,wParam
|
||||||
|
,lParam
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// The control may have been deleted at this point, so check.
|
||||||
|
//
|
||||||
|
if (!(::WinIsWindow(vHabmain, hWnd) && ((wxSpinCtrl *)::WinQueryWindowULong( hWnd
|
||||||
|
,QWL_USER
|
||||||
|
)
|
||||||
|
) == pSpin))
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
return (fnWndProcSpinCtrl( hWnd
|
||||||
|
,(ULONG)uMessage
|
||||||
|
,(MPARAM)wParam
|
||||||
|
,(MPARAM)lParam
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} // end of wxSpinCtrlWndProc
|
||||||
|
|
||||||
|
wxSpinCtrl::~wxSpinCtrl()
|
||||||
|
{
|
||||||
|
m_svAllSpins.Remove(this);
|
||||||
|
|
||||||
|
// This removes spurious memory leak reporting
|
||||||
|
if (m_svAllSpins.GetCount() == 0)
|
||||||
|
m_svAllSpins.Clear();
|
||||||
|
} // end of wxSpinCtrl::~wxSpinCtrl
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// construction
|
// construction
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
bool wxSpinCtrl::Create(wxWindow *parent,
|
bool wxSpinCtrl::Create(
|
||||||
wxWindowID id,
|
wxWindow* pParent
|
||||||
const wxString& value,
|
, wxWindowID vId
|
||||||
const wxPoint& pos,
|
, const wxString& rsValue
|
||||||
const wxSize& size,
|
, const wxPoint& rPos
|
||||||
long style,
|
, const wxSize& rSize
|
||||||
int min, int max, int initial,
|
, long lStyle
|
||||||
const wxString& name)
|
, int nMin
|
||||||
|
, int nMax
|
||||||
|
, int nInitial
|
||||||
|
, const wxString& rsName
|
||||||
|
)
|
||||||
{
|
{
|
||||||
// TODO:
|
if (vId == -1)
|
||||||
/*
|
m_windowId = NewControlId();
|
||||||
// before using DoGetBestSize(), have to set style to let the base class
|
else
|
||||||
// know whether this is a horizontal or vertical control (we're always
|
m_windowId = vId;
|
||||||
// vertical)
|
m_backgroundColour = pParent->GetBackgroundColour();
|
||||||
style |= wxSP_VERTICAL;
|
m_foregroundColour = pParent->GetForegroundColour();
|
||||||
SetWindowStyle(style);
|
SetName(rsName);
|
||||||
|
SetParent(pParent);
|
||||||
|
m_windowStyle = lStyle;
|
||||||
|
|
||||||
// calculate the sizes: the size given is the toal size for both controls
|
int lSstyle = 0L;
|
||||||
// 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;
|
|
||||||
if ( sizeText.x <= 0 )
|
|
||||||
{
|
|
||||||
// DEFAULT_ITEM_WIDTH is the default width for the text control
|
|
||||||
sizeText.x = DEFAULT_ITEM_WIDTH + MARGIN_BETWEEN + sizeBtn.x;
|
|
||||||
}
|
|
||||||
|
|
||||||
sizeText.x -= sizeBtn.x + MARGIN_BETWEEN;
|
lSstyle = WS_VISIBLE |
|
||||||
if ( sizeText.x <= 0 )
|
WS_TABSTOP |
|
||||||
{
|
SPBS_MASTER | // We use only single field spin buttons
|
||||||
wxLogDebug(_T("not enough space for wxSpinCtrl!"));
|
SPBS_NUMERICONLY; // We default to numeric data
|
||||||
}
|
|
||||||
|
|
||||||
wxPoint posBtn(pos);
|
if (m_windowStyle & wxCLIP_SIBLINGS )
|
||||||
posBtn.x += sizeText.x + MARGIN_BETWEEN;
|
lSstyle |= WS_CLIPSIBLINGS;
|
||||||
|
|
||||||
// create the spin button
|
SPBCDATA vCtrlData;
|
||||||
if ( !wxSpinButton::Create(parent, id, posBtn, sizeBtn, style, name) )
|
|
||||||
|
vCtrlData.cbSize = sizeof(SPBCDATA);
|
||||||
|
vCtrlData.ulTextLimit = 10L;
|
||||||
|
vCtrlData.lLowerLimit = 0L;
|
||||||
|
vCtrlData.lUpperLimit = 100L;
|
||||||
|
vCtrlData.idMasterSpb = vId;
|
||||||
|
vCtrlData.pHWXCtlData = NULL;
|
||||||
|
|
||||||
|
m_hWnd = (WXHWND)::WinCreateWindow( GetWinHwnd(pParent)
|
||||||
|
,WC_SPINBUTTON
|
||||||
|
,(PSZ)NULL
|
||||||
|
,lSstyle
|
||||||
|
,0L, 0L, 0L, 0L
|
||||||
|
,GetWinHwnd(pParent)
|
||||||
|
,HWND_TOP
|
||||||
|
,(HMENU)vId
|
||||||
|
,(PVOID)&vCtrlData
|
||||||
|
,NULL
|
||||||
|
);
|
||||||
|
if (m_hWnd == 0)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
m_hWndBuddy = m_hWnd; // One in the same for OS/2
|
||||||
|
if(pParent)
|
||||||
|
pParent->AddChild((wxSpinButton *)this);
|
||||||
|
SetFont(pParent->GetFont());
|
||||||
|
SetSize( rPos.x
|
||||||
|
,rPos.y
|
||||||
|
,rSize.x
|
||||||
|
,rSize.y
|
||||||
|
);
|
||||||
|
|
||||||
SetRange(min, max);
|
SetRange(nMin, nMax);
|
||||||
SetValue(initial);
|
SetValue(nInitial);
|
||||||
|
|
||||||
// create the text window
|
//
|
||||||
m_hwndBuddy = (WXHWND)::CreateWindowEx
|
// For OS/2 we'll just set our handle into our long data
|
||||||
(
|
//
|
||||||
WS_EX_CLIENTEDGE, // sunken border
|
wxAssociateWinWithHandle( m_hWnd
|
||||||
_T("EDIT"), // window class
|
,(wxWindowOS2*)this
|
||||||
NULL, // no window title
|
);
|
||||||
WS_CHILD | WS_BORDER, // style (will be shown later)
|
::WinSetWindowULong(GetHwnd(), QWL_USER, (LONG)this);
|
||||||
pos.x, pos.y, // position
|
fnWndProcSpinCtrl = (WXFARPROC)::WinSubclassWindow(m_hWnd, (PFNWP)wxSpinCtrlWndProc);
|
||||||
0, 0, // size (will be set later)
|
m_svAllSpins.Add(this);
|
||||||
GetHwndOf(parent), // parent
|
return TRUE;
|
||||||
(HMENU)-1, // control id
|
} // end of wxSpinCtrl::Create
|
||||||
wxGetInstance(), // app instance
|
|
||||||
NULL // unused client data
|
|
||||||
);
|
|
||||||
|
|
||||||
if ( !m_hwndBuddy )
|
wxSize wxSpinCtrl::DoGetBestSize() const
|
||||||
|
{
|
||||||
|
wxSize vSizeBtn = wxSpinButton::DoGetBestSize();
|
||||||
|
int nHeight;
|
||||||
|
|
||||||
|
vSizeBtn.x += DEFAULT_ITEM_WIDTH + MARGIN_BETWEEN;
|
||||||
|
|
||||||
|
wxGetCharSize( GetHWND()
|
||||||
|
,NULL
|
||||||
|
,&nHeight
|
||||||
|
,(wxFont*)&GetFont()
|
||||||
|
);
|
||||||
|
nHeight = EDIT_HEIGHT_FROM_CHAR_HEIGHT(nHeight);
|
||||||
|
|
||||||
|
if (vSizeBtn.y < nHeight)
|
||||||
{
|
{
|
||||||
wxLogLastError("CreateWindow(buddy text window)");
|
//
|
||||||
|
// Make the text tall enough
|
||||||
|
//
|
||||||
|
vSizeBtn.y = nHeight;
|
||||||
|
}
|
||||||
|
return vSizeBtn;
|
||||||
|
} // end of wxSpinCtrl::DoGetBestSize
|
||||||
|
|
||||||
|
void wxSpinCtrl::DoGetPosition(
|
||||||
|
int* pnX
|
||||||
|
, int* pnY
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
WXHWND hWnd = GetHWND();
|
||||||
|
|
||||||
|
wxConstCast(this, wxSpinCtrl)->m_hWnd = m_hWndBuddy;
|
||||||
|
wxSpinButton::DoGetPosition( pnX
|
||||||
|
,pnY
|
||||||
|
);
|
||||||
|
wxConstCast(this, wxSpinCtrl)->m_hWnd = hWnd;
|
||||||
|
} // end of wxpinCtrl::DoGetPosition
|
||||||
|
|
||||||
|
void wxSpinCtrl::DoGetSize(
|
||||||
|
int* pnWidth
|
||||||
|
, int* pnHeight
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
RECTL vSpinrect;
|
||||||
|
|
||||||
|
::WinQueryWindowRect(GetHwnd(), &vSpinrect);
|
||||||
|
|
||||||
|
if (pnWidth)
|
||||||
|
*pnWidth = vSpinrect.xRight - vSpinrect.xLeft;
|
||||||
|
if (pnHeight)
|
||||||
|
*pnHeight = vSpinrect.yTop - vSpinrect.yBottom;
|
||||||
|
} // end of wxSpinCtrl::DoGetSize
|
||||||
|
|
||||||
|
void wxSpinCtrl::DoMoveWindow(
|
||||||
|
int nX
|
||||||
|
, int nY
|
||||||
|
, int nWidth
|
||||||
|
, int nHeight
|
||||||
|
)
|
||||||
|
{
|
||||||
|
wxWindowOS2* pParent = (wxWindowOS2*)GetParent();
|
||||||
|
|
||||||
|
if (pParent)
|
||||||
|
{
|
||||||
|
if (pParent->IsKindOf(CLASSINFO(wxFrame)))
|
||||||
|
{
|
||||||
|
nY = pParent->GetClientSize().y - (nY + nHeight);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
nY = pParent->GetSize().y - (nY + nHeight);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RECTL vRect;
|
||||||
|
|
||||||
|
::WinQueryWindowRect(HWND_DESKTOP, &vRect);
|
||||||
|
nY = vRect.yTop - (nY + nHeight);
|
||||||
|
}
|
||||||
|
::WinSetWindowPos( GetHwnd()
|
||||||
|
,HWND_TOP
|
||||||
|
,nX
|
||||||
|
,nY
|
||||||
|
,nWidth
|
||||||
|
,nHeight
|
||||||
|
,SWP_SIZE | SWP_MOVE | SWP_ZORDER | SWP_SHOW
|
||||||
|
);
|
||||||
|
} // end of wxSpinCtrl::DoMoveWindow
|
||||||
|
|
||||||
|
bool wxSpinCtrl::Enable(
|
||||||
|
bool bEnable
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (!wxControl::Enable(bEnable))
|
||||||
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
::WinEnableWindow(GetHwnd(), bEnable);
|
||||||
|
return TRUE;
|
||||||
|
} // end of wxSpinCtrl::Enable
|
||||||
|
|
||||||
// should have the same font as the other controls
|
wxSpinCtrl* wxSpinCtrl::GetSpinForTextCtrl(
|
||||||
SetFont(GetParent()->GetFont());
|
WXHWND hWndBuddy
|
||||||
|
)
|
||||||
// set the size of the text window - can do it only now, because we
|
|
||||||
// couldn't call DoGetBestSize() before as font wasn't set
|
|
||||||
if ( sizeText.y <= 0 )
|
|
||||||
{
|
|
||||||
int cx, cy;
|
|
||||||
wxGetCharSize(GetHWND(), &cx, &cy, &GetFont());
|
|
||||||
|
|
||||||
sizeText.y = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy);
|
|
||||||
}
|
|
||||||
|
|
||||||
DoMoveWindow(pos.x, pos.y,
|
|
||||||
sizeText.x + sizeBtn.x + MARGIN_BETWEEN, sizeText.y);
|
|
||||||
|
|
||||||
(void)::ShowWindow((HWND)m_hwndBuddy, SW_SHOW);
|
|
||||||
|
|
||||||
// associate the text window with the spin button
|
|
||||||
(void)::SendMessage(GetHwnd(), UDM_SETBUDDY, (WPARAM)m_hwndBuddy, 0);
|
|
||||||
|
|
||||||
if ( !value.IsEmpty() )
|
|
||||||
{
|
|
||||||
SetValue(value);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// wxTextCtrl-like methods
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void wxSpinCtrl::SetValue(const wxString& text)
|
|
||||||
{
|
{
|
||||||
// TODO:
|
wxSpinCtrl* pSpin = (wxSpinCtrl *)::WinQueryWindowULong( (HWND)hWndBuddy
|
||||||
/*
|
,QWL_USER
|
||||||
if ( !::SetWindowText((HWND)m_hwndBuddy, text.c_str()) )
|
);
|
||||||
{
|
int i = m_svAllSpins.Index(pSpin);
|
||||||
wxLogLastError("SetWindowText(buddy)");
|
|
||||||
}
|
if (i == wxNOT_FOUND)
|
||||||
*/
|
return NULL;
|
||||||
}
|
|
||||||
|
// sanity check
|
||||||
|
wxASSERT_MSG( pSpin->m_hWndBuddy == hWndBuddy,
|
||||||
|
_T("wxSpinCtrl has incorrect buddy HWND!") );
|
||||||
|
|
||||||
|
return pSpin;
|
||||||
|
} // end of wxSpinCtrl::GetSpinForTextCtrl
|
||||||
|
|
||||||
int wxSpinCtrl::GetValue() const
|
int wxSpinCtrl::GetValue() const
|
||||||
{
|
{
|
||||||
wxString val = wxGetWindowText(m_hwndBuddy);
|
long lVal = 0L;
|
||||||
|
char zVal[10];
|
||||||
|
|
||||||
long n;
|
::WinSendMsg( GetHwnd()
|
||||||
if ( (wxSscanf(val, wxT("%lu"), &n) != 1) )
|
,SPBM_QUERYVALUE
|
||||||
n = INT_MIN;
|
,MPFROMP(zVal)
|
||||||
|
,MPFROM2SHORT( (USHORT)10
|
||||||
|
,SPBQ_UPDATEIFVALID
|
||||||
|
)
|
||||||
|
);
|
||||||
|
lVal - atol(zVal);
|
||||||
|
return lVal;
|
||||||
|
} // end of wxSpinCtrl::GetValue
|
||||||
|
|
||||||
return n;
|
void wxSpinCtrl::OnChar (
|
||||||
}
|
wxKeyEvent& rEvent
|
||||||
|
)
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// forward some methods to subcontrols
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
bool wxSpinCtrl::SetFont(const wxFont& font)
|
|
||||||
{
|
{
|
||||||
if ( !wxWindowBase::SetFont(font) )
|
switch (rEvent.KeyCode())
|
||||||
|
{
|
||||||
|
case WXK_RETURN:
|
||||||
|
{
|
||||||
|
wxCommandEvent vEvent( wxEVT_COMMAND_TEXT_ENTER
|
||||||
|
,m_windowId
|
||||||
|
);
|
||||||
|
wxString sVal = wxGetWindowText(m_hWndBuddy);
|
||||||
|
|
||||||
|
InitCommandEvent(vEvent);
|
||||||
|
vEvent.SetString((char*)sVal.c_str());
|
||||||
|
vEvent.SetInt(GetValue());
|
||||||
|
if (GetEventHandler()->ProcessEvent(vEvent))
|
||||||
|
return;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case WXK_TAB:
|
||||||
|
//
|
||||||
|
// Always produce navigation event - even if we process TAB
|
||||||
|
// ourselves the fact that we got here means that the user code
|
||||||
|
// decided to skip processing of this TAB - probably to let it
|
||||||
|
// do its default job.
|
||||||
|
//
|
||||||
|
{
|
||||||
|
wxNavigationKeyEvent vEventNav;
|
||||||
|
|
||||||
|
vEventNav.SetDirection(!rEvent.ShiftDown());
|
||||||
|
vEventNav.SetWindowChange(rEvent.ControlDown());
|
||||||
|
vEventNav.SetEventObject(this);
|
||||||
|
if (GetParent()->GetEventHandler()->ProcessEvent(vEventNav))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// No, we didn't process it
|
||||||
|
//
|
||||||
|
rEvent.Skip();
|
||||||
|
} // end of wxSpinCtrl::OnChar
|
||||||
|
|
||||||
|
void wxSpinCtrl::OnSpinChange(
|
||||||
|
wxSpinEvent& rEventSpin
|
||||||
|
)
|
||||||
|
{
|
||||||
|
wxCommandEvent vEvent( wxEVT_COMMAND_SPINCTRL_UPDATED
|
||||||
|
,GetId()
|
||||||
|
);
|
||||||
|
|
||||||
|
vEvent.SetEventObject(this);
|
||||||
|
vEvent.SetInt(rEventSpin.GetPosition());
|
||||||
|
(void)GetEventHandler()->ProcessEvent(vEvent);
|
||||||
|
if (rEventSpin.GetSkipped())
|
||||||
|
{
|
||||||
|
vEvent.Skip();
|
||||||
|
}
|
||||||
|
} // end of wxSpinCtrl::OnSpinChange
|
||||||
|
|
||||||
|
bool wxSpinCtrl::ProcessTextCommand(
|
||||||
|
WXWORD wCmd
|
||||||
|
, WXWORD wId
|
||||||
|
)
|
||||||
|
{
|
||||||
|
switch (wCmd)
|
||||||
|
{
|
||||||
|
case SPBN_CHANGE:
|
||||||
|
{
|
||||||
|
wxCommandEvent vEvent( wxEVT_COMMAND_TEXT_UPDATED
|
||||||
|
,GetId()
|
||||||
|
);
|
||||||
|
vEvent.SetEventObject(this);
|
||||||
|
|
||||||
|
wxString sVal = wxGetWindowText(m_hWndBuddy);
|
||||||
|
|
||||||
|
vEvent.SetString((char*)sVal.c_str());
|
||||||
|
vEvent.SetInt(GetValue());
|
||||||
|
return (GetEventHandler()->ProcessEvent(vEvent));
|
||||||
|
}
|
||||||
|
|
||||||
|
case SPBN_SETFOCUS:
|
||||||
|
case SPBN_KILLFOCUS:
|
||||||
|
{
|
||||||
|
wxFocusEvent vEvent( wCmd == EN_KILLFOCUS ? wxEVT_KILL_FOCUS : wxEVT_SET_FOCUS
|
||||||
|
,m_windowId
|
||||||
|
);
|
||||||
|
|
||||||
|
vEvent.SetEventObject(this);
|
||||||
|
return(GetEventHandler()->ProcessEvent(vEvent));
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Not processed
|
||||||
|
//
|
||||||
|
return FALSE;
|
||||||
|
} // end of wxSpinCtrl::ProcessTextCommand
|
||||||
|
|
||||||
|
void wxSpinCtrl::SetFocus()
|
||||||
|
{
|
||||||
|
::WinSetFocus(HWND_DESKTOP, GetHwnd());
|
||||||
|
} // end of wxSpinCtrl::SetFocus
|
||||||
|
|
||||||
|
bool wxSpinCtrl::SetFont(
|
||||||
|
const wxFont& rFont
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (!wxWindowBase::SetFont(rFont))
|
||||||
{
|
{
|
||||||
// nothing to do
|
// nothing to do
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
WXHANDLE hFont = GetFont().GetResourceHandle();
|
WXHANDLE hFont = GetFont().GetResourceHandle();
|
||||||
// TODO:
|
wxOS2SetFont( m_hWnd
|
||||||
/*
|
,rFont
|
||||||
(void)::SendMessage((HWND)m_hwndBuddy, WM_SETFONT, (WPARAM)hFont, TRUE);
|
);
|
||||||
*/
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
} // end of wxSpinCtrl::SetFont
|
||||||
|
|
||||||
bool wxSpinCtrl::Show(bool show)
|
void wxSpinCtrl::SetValue(
|
||||||
|
const wxString& rsText
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if ( !wxControl::Show(show) )
|
long lVal;
|
||||||
|
|
||||||
|
lVal = atol(rsText.c_str());
|
||||||
|
wxSpinButton::SetValue(lVal);
|
||||||
|
} // end of wxSpinCtrl::SetValue
|
||||||
|
|
||||||
|
bool wxSpinCtrl::Show(
|
||||||
|
bool bShow
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (!wxControl::Show(bShow))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO:
|
|
||||||
/*
|
|
||||||
::ShowWindow((HWND)m_hwndBuddy, show ? SW_SHOW : SW_HIDE);
|
|
||||||
*/
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
} // end of wxSpinCtrl::Show
|
||||||
|
|
||||||
bool wxSpinCtrl::Enable(bool enable)
|
|
||||||
{
|
|
||||||
if ( !wxControl::Enable(enable) )
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO:
|
|
||||||
/*
|
|
||||||
::EnableWindow((HWND)m_hwndBuddy, enable);
|
|
||||||
*/
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// event processing
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void wxSpinCtrl::OnSpinChange(wxSpinEvent& eventSpin)
|
|
||||||
{
|
|
||||||
wxCommandEvent event(wxEVT_COMMAND_SPINCTRL_UPDATED, GetId());
|
|
||||||
event.SetEventObject(this);
|
|
||||||
event.SetInt(eventSpin.GetPosition());
|
|
||||||
|
|
||||||
(void)GetEventHandler()->ProcessEvent(event);
|
|
||||||
|
|
||||||
if ( eventSpin.GetSkipped() )
|
|
||||||
{
|
|
||||||
event.Skip();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// size calculations
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
wxSize wxSpinCtrl::DoGetBestSize() const
|
|
||||||
{
|
|
||||||
wxSize sizeBtn = wxSpinButton::DoGetBestSize();
|
|
||||||
// TODO:
|
|
||||||
/*
|
|
||||||
sizeBtn.x += DEFAULT_ITEM_WIDTH + MARGIN_BETWEEN;
|
|
||||||
|
|
||||||
int y;
|
|
||||||
wxGetCharSize(GetHWND(), NULL, &y, &GetFont());
|
|
||||||
y = EDIT_HEIGHT_FROM_CHAR_HEIGHT(y);
|
|
||||||
|
|
||||||
if ( sizeBtn.y < y )
|
|
||||||
{
|
|
||||||
// make the text tall enough
|
|
||||||
sizeBtn.y = y;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
return sizeBtn;
|
|
||||||
}
|
|
||||||
|
|
||||||
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");
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif //wxUSE_SPINBTN
|
#endif //wxUSE_SPINBTN
|
@@ -24,175 +24,94 @@
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl)
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxStaticBox, wxControl)
|
bool wxStaticBox::Create(
|
||||||
EVT_ERASE_BACKGROUND(wxStaticBox::OnEraseBackground)
|
wxWindow* pParent
|
||||||
END_EVENT_TABLE()
|
, wxWindowID vId
|
||||||
|
, const wxString& rsLabel
|
||||||
|
, const wxPoint& rPos
|
||||||
/*
|
, const wxSize& rSize
|
||||||
* Group box
|
, long lStyle
|
||||||
*/
|
, const wxString& rsName
|
||||||
|
)
|
||||||
bool wxStaticBox::Create(wxWindow *parent, wxWindowID id,
|
|
||||||
const wxString& label,
|
|
||||||
const wxPoint& pos,
|
|
||||||
const wxSize& size,
|
|
||||||
long style,
|
|
||||||
const wxString& name)
|
|
||||||
{
|
{
|
||||||
SetName(name);
|
if(!OS2CreateControl( pParent
|
||||||
|
,vId
|
||||||
if (parent) parent->AddChild(this);
|
,rPos
|
||||||
|
,rSize
|
||||||
SetBackgroundColour(parent->GetBackgroundColour()) ;
|
,lStyle
|
||||||
SetForegroundColour(parent->GetForegroundColour()) ;
|
#if wxUSE_VALIDATORS
|
||||||
|
,wxDefaultValidator
|
||||||
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
|
#endif
|
||||||
|
,rsName
|
||||||
|
))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
m_hWnd = (WXHWND)wx_button;
|
wxPoint vPos(0,0);
|
||||||
|
wxSize vSize(0,0);
|
||||||
|
|
||||||
// Subclass again for purposes of dialog editing mode
|
if (!OS2CreateControl( "STATIC"
|
||||||
SubclassWin(GetHWND());
|
,SS_GROUPBOX
|
||||||
|
,vPos
|
||||||
|
,vSize
|
||||||
|
,rsLabel
|
||||||
|
))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
SetFont(parent->GetFont());
|
wxColour vColour;
|
||||||
|
|
||||||
SetSize(x, y, width, height);
|
vColour.Set(wxString("BLACK"));
|
||||||
ShowWindow(wx_button, SW_SHOW);
|
|
||||||
*/
|
LONG lColor = (LONG)vColour.GetPixel();
|
||||||
return FALSE;
|
|
||||||
}
|
::WinSetPresParam( m_hWnd
|
||||||
|
,PP_FOREGROUNDCOLOR
|
||||||
|
,sizeof(LONG)
|
||||||
|
,(PVOID)&lColor
|
||||||
|
);
|
||||||
|
SetFont(pParent->GetFont());
|
||||||
|
SetSize( rPos.x
|
||||||
|
,rPos.y
|
||||||
|
,rSize.x
|
||||||
|
,rSize.y
|
||||||
|
);
|
||||||
|
return TRUE;
|
||||||
|
} // end of wxStaticBox::Create
|
||||||
|
|
||||||
wxSize wxStaticBox::DoGetBestSize() const
|
wxSize wxStaticBox::DoGetBestSize() const
|
||||||
{
|
{
|
||||||
int cx, cy;
|
int nCx;
|
||||||
wxGetCharSize(GetHWND(), &cx, &cy, (wxFont*)&GetFont());
|
int nCy;
|
||||||
|
int wBox;
|
||||||
|
|
||||||
int wBox;
|
wxGetCharSize( GetHWND()
|
||||||
GetTextExtent(wxGetWindowText(m_hWnd), &wBox, &cy);
|
,&nCx
|
||||||
|
,&nCy
|
||||||
|
,(wxFont*)&GetFont()
|
||||||
|
);
|
||||||
|
GetTextExtent( wxGetWindowText(m_hWnd)
|
||||||
|
,&wBox
|
||||||
|
,&nCy
|
||||||
|
);
|
||||||
|
wBox += 3 * nCx;
|
||||||
|
|
||||||
wBox += 3*cx;
|
int hBox = EDIT_HEIGHT_FROM_CHAR_HEIGHT(nCy);
|
||||||
int hBox = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy);
|
|
||||||
|
|
||||||
return wxSize(wBox, hBox);
|
return wxSize( wBox
|
||||||
}
|
,hBox
|
||||||
|
);
|
||||||
|
} // end of wxStaticBox::DoGetBestSize
|
||||||
|
|
||||||
WXHBRUSH wxStaticBox::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
MRESULT wxStaticBox::OS2WindowProc(
|
||||||
WXUINT message,
|
WXUINT nMsg
|
||||||
WXWPARAM wParam,
|
, WXWPARAM wParam
|
||||||
WXLPARAM lParam)
|
, WXLPARAM lParam
|
||||||
|
)
|
||||||
{
|
{
|
||||||
// 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Shouldn't erase the whole window, since the static box must only paint its
|
|
||||||
// outline.
|
|
||||||
void wxStaticBox::OnEraseBackground(wxEraseEvent& event)
|
|
||||||
{
|
|
||||||
// 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(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
|
|
||||||
{
|
|
||||||
// TODO:
|
|
||||||
/*
|
|
||||||
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(nMsg, wParam, lParam);
|
return wxControl::OS2WindowProc(nMsg, wParam, lParam);
|
||||||
}
|
} // end of wxStaticBox::OS2WindowProc
|
||||||
|
|
||||||
|
|
||||||
|
@@ -40,48 +40,50 @@ IMPLEMENT_DYNAMIC_CLASS(wxStaticLine, wxControl)
|
|||||||
// wxStaticLine
|
// wxStaticLine
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
bool wxStaticLine::Create( wxWindow *parent,
|
bool wxStaticLine::Create(
|
||||||
wxWindowID id,
|
wxWindow* pParent
|
||||||
const wxPoint &pos,
|
, wxWindowID vId
|
||||||
const wxSize &size,
|
, const wxPoint& rPos
|
||||||
long style,
|
, const wxSize& rSize
|
||||||
const wxString &name)
|
, long lStyle
|
||||||
|
, const wxString& rsName
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if ( !CreateBase(parent, id, pos, size, style, wxDefaultValidator, name) )
|
if (!CreateBase( pParent
|
||||||
|
,vId
|
||||||
|
,rPos
|
||||||
|
,rSize
|
||||||
|
,lStyle
|
||||||
|
,wxDefaultValidator
|
||||||
|
,rsName
|
||||||
|
))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
parent->AddChild(this);
|
pParent->AddChild(this);
|
||||||
|
|
||||||
wxSize sizeReal = AdjustSize(size);
|
wxSize vSizeReal = AdjustSize(rSize);
|
||||||
|
|
||||||
// TODO:
|
|
||||||
/*
|
|
||||||
m_hWnd = (WXHWND)::CreateWindow
|
|
||||||
(
|
|
||||||
wxT("STATIC"),
|
|
||||||
wxT(""),
|
|
||||||
WS_VISIBLE | WS_CHILD |
|
|
||||||
SS_GRAYRECT | SS_SUNKEN, // | SS_ETCHEDFRAME,
|
|
||||||
pos.x, pos.y, sizeReal.x, sizeReal.y,
|
|
||||||
GetWinHwnd(parent),
|
|
||||||
(HMENU)m_windowId,
|
|
||||||
wxGetInstance(),
|
|
||||||
NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
|
m_hWnd = (WXHWND)::WinCreateWindow( GetWinHwnd(pParent)
|
||||||
|
,WC_STATIC
|
||||||
|
,""
|
||||||
|
,WS_VISIBLE | SS_TEXT | DT_VCENTER | DT_CENTER
|
||||||
|
,rPos.x
|
||||||
|
,rPos.y
|
||||||
|
,vSizeReal.x
|
||||||
|
,vSizeReal.y
|
||||||
|
,GetWinHwnd(pParent)
|
||||||
|
,HWND_TOP
|
||||||
|
,(ULONG)m_windowId
|
||||||
|
,NULL
|
||||||
|
,NULL
|
||||||
|
);
|
||||||
if ( !m_hWnd )
|
if ( !m_hWnd )
|
||||||
{
|
{
|
||||||
#ifdef __WXDEBUG__
|
|
||||||
wxLogDebug(wxT("Failed to create static control"));
|
wxLogDebug(wxT("Failed to create static control"));
|
||||||
#endif
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
SubclassWin(m_hWnd);
|
SubclassWin(m_hWnd);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
*/
|
} // end of wxStaticLine::Create
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
#endif // wxUSE_STATLINE
|
||||||
|
@@ -80,10 +80,26 @@ bool wxStaticText::Create(
|
|||||||
|
|
||||||
wxCHECK_MSG(m_hWnd, FALSE, wxT("Failed to create static ctrl"));
|
wxCHECK_MSG(m_hWnd, FALSE, wxT("Failed to create static ctrl"));
|
||||||
|
|
||||||
|
wxColour vColour;
|
||||||
|
|
||||||
|
vColour.Set(wxString("BLACK"));
|
||||||
|
|
||||||
|
LONG lColor = (LONG)vColour.GetPixel();
|
||||||
|
|
||||||
|
::WinSetPresParam( m_hWnd
|
||||||
|
,PP_FOREGROUNDCOLOR
|
||||||
|
,sizeof(LONG)
|
||||||
|
,(PVOID)&lColor
|
||||||
|
);
|
||||||
|
|
||||||
SubclassWin(m_hWnd);
|
SubclassWin(m_hWnd);
|
||||||
wxControl::SetFont(pParent->GetFont());
|
wxControl::SetFont(pParent->GetFont());
|
||||||
SetSize(nX, nY, nWidth, nHeight);
|
SetSize( nX
|
||||||
return FALSE;
|
,nY
|
||||||
|
,nWidth
|
||||||
|
,nHeight
|
||||||
|
);
|
||||||
|
return TRUE;
|
||||||
} // end of wxStaticText::Create
|
} // end of wxStaticText::Create
|
||||||
|
|
||||||
wxSize wxStaticText::DoGetBestSize() const
|
wxSize wxStaticText::DoGetBestSize() const
|
||||||
@@ -96,7 +112,7 @@ wxSize wxStaticText::DoGetBestSize() const
|
|||||||
int nHeightLine = 0;
|
int nHeightLine = 0;
|
||||||
wxString sCurLine;
|
wxString sCurLine;
|
||||||
|
|
||||||
for ( const wxChar *pc = sText; ; pc++ )
|
for (const wxChar *pc = sText; ; pc++)
|
||||||
{
|
{
|
||||||
if ( *pc == wxT('\n') || *pc == wxT('\0') )
|
if ( *pc == wxT('\n') || *pc == wxT('\0') )
|
||||||
{
|
{
|
||||||
@@ -143,23 +159,6 @@ wxSize wxStaticText::DoGetBestSize() const
|
|||||||
);
|
);
|
||||||
} // end of wxStaticText::DoGetBestSize
|
} // end of wxStaticText::DoGetBestSize
|
||||||
|
|
||||||
void wxStaticText::SetLabel(
|
|
||||||
const wxString& rsLabel
|
|
||||||
)
|
|
||||||
{
|
|
||||||
::WinSetWindowText(GetHwnd(), rsLabel.c_str());
|
|
||||||
|
|
||||||
//
|
|
||||||
// Adjust the size of the window to fit to the label unless autoresizing is
|
|
||||||
// disabled
|
|
||||||
//
|
|
||||||
if (!(GetWindowStyle() & wxST_NO_AUTORESIZE))
|
|
||||||
{
|
|
||||||
DoSetSize(-1, -1, -1, -1, wxSIZE_AUTO_WIDTH | wxSIZE_AUTO_HEIGHT);
|
|
||||||
}
|
|
||||||
DoSetSize(-1, -1, -1, -1, wxSIZE_AUTO_WIDTH | wxSIZE_AUTO_HEIGHT);
|
|
||||||
} // end of wxStaticText::SetLabel
|
|
||||||
|
|
||||||
bool wxStaticText::SetFont(
|
bool wxStaticText::SetFont(
|
||||||
const wxFont& rFont
|
const wxFont& rFont
|
||||||
)
|
)
|
||||||
@@ -177,6 +176,23 @@ bool wxStaticText::SetFont(
|
|||||||
return bRet;
|
return bRet;
|
||||||
} // end of wxStaticText::SetFont
|
} // end of wxStaticText::SetFont
|
||||||
|
|
||||||
|
void wxStaticText::SetLabel(
|
||||||
|
const wxString& rsLabel
|
||||||
|
)
|
||||||
|
{
|
||||||
|
::WinSetWindowText(GetHwnd(), rsLabel.c_str());
|
||||||
|
|
||||||
|
//
|
||||||
|
// Adjust the size of the window to fit to the label unless autoresizing is
|
||||||
|
// disabled
|
||||||
|
//
|
||||||
|
if (!(GetWindowStyle() & wxST_NO_AUTORESIZE))
|
||||||
|
{
|
||||||
|
DoSetSize(-1, -1, -1, -1, wxSIZE_AUTO_WIDTH | wxSIZE_AUTO_HEIGHT);
|
||||||
|
}
|
||||||
|
DoSetSize(-1, -1, -1, -1, wxSIZE_AUTO_WIDTH | wxSIZE_AUTO_HEIGHT);
|
||||||
|
} // end of wxStaticText::SetLabel
|
||||||
|
|
||||||
MRESULT wxStaticText::OS2WindowProc(
|
MRESULT wxStaticText::OS2WindowProc(
|
||||||
WXUINT uMsg
|
WXUINT uMsg
|
||||||
, WXWPARAM wParam
|
, WXWPARAM wParam
|
||||||
|
@@ -1207,3 +1207,78 @@ void wxDrawBorder(
|
|||||||
}
|
}
|
||||||
} // end of wxDrawBorder
|
} // end of wxDrawBorder
|
||||||
|
|
||||||
|
void wxOS2SetFont(
|
||||||
|
HWND hWnd
|
||||||
|
, const wxFont& rFont
|
||||||
|
)
|
||||||
|
{
|
||||||
|
char zFont[128];
|
||||||
|
char zFacename[30];
|
||||||
|
char zWeight[30];
|
||||||
|
char zStyle[30];
|
||||||
|
|
||||||
|
if (hWnd == NULLHANDLE)
|
||||||
|
|
||||||
|
//
|
||||||
|
// The fonts available for Presentation Params are just three
|
||||||
|
// outline fonts, the rest are available to the GPI, so we must
|
||||||
|
// map the families to one of these three
|
||||||
|
//
|
||||||
|
switch(rFont.GetFamily())
|
||||||
|
{
|
||||||
|
case wxSCRIPT:
|
||||||
|
case wxDECORATIVE:
|
||||||
|
case wxROMAN:
|
||||||
|
strcpy(zFacename,"Times New Roman");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case wxTELETYPE:
|
||||||
|
case wxMODERN:
|
||||||
|
strcpy(zFacename, "Courier");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case wxSWISS:
|
||||||
|
case wxDEFAULT:
|
||||||
|
default:
|
||||||
|
strcpy(zFacename, "Helvetica");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(rFont.GetWeight())
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case wxNORMAL:
|
||||||
|
case wxLIGHT:
|
||||||
|
zWeight[0] = '\0';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case wxBOLD:
|
||||||
|
case wxFONTWEIGHT_MAX:
|
||||||
|
strcpy(zWeight, "Bold");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(rFont.GetStyle())
|
||||||
|
{
|
||||||
|
case wxITALIC:
|
||||||
|
case wxSLANT:
|
||||||
|
strcpy(zStyle, "Italic");
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
zStyle[0] = '\0';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
sprintf(zFont, "%d.%s", rFont.GetPointSize(), zFacename);
|
||||||
|
if (zWeight[0] != '\0')
|
||||||
|
{
|
||||||
|
strcat(zFont, " ");
|
||||||
|
strcat(zFont, zWeight);
|
||||||
|
}
|
||||||
|
if (zStyle[0] != '\0')
|
||||||
|
{
|
||||||
|
strcat(zFont, " ");
|
||||||
|
strcat(zFont, zStyle);
|
||||||
|
}
|
||||||
|
::WinSetPresParam(hWnd, PP_FONTNAMESIZE, strlen(zFont) + 1, (PVOID)zFont);
|
||||||
|
} // end of wxOS2SetFont
|
||||||
|
@@ -2543,6 +2543,48 @@ MRESULT wxWindowOS2::OS2WindowProc(
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case WM_CONTROL:
|
||||||
|
switch(SHORT2FROMMP(wParam))
|
||||||
|
{
|
||||||
|
case SPBN_UPARROW:
|
||||||
|
case SPBN_DOWNARROW:
|
||||||
|
case SPBN_CHANGE:
|
||||||
|
{
|
||||||
|
char zVal[10];
|
||||||
|
long lVal;
|
||||||
|
|
||||||
|
::WinSendMsg( HWNDFROMMP(lParam)
|
||||||
|
,SPBM_QUERYVALUE
|
||||||
|
,&zVal
|
||||||
|
,MPFROM2SHORT( (USHORT)10
|
||||||
|
,(USHORT)SPBQ_UPDATEIFVALID
|
||||||
|
)
|
||||||
|
);
|
||||||
|
lVal = atol(zVal);
|
||||||
|
bProcessed = OS2OnScroll( wxVERTICAL
|
||||||
|
,(int)SHORT2FROMMP(wParam)
|
||||||
|
,(int)lVal
|
||||||
|
,HWNDFROMMP(lParam)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SLN_SLIDERTRACK:
|
||||||
|
{
|
||||||
|
HWND hWnd = ::WinWindowFromID(GetHWND(), SHORT1FROMMP(wParam));
|
||||||
|
wxWindowOS2* pChild = wxFindWinFromHandle(hWnd);
|
||||||
|
|
||||||
|
if (pChild->IsKindOf(CLASSINFO(wxSlider)))
|
||||||
|
bProcessed = OS2OnScroll( wxVERTICAL
|
||||||
|
,(int)SHORT2FROMMP(wParam)
|
||||||
|
,(int)LONGFROMMP(lParam)
|
||||||
|
,hWnd
|
||||||
|
);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
#if defined(__VISAGECPP__) && (__IBMCPP__ >= 400)
|
#if defined(__VISAGECPP__) && (__IBMCPP__ >= 400)
|
||||||
case WM_CTLCOLORCHANGE:
|
case WM_CTLCOLORCHANGE:
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user