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
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxGauge)
|
||||
public:
|
||||
inline wxGauge() { m_rangeMax = 0; m_gaugePos = 0; }
|
||||
inline wxGauge() { m_nRangeMax = 0; m_nGaugePos = 0; }
|
||||
|
||||
inline wxGauge(wxWindow *parent, wxWindowID id,
|
||||
int range,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxGA_HORIZONTAL,
|
||||
inline wxGauge( wxWindow* pParent
|
||||
,wxWindowID vId
|
||||
,int nRange
|
||||
,const wxPoint& rPos = wxDefaultPosition
|
||||
,const wxSize& rSize = wxDefaultSize
|
||||
,long lStyle = wxGA_HORIZONTAL
|
||||
#if wxUSE_VALIDATORS
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
,const wxValidator& rValidator = wxDefaultValidator
|
||||
#endif
|
||||
const wxString& name = wxGaugeNameStr)
|
||||
,const wxString& rsName = wxGaugeNameStr
|
||||
)
|
||||
{
|
||||
Create(parent, id, range, pos, size, style, validator, name);
|
||||
Create( pParent
|
||||
,vId
|
||||
,nRange
|
||||
,rPos
|
||||
,rSize
|
||||
,lStyle
|
||||
#if wxUSE_VALIDATORS
|
||||
,rValidator
|
||||
#endif
|
||||
,rsName
|
||||
);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID id,
|
||||
int range,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxGA_HORIZONTAL,
|
||||
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& validator = wxDefaultValidator,
|
||||
,const wxValidator& rValidator = wxDefaultValidator
|
||||
#endif
|
||||
const wxString& name = wxGaugeNameStr);
|
||||
,const wxString& rsName = wxGaugeNameStr
|
||||
);
|
||||
|
||||
void SetShadowWidth(int w);
|
||||
void SetBezelFace(int w);
|
||||
void SetRange(int r);
|
||||
void SetValue(int pos);
|
||||
int GetShadowWidth(void) const;
|
||||
int GetBezelFace(void) const;
|
||||
int GetRange(void) const;
|
||||
int GetValue(void) const;
|
||||
|
||||
int GetShadowWidth() const ;
|
||||
int GetBezelFace() const ;
|
||||
int GetRange() const ;
|
||||
int GetValue() 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);
|
||||
|
||||
bool SetForegroundColour(const wxColour& col);
|
||||
bool SetBackgroundColour(const wxColour& col);
|
||||
|
||||
virtual void Command(wxCommandEvent& WXUNUSED(event)) {} ;
|
||||
inline virtual bool AcceptsFocus(void) const { return FALSE; }
|
||||
inline virtual void Command(wxCommandEvent& WXUNUSED(rEvent)) {};
|
||||
|
||||
protected:
|
||||
int m_rangeMax;
|
||||
int m_gaugePos;
|
||||
};
|
||||
int m_nRangeMax;
|
||||
int m_nGaugePos;
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxGauge)
|
||||
}; // end of CLASS wxGauge
|
||||
|
||||
#endif // _WX_GAUGE_H_
|
||||
|
||||
#endif
|
||||
// _WX_GAUGE_H_
|
||||
|
@@ -232,6 +232,10 @@ inline bool wxStyleHasBorder(long style)
|
||||
wxSUNKEN_BORDER | wxDOUBLE_BORDER)) != 0;
|
||||
}
|
||||
|
||||
WXDLLEXPORT extern void wxOS2SetFont( HWND hWnd
|
||||
,const wxFont& rFont
|
||||
);
|
||||
|
||||
|
||||
#endif
|
||||
// _WX_PRIVATE_H_
|
||||
|
@@ -19,105 +19,168 @@ class WXDLLEXPORT wxBitmap ;
|
||||
|
||||
class WXDLLEXPORT wxRadioBox: public wxControl, public wxRadioBoxBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxRadioBox)
|
||||
public:
|
||||
wxRadioBox();
|
||||
|
||||
inline wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
int n = 0, const wxString choices[] = NULL,
|
||||
int majorDim = 0, long style = wxRA_HORIZONTAL,
|
||||
inline wxRadioBox( wxWindow* pParent
|
||||
,wxWindowID vId
|
||||
,const wxString& rsTitle
|
||||
,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
|
||||
const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr)
|
||||
,const wxValidator& rVal = wxDefaultValidator
|
||||
#endif
|
||||
,const wxString& rsName = wxRadioBoxNameStr
|
||||
)
|
||||
{
|
||||
Create(parent, id, title, pos, size, n, choices, majorDim, style, val, name);
|
||||
Create( pParent
|
||||
,vId
|
||||
,rsTitle
|
||||
,rPos
|
||||
,rSize
|
||||
,nNum
|
||||
,asChoices
|
||||
,nMajorDim
|
||||
,lStyle
|
||||
#if wxUSE_VALIDATORS
|
||||
,rVal
|
||||
#endif
|
||||
,rsName
|
||||
);
|
||||
}
|
||||
|
||||
~wxRadioBox();
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID id, const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
int n = 0, const wxString choices[] = NULL,
|
||||
int majorDim = 0, long style = wxRA_HORIZONTAL,
|
||||
bool Create( wxWindow* pParent
|
||||
,wxWindowID vId
|
||||
,const wxString& rsTitle
|
||||
,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
|
||||
const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr);
|
||||
,const wxValidator& rVal = wxDefaultValidator
|
||||
#endif
|
||||
,const wxString& rsName = wxRadioBoxNameStr
|
||||
);
|
||||
|
||||
virtual bool OS2Command(WXUINT param, WXWORD id);
|
||||
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
||||
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
||||
|
||||
int FindString(const wxString& s) const;
|
||||
void SetSelection(int N);
|
||||
int GetSelection() const;
|
||||
virtual int GetCount() const;
|
||||
wxString GetString(int N) const;
|
||||
virtual void SetString(int n, const wxString& label);
|
||||
virtual int GetColumnCount() const;
|
||||
virtual int GetRowCount() const;
|
||||
|
||||
void GetSize(int *x, int *y) const;
|
||||
void GetPosition(int *x, int *y) const;
|
||||
|
||||
void SetLabel(int item, const wxString& label);
|
||||
void SetLabel(int item, wxBitmap *bitmap);
|
||||
wxString GetLabel(int item) const;
|
||||
bool Show(bool show);
|
||||
void SetFocus();
|
||||
bool Enable(bool enable);
|
||||
void Enable(int item, bool enable);
|
||||
void Show(int item, bool show) ;
|
||||
inline void SetLabelFont(const wxFont& WXUNUSED(font)) {};
|
||||
inline void SetButtonFont(const wxFont& font) { SetFont(font); }
|
||||
|
||||
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; }
|
||||
void Command(wxCommandEvent& rEvent);
|
||||
bool ContainsHWND(WXHWND hWnd) const;
|
||||
void SendNotificationEvent();
|
||||
bool Enable(bool bEnable);
|
||||
void Enable( int nItem
|
||||
,bool bEnable
|
||||
);
|
||||
int FindString(const wxString& sStr) const;
|
||||
|
||||
// get the number of buttons per column/row
|
||||
int GetNumVer() const;
|
||||
int GetNumHor() const;
|
||||
virtual WXHBRUSH OnCtlColor( WXHDC hDC
|
||||
,WXHWND hWnd
|
||||
,WXUINT uCtlColor
|
||||
,WXUINT uMessage
|
||||
,WXWPARAM wParam
|
||||
,WXLPARAM lParam
|
||||
);
|
||||
virtual bool OS2Command( WXUINT uParam
|
||||
,WXWORD wId
|
||||
);
|
||||
void SendNotificationEvent(void);
|
||||
void Show( int nItem
|
||||
,bool bShow = TRUE
|
||||
) ;
|
||||
bool Show(bool bShow);
|
||||
MRESULT WindowProc( WXUINT uMsg
|
||||
,WXWPARAM wParam
|
||||
,WXLPARAM lParam
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
virtual int GetColumnCount(void) const;
|
||||
virtual int GetCount(void) const;
|
||||
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;
|
||||
|
||||
inline void SetButtonFont(const wxFont& rFont) { SetFont(rFont); }
|
||||
void SetFocus(void);
|
||||
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:
|
||||
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;
|
||||
int m_noRowsOrCols;
|
||||
int m_selectedButton;
|
||||
WXHWND* m_ahRadioButtons;
|
||||
int m_nMajorDim ;
|
||||
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:
|
||||
virtual void SetLabel(const wxString& label)
|
||||
{ wxWindowBase::SetLabel(label); }
|
||||
wxString GetLabel() const
|
||||
{ return(wxWindowBase::GetLabel()); }
|
||||
};
|
||||
inline wxString GetLabel() const
|
||||
{ return wxWindowBase::GetLabel(); }
|
||||
inline void SetLabel(const wxString& rsLabel)
|
||||
{ wxWindowBase::SetLabel(rsLabel); }
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxRadioBox)
|
||||
}; // end of wxRadioBox
|
||||
|
||||
#endif
|
||||
// _WX_RADIOBOX_H_
|
||||
|
@@ -18,38 +18,55 @@ WXDLLEXPORT_DATA(extern const char*) wxRadioButtonNameStr;
|
||||
|
||||
class WXDLLEXPORT wxRadioButton: public wxControl
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxRadioButton)
|
||||
protected:
|
||||
public:
|
||||
inline wxRadioButton() {}
|
||||
inline wxRadioButton(wxWindow *parent, wxWindowID id,
|
||||
const wxString& label,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0,
|
||||
inline wxRadioButton( wxWindow* pParent
|
||||
,wxWindowID vId
|
||||
,const wxString& rsLabel
|
||||
,const wxPoint& rPos = wxDefaultPosition
|
||||
,const wxSize& rSize = wxDefaultSize
|
||||
,long lStyle = 0
|
||||
#if wxUSE_VALIDATORS
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
,const wxValidator& rValidator = wxDefaultValidator
|
||||
#endif
|
||||
const wxString& name = wxRadioButtonNameStr)
|
||||
,const wxString& rsName = wxRadioButtonNameStr
|
||||
)
|
||||
{
|
||||
Create(parent, id, label, pos, size, style, validator, name);
|
||||
Create( pParent
|
||||
,vId
|
||||
,rsLabel
|
||||
,rPos
|
||||
,rSize
|
||||
,lStyle
|
||||
#if wxUSE_VALIDATORS
|
||||
,rValidator
|
||||
#endif
|
||||
,rsName
|
||||
);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID id,
|
||||
const wxString& label,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0,
|
||||
bool Create( wxWindow* pParent
|
||||
,wxWindowID vId
|
||||
,const wxString& rsLabel
|
||||
,const wxPoint& rPos = wxDefaultPosition
|
||||
,const wxSize& rSize = wxDefaultSize
|
||||
,long lStyle = 0
|
||||
#if wxUSE_VALIDATORS
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
,const wxValidator& rValidator = wxDefaultValidator
|
||||
#endif
|
||||
const wxString& name = wxRadioButtonNameStr);
|
||||
,const wxString& rsName = wxRadioButtonNameStr
|
||||
);
|
||||
virtual void SetLabel(const wxString& rsLabel);
|
||||
virtual void SetValue(bool bVal);
|
||||
virtual bool GetValue(void) const ;
|
||||
|
||||
virtual void SetLabel(const wxString& label);
|
||||
virtual void SetValue(bool val);
|
||||
virtual bool GetValue() const ;
|
||||
|
||||
bool OS2Command(WXUINT param, WXWORD id);
|
||||
void Command(wxCommandEvent& event);
|
||||
};
|
||||
bool OS2Command( WXUINT wParam
|
||||
,WXWORD wId
|
||||
);
|
||||
void Command(wxCommandEvent& rEvent);
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxRadioButton)
|
||||
}; // end of wxRadioButton
|
||||
|
||||
#endif
|
||||
// _WX_RADIOBUT_H_
|
||||
|
@@ -376,5 +376,8 @@
|
||||
#define NO_TEXT_WINDOW_STREAM 1 // defined in textctrl.h for DLL builds
|
||||
#endif
|
||||
|
||||
#define wxUSE_UNICODE 0
|
||||
#define wxUSE_UNICODE_MSLU 0
|
||||
|
||||
#endif
|
||||
// _WX_SETUP_H_
|
||||
|
@@ -19,95 +19,135 @@ WXDLLEXPORT_DATA(extern const char*) wxSliderNameStr;
|
||||
// Slider
|
||||
class WXDLLEXPORT wxSlider: public wxSliderBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxSlider)
|
||||
|
||||
public:
|
||||
wxSlider();
|
||||
|
||||
inline wxSlider(wxWindow *parent, wxWindowID id,
|
||||
int value, int minValue, int maxValue,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxSL_HORIZONTAL,
|
||||
inline wxSlider( wxWindow* pParent
|
||||
,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& validator = wxDefaultValidator,
|
||||
,const wxValidator& rValidator = wxDefaultValidator
|
||||
#endif
|
||||
const wxString& name = wxSliderNameStr)
|
||||
,const wxString& rsName = wxSliderNameStr
|
||||
)
|
||||
{
|
||||
Create(parent, id, value, minValue, maxValue, pos, size, style, validator, name);
|
||||
Create( pParent
|
||||
,vId
|
||||
,nValue
|
||||
,nMinValue
|
||||
,nMaxValue
|
||||
,rPos
|
||||
,rSize
|
||||
,lStyle
|
||||
#if wxUSE_VALIDATORS
|
||||
,rValidator
|
||||
#endif
|
||||
,rsName
|
||||
);
|
||||
}
|
||||
|
||||
~wxSlider();
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID id,
|
||||
int value, int minValue, int maxValue,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxSL_HORIZONTAL,
|
||||
bool Create( wxWindow* pParent
|
||||
,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& validator = wxDefaultValidator,
|
||||
,const wxValidator& rValidator = wxDefaultValidator
|
||||
#endif
|
||||
const wxString& name = wxSliderNameStr);
|
||||
,const wxString& rsName = wxSliderNameStr
|
||||
);
|
||||
|
||||
virtual int GetValue() const ;
|
||||
virtual int GetValue(void) const ;
|
||||
virtual void SetValue(int);
|
||||
|
||||
void GetSize(int *x, int *y) const ;
|
||||
void GetPosition(int *x, int *y) const ;
|
||||
|
||||
bool Show(bool show);
|
||||
|
||||
void SetRange(int minValue, int maxValue);
|
||||
|
||||
inline int GetMin() const { return m_rangeMin; }
|
||||
inline int GetMax() const { return m_rangeMax; }
|
||||
|
||||
void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
|
||||
|
||||
void GetSize( int* pnX
|
||||
,int* pnY
|
||||
) const;
|
||||
void GetPosition( int* pnX
|
||||
,int* pnY
|
||||
) const ;
|
||||
bool Show(bool bShow);
|
||||
void SetRange( int nMinValue
|
||||
,int nMaxValue
|
||||
);
|
||||
|
||||
inline int GetMin(void) const { return m_nRangeMin; }
|
||||
inline int GetMax(void) const { return m_nRangeMax; }
|
||||
|
||||
//
|
||||
// For trackbars only
|
||||
void SetTickFreq(int n, int pos);
|
||||
inline int GetTickFreq() const { return m_tickFreq; }
|
||||
void SetPageSize(int pageSize);
|
||||
int GetPageSize() const ;
|
||||
void ClearSel() ;
|
||||
void ClearTicks() ;
|
||||
void SetLineSize(int lineSize);
|
||||
int GetLineSize() const ;
|
||||
int GetSelEnd() const ;
|
||||
int GetSelStart() const ;
|
||||
void SetSelection(int minPos, int maxPos);
|
||||
void SetThumbLength(int len) ;
|
||||
int GetThumbLength() const ;
|
||||
void SetTick(int tickPos) ;
|
||||
//
|
||||
void ClearSel(void);
|
||||
void ClearTicks(void);
|
||||
|
||||
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
|
||||
WXHWND GetStaticMin() const { return m_staticMin; }
|
||||
WXHWND GetStaticMax() const { return m_staticMax; }
|
||||
WXHWND GetEditValue() const { return m_staticValue; }
|
||||
//
|
||||
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& event);
|
||||
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
||||
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
||||
virtual bool OS2OnScroll(int orientation, WXWORD wParam,
|
||||
WXWORD pos, WXHWND control);
|
||||
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
|
||||
);
|
||||
|
||||
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;
|
||||
WXHWND m_hStaticMin;
|
||||
WXHWND m_hStaticMax;
|
||||
WXHWND m_hStaticValue;
|
||||
int m_nRangeMin;
|
||||
int m_nRangeMax;
|
||||
int m_nPageSize;
|
||||
int m_nLineSize;
|
||||
int m_nTickFreq;
|
||||
double m_dPixelToRange;
|
||||
int m_nThumbLength;
|
||||
|
||||
virtual void DoSetSize(int x, int y,
|
||||
int width, int height,
|
||||
int sizeFlags = wxSIZE_AUTO);
|
||||
};
|
||||
virtual void DoSetSize( int nX
|
||||
,int nY
|
||||
,int nWidth
|
||||
,int nHeight
|
||||
,int nSizeFlags = wxSIZE_AUTO
|
||||
);
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxSlider)
|
||||
}; // end of CLASS wxSlider
|
||||
|
||||
#endif
|
||||
// _WX_SLIDER_H_
|
||||
|
@@ -15,58 +15,66 @@
|
||||
#include "wx/control.h"
|
||||
#include "wx/event.h"
|
||||
|
||||
extern MRESULT EXPENTRY wxSpinCtrlWndProc(
|
||||
HWND hWnd
|
||||
, UINT uMessage
|
||||
, MPARAM wParam
|
||||
, MPARAM lParam
|
||||
);
|
||||
|
||||
class WXDLLEXPORT wxSpinButton: public wxSpinButtonBase
|
||||
{
|
||||
public:
|
||||
// Construction
|
||||
wxSpinButton() { }
|
||||
|
||||
inline wxSpinButton( wxWindow *parent
|
||||
,wxWindowID id = -1
|
||||
,const wxPoint& pos = wxDefaultPosition
|
||||
,const wxSize& size = wxDefaultSize
|
||||
,long style = wxSP_VERTICAL
|
||||
,const wxString& name = "wxSpinButton"
|
||||
inline wxSpinButton( wxWindow* pParent
|
||||
,wxWindowID vId = -1
|
||||
,const wxPoint& rPos = wxDefaultPosition
|
||||
,const wxSize& rSize = wxDefaultSize
|
||||
,long lStyle = wxSP_VERTICAL
|
||||
,const wxString& rsName = "wxSpinButton"
|
||||
)
|
||||
{
|
||||
Create(parent, id, pos, size, style, name);
|
||||
Create(pParent, vId, rPos, rSize, lStyle, rsName);
|
||||
}
|
||||
|
||||
virtual ~wxSpinButton();
|
||||
|
||||
bool Create( wxWindow *parent
|
||||
,wxWindowID id = -1
|
||||
,const wxPoint& pos = wxDefaultPosition
|
||||
,const wxSize& size = wxDefaultSize
|
||||
,long style = wxSP_VERTICAL
|
||||
,const wxString& name = "wxSpinButton"
|
||||
|
||||
bool Create( wxWindow* pParent
|
||||
,wxWindowID vId = -1
|
||||
,const wxPoint& rPos = wxDefaultPosition
|
||||
,const wxSize& rSize = wxDefaultSize
|
||||
,long lStyle = wxSP_VERTICAL
|
||||
,const wxString& rsName = "wxSpinButton"
|
||||
);
|
||||
|
||||
// Accessors
|
||||
virtual int GetValue() const ;
|
||||
virtual void SetValue(int val) ;
|
||||
virtual void SetRange( int minVal
|
||||
,int maxVal
|
||||
inline virtual int GetMax(void) const { return m_max; }
|
||||
inline virtual int GetMin(void) const { return m_min; }
|
||||
virtual int GetValue(void) const;
|
||||
inline bool IsVertical(void) const {return ((m_windowStyle & wxSP_VERTICAL) != 0); }
|
||||
virtual void SetValue(int nVal);
|
||||
virtual void SetRange( int nMinVal
|
||||
,int nMaxVal
|
||||
);
|
||||
|
||||
//
|
||||
// Implementation
|
||||
virtual bool OS2Command( WXUINT param
|
||||
,WXWORD id
|
||||
//
|
||||
virtual bool OS2Command( WXUINT wParam
|
||||
,WXWORD wId
|
||||
);
|
||||
virtual bool OS2OnNotify( int idCtrl
|
||||
,WXLPARAM lParam
|
||||
,WXLPARAM* result
|
||||
);
|
||||
virtual bool OS2OnScroll( int orientation
|
||||
virtual bool OS2OnScroll( int nOrientation
|
||||
,WXWORD wParam
|
||||
,WXWORD pos
|
||||
,WXHWND control
|
||||
,WXWORD wPos
|
||||
,WXHWND hControl
|
||||
);
|
||||
|
||||
inline virtual bool AcceptsFocus(void) const { return FALSE; }
|
||||
protected:
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxSpinButton)
|
||||
};
|
||||
#endif
|
||||
// _WX_SPINBUTT_H_
|
||||
}; // end of CLASS wxSpinButton
|
||||
|
||||
#endif // _WX_SPINBUTT_H_
|
||||
|
@@ -13,6 +13,9 @@
|
||||
#define _WX_MSW_SPINCTRL_H_
|
||||
|
||||
#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
|
||||
@@ -24,55 +27,99 @@ class WXDLLEXPORT wxSpinCtrl : public wxSpinButton
|
||||
{
|
||||
public:
|
||||
wxSpinCtrl() { }
|
||||
|
||||
wxSpinCtrl(wxWindow *parent,
|
||||
wxWindowID id = -1,
|
||||
const wxString& value = wxEmptyString,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxSP_ARROW_KEYS,
|
||||
int min = 0, int max = 100, int initial = 0,
|
||||
const wxString& name = _T("wxSpinCtrl"))
|
||||
wxSpinCtrl( wxWindow* pParent
|
||||
,wxWindowID vId = -1
|
||||
,const wxString& rsValue = wxEmptyString
|
||||
,const wxPoint& rPos = wxDefaultPosition
|
||||
,const wxSize& rSize = wxDefaultSize
|
||||
,long lStyle = wxSP_ARROW_KEYS
|
||||
,int nMin = 0
|
||||
,int nMax = 100
|
||||
,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,
|
||||
wxWindowID id = -1,
|
||||
const wxString& value = wxEmptyString,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxSP_ARROW_KEYS,
|
||||
int min = 0, int max = 100, int initial = 0,
|
||||
const wxString& name = _T("wxSpinCtrl"));
|
||||
bool Create(wxWindow* pParent
|
||||
,wxWindowID vId = -1
|
||||
,const wxString& rsValue = wxEmptyString
|
||||
,const wxPoint& rPos = wxDefaultPosition
|
||||
,const wxSize& rSize = wxDefaultSize
|
||||
,long lStyle = wxSP_ARROW_KEYS
|
||||
,int nMin = 0
|
||||
,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!)
|
||||
void SetValue(const wxString& text);
|
||||
//
|
||||
void SetValue(const wxString& rsText);
|
||||
|
||||
//
|
||||
// implementation only from now on
|
||||
// -------------------------------
|
||||
//
|
||||
virtual bool Enable(bool bEnable = TRUE);
|
||||
|
||||
virtual void SetValue(int val) { wxSpinButton::SetValue(val); }
|
||||
virtual int GetValue() const;
|
||||
virtual bool SetFont(const wxFont &font);
|
||||
virtual int GetValue(void) const;
|
||||
|
||||
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:
|
||||
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
|
||||
void OnSpinChange(wxSpinEvent& event);
|
||||
|
||||
WXHWND m_hwndBuddy;
|
||||
WXHWND m_hWndBuddy;
|
||||
static wxArraySpins m_svAllSpins;
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxSpinCtrl)
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
}; // end of CLASS wxSpinCtrl
|
||||
|
||||
#endif // _WX_MSW_SPINCTRL_H_
|
||||
|
||||
|
@@ -60,6 +60,10 @@ class WXDLLEXPORT wxStaticBitmap : public wxStaticBitmapBase
|
||||
|
||||
// overriden base class virtuals
|
||||
virtual bool AcceptsFocus() const { return FALSE; }
|
||||
virtual MRESULT OS2WindowProc( WXUINT uMsg
|
||||
,WXWPARAM wParam
|
||||
,WXLPARAM lParam
|
||||
);
|
||||
|
||||
protected:
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
@@ -77,7 +81,7 @@ protected:
|
||||
wxGDIImage* m_pImage;
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxStaticBitmap)
|
||||
};
|
||||
}; // end of wxStaticBitmap
|
||||
|
||||
#endif
|
||||
// _WX_STATBMP_H_
|
||||
|
@@ -19,50 +19,49 @@ WXDLLEXPORT_DATA(extern const char*) wxStaticBoxNameStr;
|
||||
// Group box
|
||||
class WXDLLEXPORT wxStaticBox : public wxStaticBoxBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxStaticBox)
|
||||
|
||||
public:
|
||||
inline wxStaticBox() {}
|
||||
inline wxStaticBox( wxWindow* parent
|
||||
,wxWindowID id
|
||||
,const wxString& label
|
||||
,const wxPoint& pos = wxDefaultPosition
|
||||
,const wxSize& size = wxDefaultSize
|
||||
,long style = 0
|
||||
,const wxString& name = wxStaticBoxNameStr
|
||||
inline wxStaticBox( wxWindow* pParent
|
||||
,wxWindowID vId
|
||||
,const wxString& rsLabel
|
||||
,const wxPoint& rPos = wxDefaultPosition
|
||||
,const wxSize& rSize = wxDefaultSize
|
||||
,long lStyle = 0
|
||||
,const wxString& rsName = wxStaticBoxNameStr
|
||||
)
|
||||
{
|
||||
Create(parent, id, label, pos, size, style, name);
|
||||
Create(pParent, vId, rsLabel, rPos, rSize, lStyle, rsName);
|
||||
}
|
||||
|
||||
bool Create( wxWindow* parent
|
||||
,wxWindowID id
|
||||
,const wxString& label
|
||||
,const wxPoint& pos = wxDefaultPosition
|
||||
,const wxSize& size = wxDefaultSize
|
||||
,long style = 0
|
||||
,const wxString& name = wxStaticBoxNameStr
|
||||
bool Create( wxWindow* pParent
|
||||
,wxWindowID vId
|
||||
,const wxString& rsLabel
|
||||
,const wxPoint& rPos = wxDefaultPosition
|
||||
,const wxSize& rSize = wxDefaultSize
|
||||
,long lStyle = 0
|
||||
,const wxString& rsName = wxStaticBoxNameStr
|
||||
);
|
||||
|
||||
//
|
||||
// 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
|
||||
virtual bool AcceptsFocus() const { return FALSE; }
|
||||
//
|
||||
inline virtual bool AcceptsFocus(void) const { return FALSE; }
|
||||
|
||||
protected:
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
virtual wxSize DoGetBestSize(void) const;
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
DECLARE_DYNAMIC_CLASS(wxStaticBox)
|
||||
}; // end of CLASS wxStaticBox
|
||||
|
||||
#endif
|
||||
// _WX_STATBOX_H_
|
||||
|
@@ -21,29 +21,62 @@
|
||||
|
||||
class WXDLLEXPORT wxStaticLine : public wxStaticLineBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxStaticLine)
|
||||
|
||||
public:
|
||||
// constructors and pseudo-constructors
|
||||
wxStaticLine() { }
|
||||
|
||||
wxStaticLine( wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint &pos = wxDefaultPosition,
|
||||
const wxSize &size = wxDefaultSize,
|
||||
long style = wxLI_HORIZONTAL,
|
||||
const wxString &name = wxStaticTextNameStr )
|
||||
wxStaticLine( wxWindow* pParent
|
||||
,wxWindowID vId
|
||||
,const wxPoint& rPos = wxDefaultPosition
|
||||
,const wxSize& rSize = wxDefaultSize
|
||||
,long lStyle = wxLI_HORIZONTAL
|
||||
,const wxString& rsName = wxStaticTextNameStr
|
||||
)
|
||||
{
|
||||
Create(parent, id, pos, size, style, name);
|
||||
Create(pParent, vId, rPos, rSize, lStyle, rsName);
|
||||
}
|
||||
|
||||
bool Create( wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint &pos = wxDefaultPosition,
|
||||
const wxSize &size = wxDefaultSize,
|
||||
long style = wxLI_HORIZONTAL,
|
||||
const wxString &name = wxStaticTextNameStr );
|
||||
};
|
||||
bool Create( wxWindow* pParent
|
||||
,wxWindowID vId
|
||||
,const wxPoint& rPos = wxDefaultPosition
|
||||
,const wxSize& rSize = wxDefaultSize
|
||||
,long lStyle = wxLI_HORIZONTAL
|
||||
,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_
|
||||
|
||||
|
@@ -22,11 +22,8 @@ WXDLLEXPORT_DATA(extern const char*) wxStaticTextNameStr;
|
||||
|
||||
class WXDLLEXPORT wxStaticText : public wxControl
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxStaticText)
|
||||
|
||||
public:
|
||||
inline wxStaticText() { }
|
||||
|
||||
inline wxStaticText( wxWindow* pParent
|
||||
,wxWindowID vId
|
||||
,const wxString& rsLabel
|
||||
@@ -69,6 +66,9 @@ class WXDLLEXPORT wxStaticText : public wxControl
|
||||
|
||||
protected:
|
||||
virtual wxSize DoGetBestSize(void) const;
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxStaticText)
|
||||
}; // end of CLASS wxStaticText
|
||||
|
||||
#endif
|
||||
|
@@ -134,6 +134,8 @@ bool wxControl::OS2CreateControl(
|
||||
|
||||
if ((strcmp(zClassname, "COMBOBOX")) == 0)
|
||||
zClass = WC_COMBOBOX;
|
||||
else if ((strcmp(zClassname, "STATIC")) == 0)
|
||||
zClass = WC_STATIC;
|
||||
dwStyle |= WS_VISIBLE;
|
||||
m_hWnd = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(GetParent()) // Parent window handle
|
||||
,(PSZ)zClassname // Window class
|
||||
|
1292
src/os2/gauge.cpp
1292
src/os2/gauge.cpp
File diff suppressed because it is too large
Load Diff
1757
src/os2/radiobox.cpp
1757
src/os2/radiobox.cpp
File diff suppressed because it is too large
Load Diff
@@ -27,197 +27,153 @@
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxRadioButton, wxControl)
|
||||
|
||||
bool wxRadioButton::OS2Command(WXUINT param, WXWORD id)
|
||||
void wxRadioButton::Command (
|
||||
wxCommandEvent& rEvent
|
||||
)
|
||||
{
|
||||
if (param == BN_CLICKED)
|
||||
{
|
||||
wxCommandEvent event(wxEVT_COMMAND_RADIOBUTTON_SELECTED, m_windowId);
|
||||
event.SetEventObject( this );
|
||||
ProcessCommand(event);
|
||||
return TRUE;
|
||||
}
|
||||
else return FALSE;
|
||||
}
|
||||
SetValue ((rEvent.GetInt() != 0) );
|
||||
ProcessCommand (rEvent);
|
||||
} // end of wxRadioButton::Command
|
||||
|
||||
bool wxRadioButton::Create(wxWindow *parent, wxWindowID id,
|
||||
const wxString& label,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size, long style,
|
||||
bool wxRadioButton::Create(
|
||||
wxWindow* pParent
|
||||
, wxWindowID vId
|
||||
, const wxString& rsLabel
|
||||
, const wxPoint& rPos
|
||||
, const wxSize& rSize
|
||||
, long lStyle
|
||||
#if wxUSE_VALIDATORS
|
||||
const wxValidator& validator,
|
||||
, const wxValidator& rValidator
|
||||
#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
|
||||
SetValidator(validator);
|
||||
SetValidator(rValidator);
|
||||
#endif
|
||||
|
||||
if (parent) parent->AddChild(this);
|
||||
if (pParent)
|
||||
pParent->AddChild(this);
|
||||
|
||||
SetBackgroundColour(parent->GetBackgroundColour());
|
||||
SetForegroundColour(parent->GetForegroundColour());
|
||||
SetBackgroundColour(pParent->GetBackgroundColour());
|
||||
SetForegroundColour(pParent->GetForegroundColour());
|
||||
|
||||
if ( id == -1 )
|
||||
if (vId == -1)
|
||||
m_windowId = (int)NewControlId();
|
||||
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 ;
|
||||
m_windowStyle = lStyle ;
|
||||
|
||||
// TODO create radiobutton
|
||||
/*
|
||||
long groupStyle = 0;
|
||||
if (m_windowStyle & wxRB_GROUP)
|
||||
groupStyle = WS_GROUP;
|
||||
lGroupStyle = 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);
|
||||
lsStyle = lGroupStyle | BS_AUTORADIOBUTTON | WS_VISIBLE ;
|
||||
|
||||
if (m_windowStyle & wxCLIP_SIBLINGS )
|
||||
lsStyle |= WS_CLIPSIBLINGS;
|
||||
m_hWnd = (WXHWND)::WinCreateWindow ( GetHwndOf(pParent)
|
||||
,WC_BUTTON
|
||||
,rsLabel.c_str()
|
||||
,lsStyle
|
||||
,0, 0, 0, 0
|
||||
,GetWinHwnd(pParent)
|
||||
,HWND_TOP
|
||||
,(HMENU)m_windowId
|
||||
,NULL
|
||||
,NULL
|
||||
);
|
||||
wxCHECK_MSG(m_hWnd, FALSE, wxT("Failed to create radiobutton"));
|
||||
|
||||
|
||||
SetFont(parent->GetFont());
|
||||
|
||||
// Subclass again for purposes of dialog editing mode
|
||||
SubclassWin((WXHWND)m_hWnd);
|
||||
|
||||
// SetValue(value);
|
||||
*/
|
||||
|
||||
// start GRW fix
|
||||
if (label != wxT(""))
|
||||
if (rsLabel != wxT(""))
|
||||
{
|
||||
int label_width, label_height;
|
||||
GetTextExtent(label, &label_width, &label_height, NULL, NULL, & this->GetFont());
|
||||
if (width < 0)
|
||||
width = (int)(label_width + RADIO_SIZE);
|
||||
if (height<0)
|
||||
int nLabelWidth;
|
||||
int nLabelHeight;
|
||||
|
||||
GetTextExtent( rsLabel
|
||||
,&nLabelWidth
|
||||
,&nLabelHeight
|
||||
,NULL
|
||||
,NULL
|
||||
,&this->GetFont()
|
||||
);
|
||||
if (nWidth < 0)
|
||||
nWidth = (int)(nLabelWidth + RADIO_SIZE);
|
||||
if (nHeight<0)
|
||||
{
|
||||
height = (int)(label_height);
|
||||
if (height < RADIO_SIZE)
|
||||
height = RADIO_SIZE;
|
||||
nHeight = (int)(nLabelHeight);
|
||||
if (nHeight < RADIO_SIZE)
|
||||
nHeight = RADIO_SIZE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (width < 0)
|
||||
width = RADIO_SIZE;
|
||||
if (height < 0)
|
||||
height = RADIO_SIZE;
|
||||
if (nWidth < 0)
|
||||
nWidth = RADIO_SIZE;
|
||||
if (nHeight < 0)
|
||||
nHeight = RADIO_SIZE;
|
||||
}
|
||||
// end GRW fix
|
||||
|
||||
SetSize(x, y, width, height);
|
||||
//
|
||||
// Subclass again for purposes of dialog editing mode
|
||||
//
|
||||
SubclassWin((WXHWND)m_hWnd);
|
||||
SetFont(pParent->GetFont());
|
||||
SetSize( nX
|
||||
,nY
|
||||
,nWidth
|
||||
,nHeight
|
||||
);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void wxRadioButton::SetLabel(const wxString& label)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxRadioButton::SetValue(bool value)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
} // end of wxRadioButton::Create
|
||||
|
||||
//
|
||||
// Get single selection, for single choice list items
|
||||
//
|
||||
bool wxRadioButton::GetValue() const
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
return((::WinSendMsg((HWND) GetHWND(), BM_QUERYCHECK, (MPARAM)0L, (MPARAM)0L) != 0));
|
||||
} // end of wxRadioButton::GetValue
|
||||
|
||||
void wxRadioButton::Command (wxCommandEvent & event)
|
||||
bool wxRadioButton::OS2Command(
|
||||
WXUINT wParam
|
||||
, WXWORD wId
|
||||
)
|
||||
{
|
||||
SetValue ( (event.m_commandInt != 0) );
|
||||
ProcessCommand (event);
|
||||
}
|
||||
|
||||
// Not implemented
|
||||
#if 0
|
||||
|
||||
bool wxBitmapRadioButton::Create(wxWindow *parent, wxWindowID id,
|
||||
const wxBitmap *bitmap,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size, long style,
|
||||
#if wxUSE_VALIDATORS
|
||||
const wxValidator& validator,
|
||||
#endif
|
||||
const wxString& name)
|
||||
if (wParam == BN_CLICKED)
|
||||
{
|
||||
SetName(name);
|
||||
#if wxUSE_VALIDATORS
|
||||
SetValidator(validator);
|
||||
#endif
|
||||
|
||||
if (parent) parent->AddChild(this);
|
||||
SetBackgroundColour(parent->GetBackgroundColour());
|
||||
SetForegroundColour(parent->GetForegroundColour());
|
||||
|
||||
if ( id == -1 )
|
||||
m_windowId = (int)NewControlId();
|
||||
else
|
||||
m_windowId = id;
|
||||
|
||||
int x = pos.x;
|
||||
int y = pos.y;
|
||||
int width = size.x;
|
||||
int height = size.y;
|
||||
m_windowStyle = style ;
|
||||
|
||||
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);
|
||||
wxCommandEvent rEvent( wxEVT_COMMAND_RADIOBUTTON_SELECTED
|
||||
,m_windowId
|
||||
);
|
||||
|
||||
rEvent.SetEventObject(this);
|
||||
ProcessCommand(rEvent);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wxBitmapRadioButton::SetLabel(const wxBitmap *bitmap)
|
||||
{
|
||||
}
|
||||
|
||||
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);
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
} // end of wxRadioButton::OS2Command
|
||||
|
||||
void wxRadioButton::SetLabel(
|
||||
const wxString& rsLabel
|
||||
)
|
||||
{
|
||||
::WinSetWindowText((HWND)GetHWND(), (const char *)rsLabel.c_str());
|
||||
} // end of wxRadioButton::SetLabel
|
||||
|
||||
void wxRadioButton::SetValue(
|
||||
bool bValue
|
||||
)
|
||||
{
|
||||
::WinSendMsg((HWND)GetHWND(), BM_SETCHECK, (MPARAM)bValue, (MPARAM)0);
|
||||
} // end of wxRadioButton::SetValue
|
||||
|
||||
#endif
|
1263
src/os2/slider.cpp
1263
src/os2/slider.cpp
File diff suppressed because it is too large
Load Diff
@@ -29,6 +29,11 @@
|
||||
|
||||
#include "wx/spinbutt.h"
|
||||
|
||||
extern void wxAssociateWinWithHandle( HWND hWnd
|
||||
,wxWindowOS2* pWin
|
||||
);
|
||||
static WXFARPROC fnWndProcSpinCtrl = (WXFARPROC)NULL;
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxNotifyEvent)
|
||||
|
||||
#include "wx/os2/private.h"
|
||||
@@ -44,29 +49,106 @@ IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxNotifyEvent)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxSpinButton, wxControl)
|
||||
|
||||
bool wxSpinButton::Create(
|
||||
wxWindow* parent
|
||||
, wxWindowID id
|
||||
, const wxPoint& pos
|
||||
, const wxSize& size
|
||||
, long style
|
||||
, const wxString& name
|
||||
wxWindow* pParent
|
||||
, wxWindowID vId
|
||||
, const wxPoint& rPos
|
||||
, const wxSize& rSize
|
||||
, long lStyle
|
||||
, 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;
|
||||
|
||||
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()
|
||||
{
|
||||
}
|
||||
} // end of wxSpinButton::~wxSpinButton
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// size calculation
|
||||
@@ -74,23 +156,12 @@ wxSpinButton::~wxSpinButton()
|
||||
|
||||
wxSize wxSpinButton::DoGetBestSize() const
|
||||
{
|
||||
// TODO:
|
||||
/*
|
||||
if ( (GetWindowStyle() & wxSP_VERTICAL) != 0 )
|
||||
{
|
||||
// vertical control
|
||||
return wxSize(GetSystemMetrics(SM_CXVSCROLL),
|
||||
2*GetSystemMetrics(SM_CYVSCROLL));
|
||||
}
|
||||
else
|
||||
{
|
||||
// horizontal control
|
||||
return wxSize(2*GetSystemMetrics(SM_CXHSCROLL),
|
||||
GetSystemMetrics(SM_CYHSCROLL));
|
||||
}
|
||||
*/
|
||||
return wxSize(0, 0);
|
||||
}
|
||||
//
|
||||
// OS/2 PM does not really have system metrics so we'll just set our best guess
|
||||
// Also we have no horizontal spin buttons.
|
||||
//
|
||||
return (wxSize(10,20));
|
||||
} // end of wxSpinButton::DoGetBestSize
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Attributes
|
||||
@@ -98,66 +169,68 @@ wxSize wxSpinButton::DoGetBestSize() const
|
||||
|
||||
int wxSpinButton::GetValue() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
int nVal = 0;
|
||||
long lVal = 0L;
|
||||
char zVal[10];
|
||||
|
||||
void wxSpinButton::SetValue(int val)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
::WinSendMsg( GetHwnd()
|
||||
,SPBM_QUERYVALUE
|
||||
,MPFROMP(zVal)
|
||||
,MPFROM2SHORT( (USHORT)10
|
||||
,SPBQ_UPDATEIFVALID
|
||||
)
|
||||
);
|
||||
lVal = atol(zVal);
|
||||
return ((int)lVal);
|
||||
} // end of wxSpinButton::GetValue
|
||||
|
||||
void wxSpinButton::SetRange(int minVal, int maxVal)
|
||||
bool wxSpinButton::OS2OnScroll(
|
||||
int nOrientation
|
||||
, WXWORD wParam
|
||||
, WXWORD wPos
|
||||
, WXHWND hControl
|
||||
)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
wxCHECK_MSG(hControl, FALSE, wxT("scrolling what?") )
|
||||
|
||||
bool wxSpinButton::OS2OnScroll(int orientation, WXWORD wParam,
|
||||
WXWORD pos, WXHWND control)
|
||||
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
|
||||
)
|
||||
{
|
||||
wxCHECK_MSG( control, FALSE, wxT("scrolling what?") )
|
||||
// TODO:
|
||||
/*
|
||||
if ( wParam != SB_THUMBPOSITION )
|
||||
{
|
||||
// probable SB_ENDSCROLL - we don't react to it
|
||||
return FALSE;
|
||||
}
|
||||
} // end of wxSpinButton::OS2Command
|
||||
|
||||
wxSpinEvent event(wxEVT_SCROLL_THUMBTRACK, m_windowId);
|
||||
event.SetPosition((short)pos); // cast is important for negative values!
|
||||
event.SetEventObject(this);
|
||||
|
||||
return GetEventHandler()->ProcessEvent(event);
|
||||
*/
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxSpinButton::OS2OnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
|
||||
void wxSpinButton::SetRange(
|
||||
int nMinVal
|
||||
, int nMaxVal
|
||||
)
|
||||
{
|
||||
// TODO:
|
||||
/*
|
||||
LPNM_UPDOWN lpnmud = (LPNM_UPDOWN)lParam;
|
||||
m_min = nMinVal;
|
||||
m_max = nMaxVal;
|
||||
|
||||
wxSpinEvent event(lpnmud->iDelta > 0 ? wxEVT_SCROLL_LINEUP
|
||||
: wxEVT_SCROLL_LINEDOWN,
|
||||
m_windowId);
|
||||
event.SetPosition(lpnmud->iPos + lpnmud->iDelta);
|
||||
event.SetEventObject(this);
|
||||
::WinSendMsg( GetHwnd()
|
||||
,SPBM_SETLIMITS
|
||||
,MPFROMLONG(nMaxVal)
|
||||
,MPFROMLONG(nMinVal)
|
||||
);
|
||||
} // end of wxSpinButton::SetRange
|
||||
|
||||
bool processed = GetEventHandler()->ProcessEvent(event);
|
||||
|
||||
*result = event.IsAllowed() ? 0 : 1;
|
||||
|
||||
return processed;
|
||||
*/
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxSpinButton::OS2Command(WXUINT cmd, WXWORD id)
|
||||
void wxSpinButton::SetValue(
|
||||
int nValue
|
||||
)
|
||||
{
|
||||
// No command messages
|
||||
return FALSE;
|
||||
}
|
||||
::WinSendMsg(GetHwnd(), SPBM_SETCURRENTVALUE, MPFROMLONG(nValue), MPARAM(0));
|
||||
} // end of wxSpinButton::SetValue
|
||||
|
||||
#endif //wxUSE_SPINBTN
|
||||
|
@@ -40,6 +40,11 @@
|
||||
// macros
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
extern void wxAssociateWinWithHandle( HWND hWnd
|
||||
,wxWindowOS2* pWin
|
||||
);
|
||||
static WXFARPROC fnWndProcSpinCtrl = (WXFARPROC)NULL;
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrl, wxControl)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxSpinCtrl, wxSpinButton)
|
||||
@@ -55,244 +60,423 @@ static const int MARGIN_BETWEEN = 5;
|
||||
// ============================================================================
|
||||
// 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
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool wxSpinCtrl::Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& value,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
int min, int max, int initial,
|
||||
const wxString& name)
|
||||
bool wxSpinCtrl::Create(
|
||||
wxWindow* pParent
|
||||
, wxWindowID vId
|
||||
, const wxString& rsValue
|
||||
, const wxPoint& rPos
|
||||
, const wxSize& rSize
|
||||
, long lStyle
|
||||
, int nMin
|
||||
, int nMax
|
||||
, int nInitial
|
||||
, const wxString& rsName
|
||||
)
|
||||
{
|
||||
// TODO:
|
||||
/*
|
||||
// before using DoGetBestSize(), have to set style to let the base class
|
||||
// know whether this is a horizontal or vertical control (we're always
|
||||
// vertical)
|
||||
style |= wxSP_VERTICAL;
|
||||
SetWindowStyle(style);
|
||||
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;
|
||||
|
||||
// calculate the sizes: the size given is the toal size for both controls
|
||||
// and we need to fit them both in the given width (height is the same)
|
||||
wxSize sizeText(size), sizeBtn(size);
|
||||
sizeBtn.x = wxSpinButton::DoGetBestSize().x;
|
||||
if ( sizeText.x <= 0 )
|
||||
{
|
||||
// DEFAULT_ITEM_WIDTH is the default width for the text control
|
||||
sizeText.x = DEFAULT_ITEM_WIDTH + MARGIN_BETWEEN + sizeBtn.x;
|
||||
}
|
||||
int lSstyle = 0L;
|
||||
|
||||
sizeText.x -= sizeBtn.x + MARGIN_BETWEEN;
|
||||
if ( sizeText.x <= 0 )
|
||||
{
|
||||
wxLogDebug(_T("not enough space for wxSpinCtrl!"));
|
||||
}
|
||||
lSstyle = WS_VISIBLE |
|
||||
WS_TABSTOP |
|
||||
SPBS_MASTER | // We use only single field spin buttons
|
||||
SPBS_NUMERICONLY; // We default to numeric data
|
||||
|
||||
wxPoint posBtn(pos);
|
||||
posBtn.x += sizeText.x + MARGIN_BETWEEN;
|
||||
if (m_windowStyle & wxCLIP_SIBLINGS )
|
||||
lSstyle |= WS_CLIPSIBLINGS;
|
||||
|
||||
// create the spin button
|
||||
if ( !wxSpinButton::Create(parent, id, posBtn, sizeBtn, style, name) )
|
||||
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;
|
||||
}
|
||||
|
||||
SetRange(min, max);
|
||||
SetValue(initial);
|
||||
|
||||
// create the text window
|
||||
m_hwndBuddy = (WXHWND)::CreateWindowEx
|
||||
(
|
||||
WS_EX_CLIENTEDGE, // sunken border
|
||||
_T("EDIT"), // window class
|
||||
NULL, // no window title
|
||||
WS_CHILD | WS_BORDER, // style (will be shown later)
|
||||
pos.x, pos.y, // position
|
||||
0, 0, // size (will be set later)
|
||||
GetHwndOf(parent), // parent
|
||||
(HMENU)-1, // control id
|
||||
wxGetInstance(), // app instance
|
||||
NULL // unused client data
|
||||
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
|
||||
);
|
||||
|
||||
if ( !m_hwndBuddy )
|
||||
{
|
||||
wxLogLastError("CreateWindow(buddy text window)");
|
||||
SetRange(nMin, nMax);
|
||||
SetValue(nInitial);
|
||||
|
||||
//
|
||||
// For OS/2 we'll just set our handle into our long data
|
||||
//
|
||||
wxAssociateWinWithHandle( m_hWnd
|
||||
,(wxWindowOS2*)this
|
||||
);
|
||||
::WinSetWindowULong(GetHwnd(), QWL_USER, (LONG)this);
|
||||
fnWndProcSpinCtrl = (WXFARPROC)::WinSubclassWindow(m_hWnd, (PFNWP)wxSpinCtrlWndProc);
|
||||
m_svAllSpins.Add(this);
|
||||
return TRUE;
|
||||
} // end of wxSpinCtrl::Create
|
||||
|
||||
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)
|
||||
{
|
||||
//
|
||||
// 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;
|
||||
}
|
||||
::WinEnableWindow(GetHwnd(), bEnable);
|
||||
return TRUE;
|
||||
} // end of wxSpinCtrl::Enable
|
||||
|
||||
// should have the same font as the other controls
|
||||
SetFont(GetParent()->GetFont());
|
||||
|
||||
// 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 )
|
||||
wxSpinCtrl* wxSpinCtrl::GetSpinForTextCtrl(
|
||||
WXHWND hWndBuddy
|
||||
)
|
||||
{
|
||||
int cx, cy;
|
||||
wxGetCharSize(GetHWND(), &cx, &cy, &GetFont());
|
||||
wxSpinCtrl* pSpin = (wxSpinCtrl *)::WinQueryWindowULong( (HWND)hWndBuddy
|
||||
,QWL_USER
|
||||
);
|
||||
int i = m_svAllSpins.Index(pSpin);
|
||||
|
||||
sizeText.y = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy);
|
||||
}
|
||||
if (i == wxNOT_FOUND)
|
||||
return NULL;
|
||||
|
||||
DoMoveWindow(pos.x, pos.y,
|
||||
sizeText.x + sizeBtn.x + MARGIN_BETWEEN, sizeText.y);
|
||||
// sanity check
|
||||
wxASSERT_MSG( pSpin->m_hWndBuddy == hWndBuddy,
|
||||
_T("wxSpinCtrl has incorrect buddy HWND!") );
|
||||
|
||||
(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:
|
||||
/*
|
||||
if ( !::SetWindowText((HWND)m_hwndBuddy, text.c_str()) )
|
||||
{
|
||||
wxLogLastError("SetWindowText(buddy)");
|
||||
}
|
||||
*/
|
||||
}
|
||||
return pSpin;
|
||||
} // end of wxSpinCtrl::GetSpinForTextCtrl
|
||||
|
||||
int wxSpinCtrl::GetValue() const
|
||||
{
|
||||
wxString val = wxGetWindowText(m_hwndBuddy);
|
||||
long lVal = 0L;
|
||||
char zVal[10];
|
||||
|
||||
long n;
|
||||
if ( (wxSscanf(val, wxT("%lu"), &n) != 1) )
|
||||
n = INT_MIN;
|
||||
::WinSendMsg( GetHwnd()
|
||||
,SPBM_QUERYVALUE
|
||||
,MPFROMP(zVal)
|
||||
,MPFROM2SHORT( (USHORT)10
|
||||
,SPBQ_UPDATEIFVALID
|
||||
)
|
||||
);
|
||||
lVal - atol(zVal);
|
||||
return lVal;
|
||||
} // end of wxSpinCtrl::GetValue
|
||||
|
||||
return n;
|
||||
void wxSpinCtrl::OnChar (
|
||||
wxKeyEvent& rEvent
|
||||
)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// forward some methods to subcontrols
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool wxSpinCtrl::SetFont(const wxFont& font)
|
||||
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.
|
||||
//
|
||||
{
|
||||
if ( !wxWindowBase::SetFont(font) )
|
||||
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
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
WXHANDLE hFont = GetFont().GetResourceHandle();
|
||||
// TODO:
|
||||
/*
|
||||
(void)::SendMessage((HWND)m_hwndBuddy, WM_SETFONT, (WPARAM)hFont, TRUE);
|
||||
*/
|
||||
wxOS2SetFont( m_hWnd
|
||||
,rFont
|
||||
);
|
||||
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;
|
||||
}
|
||||
|
||||
// TODO:
|
||||
/*
|
||||
::ShowWindow((HWND)m_hwndBuddy, show ? SW_SHOW : SW_HIDE);
|
||||
*/
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
*/
|
||||
}
|
||||
} // end of wxSpinCtrl::Show
|
||||
|
||||
#endif //wxUSE_SPINBTN
|
@@ -24,175 +24,94 @@
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxStaticBox, wxControl)
|
||||
EVT_ERASE_BACKGROUND(wxStaticBox::OnEraseBackground)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
/*
|
||||
* Group box
|
||||
*/
|
||||
|
||||
bool wxStaticBox::Create(wxWindow *parent, wxWindowID id,
|
||||
const wxString& label,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
const wxString& name)
|
||||
bool wxStaticBox::Create(
|
||||
wxWindow* pParent
|
||||
, wxWindowID vId
|
||||
, const wxString& rsLabel
|
||||
, const wxPoint& rPos
|
||||
, const wxSize& rSize
|
||||
, long lStyle
|
||||
, const wxString& rsName
|
||||
)
|
||||
{
|
||||
SetName(name);
|
||||
|
||||
if (parent) parent->AddChild(this);
|
||||
|
||||
SetBackgroundColour(parent->GetBackgroundColour()) ;
|
||||
SetForegroundColour(parent->GetForegroundColour()) ;
|
||||
|
||||
if ( id == -1 )
|
||||
m_windowId = (int)NewControlId();
|
||||
else
|
||||
m_windowId = id;
|
||||
|
||||
int x = pos.x;
|
||||
int y = pos.y;
|
||||
int width = size.x;
|
||||
int height = size.y;
|
||||
|
||||
m_windowStyle = style;
|
||||
|
||||
// TODO:
|
||||
/*
|
||||
long msStyle = BS_GROUPBOX | WS_CHILD | WS_VISIBLE ; // GROUP_FLAGS;
|
||||
|
||||
bool want3D;
|
||||
WXDWORD exStyle = Determine3DEffects(0, &want3D) ;
|
||||
|
||||
HWND wx_button =
|
||||
CreateWindowEx(exStyle, wxT("BUTTON"), (const wxChar *)label, msStyle,
|
||||
0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId,
|
||||
wxGetInstance(), NULL);
|
||||
#if wxUSE_CTL3D
|
||||
if (want3D)
|
||||
{
|
||||
Ctl3dSubclassCtl(wx_button);
|
||||
m_useCtl3D = TRUE;
|
||||
}
|
||||
if(!OS2CreateControl( pParent
|
||||
,vId
|
||||
,rPos
|
||||
,rSize
|
||||
,lStyle
|
||||
#if wxUSE_VALIDATORS
|
||||
,wxDefaultValidator
|
||||
#endif
|
||||
|
||||
m_hWnd = (WXHWND)wx_button;
|
||||
|
||||
// Subclass again for purposes of dialog editing mode
|
||||
SubclassWin(GetHWND());
|
||||
|
||||
SetFont(parent->GetFont());
|
||||
|
||||
SetSize(x, y, width, height);
|
||||
ShowWindow(wx_button, SW_SHOW);
|
||||
*/
|
||||
,rsName
|
||||
))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
wxPoint vPos(0,0);
|
||||
wxSize vSize(0,0);
|
||||
|
||||
if (!OS2CreateControl( "STATIC"
|
||||
,SS_GROUPBOX
|
||||
,vPos
|
||||
,vSize
|
||||
,rsLabel
|
||||
))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
wxColour vColour;
|
||||
|
||||
vColour.Set(wxString("BLACK"));
|
||||
|
||||
LONG lColor = (LONG)vColour.GetPixel();
|
||||
|
||||
::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
|
||||
{
|
||||
int cx, cy;
|
||||
wxGetCharSize(GetHWND(), &cx, &cy, (wxFont*)&GetFont());
|
||||
|
||||
int nCx;
|
||||
int nCy;
|
||||
int wBox;
|
||||
GetTextExtent(wxGetWindowText(m_hWnd), &wBox, &cy);
|
||||
|
||||
wBox += 3*cx;
|
||||
int hBox = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy);
|
||||
wxGetCharSize( GetHWND()
|
||||
,&nCx
|
||||
,&nCy
|
||||
,(wxFont*)&GetFont()
|
||||
);
|
||||
GetTextExtent( wxGetWindowText(m_hWnd)
|
||||
,&wBox
|
||||
,&nCy
|
||||
);
|
||||
wBox += 3 * nCx;
|
||||
|
||||
return wxSize(wBox, hBox);
|
||||
}
|
||||
int hBox = EDIT_HEIGHT_FROM_CHAR_HEIGHT(nCy);
|
||||
|
||||
WXHBRUSH wxStaticBox::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
||||
WXUINT message,
|
||||
WXWPARAM wParam,
|
||||
WXLPARAM lParam)
|
||||
return wxSize( wBox
|
||||
,hBox
|
||||
);
|
||||
} // end of wxStaticBox::DoGetBestSize
|
||||
|
||||
MRESULT wxStaticBox::OS2WindowProc(
|
||||
WXUINT nMsg
|
||||
, WXWPARAM wParam
|
||||
, 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);
|
||||
}
|
||||
} // end of wxStaticBox::OS2WindowProc
|
||||
|
||||
|
||||
|
@@ -40,48 +40,50 @@ IMPLEMENT_DYNAMIC_CLASS(wxStaticLine, wxControl)
|
||||
// wxStaticLine
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool wxStaticLine::Create( wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint &pos,
|
||||
const wxSize &size,
|
||||
long style,
|
||||
const wxString &name)
|
||||
bool wxStaticLine::Create(
|
||||
wxWindow* pParent
|
||||
, wxWindowID vId
|
||||
, const wxPoint& rPos
|
||||
, const wxSize& rSize
|
||||
, 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;
|
||||
|
||||
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 )
|
||||
{
|
||||
#ifdef __WXDEBUG__
|
||||
wxLogDebug(wxT("Failed to create static control"));
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
SubclassWin(m_hWnd);
|
||||
|
||||
return TRUE;
|
||||
*/
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
} // end of wxStaticLine::Create
|
||||
|
||||
#endif // wxUSE_STATLINE
|
||||
|
@@ -80,10 +80,26 @@ bool wxStaticText::Create(
|
||||
|
||||
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);
|
||||
wxControl::SetFont(pParent->GetFont());
|
||||
SetSize(nX, nY, nWidth, nHeight);
|
||||
return FALSE;
|
||||
SetSize( nX
|
||||
,nY
|
||||
,nWidth
|
||||
,nHeight
|
||||
);
|
||||
return TRUE;
|
||||
} // end of wxStaticText::Create
|
||||
|
||||
wxSize wxStaticText::DoGetBestSize() const
|
||||
@@ -143,23 +159,6 @@ wxSize wxStaticText::DoGetBestSize() const
|
||||
);
|
||||
} // 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(
|
||||
const wxFont& rFont
|
||||
)
|
||||
@@ -177,6 +176,23 @@ bool wxStaticText::SetFont(
|
||||
return bRet;
|
||||
} // 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(
|
||||
WXUINT uMsg
|
||||
, WXWPARAM wParam
|
||||
|
@@ -1207,3 +1207,78 @@ void 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;
|
||||
|
||||
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)
|
||||
case WM_CTLCOLORCHANGE:
|
||||
{
|
||||
|
Reference in New Issue
Block a user