Lots of updates fixing radiobox processing, checkboxes and add notebook control.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16861 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Webster
2002-08-30 13:37:52 +00:00
parent 07901ec945
commit f289196b3a
10 changed files with 1224 additions and 579 deletions

View File

@@ -8,155 +8,202 @@
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifndef _WX_NOTEBOOK_H_ #ifndef _NOTEBOOK_H
#define _WX_NOTEBOOK_H_ #define _NOTEBOOK_H
#if wxUSE_NOTEBOOK
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// headers // headers
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#include "wx/dynarray.h" #include "wx/control.h"
#include "wx/string.h"
#include "wx/notebook.h"
// ----------------------------------------------------------------------------
// types
// ----------------------------------------------------------------------------
// fwd declarations
class WXDLLEXPORT wxImageList;
class WXDLLEXPORT wxWindow;
// array of notebook pages
WX_DEFINE_ARRAY(wxNotebookPage *, wxArrayNBPages);
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxNotebook // wxNotebook
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// FIXME this class should really derive from wxTabCtrl, but the interface is not
// exactly the same, so I can't do it right now and instead we reimplement
// part of wxTabCtrl here
class WXDLLEXPORT wxNotebook : public wxNotebookBase class WXDLLEXPORT wxNotebook : public wxNotebookBase
{ {
public: public:
// ctors //
// ----- // Ctors
// default for dynamic class // -----
wxNotebook(); // Default for dynamic class
// the same arguments as for wxControl (@@@ any special styles?) //
wxNotebook(wxWindow *parent, wxNotebook();
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = "notebook");
// Create() function
bool Create(wxWindow *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = "notebook");
// dtor
~wxNotebook();
// accessors //
// --------- // the same arguments as for wxControl
// get number of pages in the dialog //
int GetPageCount() const; wxNotebook( wxWindow* pParent
,wxWindowID vId
,const wxPoint& rPos = wxDefaultPosition
,const wxSize& rSize = wxDefaultSize
,long lStyle = 0
,const wxString& rsName = "notebook"
);
// set the currently selected page, return the index of the previously bool Create( wxWindow* pParent
,wxWindowID vId
,const wxPoint& rPos = wxDefaultPosition
,const wxSize& rSize = wxDefaultSize
,long lStyle = 0
,const wxString& rsName = "notebook"
);
//
// Accessors
// ---------
// Get number of pages in the dialog
//
int GetPageCount(void) const;
//
// Set the currently selected page, return the index of the previously
// selected one (or -1 on error) // selected one (or -1 on error)
// NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
int SetSelection(int nPage); //
// cycle thru the tabs int SetSelection(int nPage);
void AdvanceSelection(bool bForward = TRUE);
// get the currently selected page
int GetSelection() const { return m_nSelection; }
// set/get the title of a page //
bool SetPageText(int nPage, const wxString& strText); // Get the currently selected page
wxString GetPageText(int nPage) const; //
inline int GetSelection(void) const { return m_nSelection; }
// image list stuff: each page may have an image associated with it. All //
// the images belong to an image list, so you have to // Set/Get the title of a page
// 1) create an image list //
// 2) associate it with the notebook bool SetPageText( int nPage
// 3) set for each page it's image ,const wxString& sStrText
);
wxString GetPageText(int nPage) const;
//
// Image list stuff: each page may have an image associated with it. All
// the images belong to an image list, so you have to
// 1) create an image list
// 2) associate it with the notebook
// 3) set for each page it's image
// associate image list with a control // associate image list with a control
void SetImageList(wxImageList* imageList); //
// get pointer (may be NULL) to the associated image list void SetImageList(wxImageList* pImageList);
wxImageList* GetImageList() const { return m_pImageList; }
// sets/returns item's image index in the current image list //
int GetPageImage(int nPage) const; // Sets/returns item's image index in the current image list
bool SetPageImage(int nPage, int nImage); //
int GetPageImage(int nPage) const;
bool SetPageImage( int nPage
,int nImage
);
// currently it's always 1 because wxGTK doesn't support multi-row //
// Currently it's always 1 because wxGTK doesn't support multi-row
// tab controls // tab controls
int GetRowCount() const; //
int GetRowCount(void) const;
// control the appearance of the notebook pages //
// control the appearance of the notebook pages
// set the size (the same for all pages) // set the size (the same for all pages)
void SetPageSize(const wxSize& size); //
// set the padding between tabs (in pixels) void SetPageSize(const wxSize& rSize);
void SetPadding(const wxSize& padding);
// operations //
// ---------- // Set the padding between tabs (in pixels)
// remove one page from the notebook //
bool DeletePage(int nPage); void SetPadding(const wxSize& rPadding);
// remove one page from the notebook, without deleting
bool RemovePage(int nPage); //
// remove all pages // Operations
bool DeleteAllPages(); // ----------
// adds a new page to the notebook (it will be deleted ny the notebook, // Remove all pages
//
bool DeleteAllPages(void);
//
// Adds a new page to the notebook (it will be deleted ny the notebook,
// don't delete it yourself). If bSelect, this page becomes active. // don't delete it yourself). If bSelect, this page becomes active.
bool AddPage(wxNotebookPage *pPage, //
const wxString& strText, bool AddPage( wxNotebookPage* pPage
bool bSelect = FALSE, ,const wxString& rsStrText
int imageId = -1); ,bool bSelect = FALSE
// the same as AddPage(), but adds it at the specified position ,int nImageId = -1
bool InsertPage(int nPage, );
wxNotebookPage *pPage,
const wxString& strText,
bool bSelect = FALSE,
int imageId = -1);
// get the panel which represents the given page
wxNotebookPage *GetPage(int nPage) { return m_aPages[nPage]; }
//
// The same as AddPage(), but adds it at the specified position
//
bool InsertPage( int nPage
,wxNotebookPage* pPage
,const wxString& rsStrText
,bool bSelect = FALSE
,int nImageId = -1
);
//
// Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH // Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH
// style. // style.
void SetTabSize(const wxSize& sz); //
void SetTabSize(const wxSize& rSize);
// callbacks //
// --------- // Callbacks
void OnSize(wxSizeEvent& event); // ---------
void OnSelChange(wxNotebookEvent& event); //
void OnSetFocus(wxFocusEvent& event); void OnSize(wxSizeEvent& rEvent);
void OnNavigationKey(wxNavigationKeyEvent& event); void OnSelChange(wxNotebookEvent& rEvent);
void OnSetFocus(wxFocusEvent& rEvent);
void OnNavigationKey(wxNavigationKeyEvent& rEvent);
// base class virtuals //
// ------------------- // Base class virtuals
virtual bool OS2OnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); // -------------------
virtual void SetConstraintSizes(bool recurse = TRUE); //
virtual bool DoPhase(int nPhase); virtual bool OS2OnScroll( int nOrientation
,WXWORD wSBCode
,WXWORD wPos
,WXHWND hControl
);
virtual void SetConstraintSizes(bool bRecurse = TRUE);
virtual bool DoPhase(int nPhase);
protected: protected:
// common part of all ctors //
void Init(); // Common part of all ctors
//
void Init(void);
// helper functions //
void ChangePage(int nOldSel, int nSel); // change pages // Translate wxWin styles to the PM ones
//
virtual WXDWORD OS2GetStyle( long lFlags
,WXDWORD* pwExstyle = NULL
) const;
wxImageList *m_pImageList; // we can have an associated image list //
wxArrayNBPages m_aPages; // array of pages // Remove one page from the notebook, without deleting
//
virtual wxNotebookPage* DoRemovePage(int nPage);
int m_nSelection; // the current selection (-1 if none) //
// Helper functions
//
void ChangePage( int nOldSel
,int nSel
); // change pages
DECLARE_DYNAMIC_CLASS(wxNotebook) int m_nSelection; // The current selection (-1 if none)
DECLARE_EVENT_TABLE()
}; private:
wxArrayLong m_alPageId;
int m_nTabSize; // holds the largest tab size
DECLARE_DYNAMIC_CLASS(wxNotebook)
DECLARE_EVENT_TABLE()
}; // end of CLASS wxNotebook
#endif // wxUSE_NOTEBOOK
#endif // _NOTEBOOK_H
#endif // _WX_NOTEBOOK_H_

View File

@@ -227,6 +227,10 @@ public:
void OnIdle(wxIdleEvent& rEvent); void OnIdle(wxIdleEvent& rEvent);
public: public:
// For hidden notebook pages, always TRUE for everything else
bool IsActivePage(void) const { return m_bIsActivePage; }
void SetActivePage(bool bActive) { m_bIsActivePage = bActive; }
// For implementation purposes - sometimes decorations make the client area // For implementation purposes - sometimes decorations make the client area
// smaller // smaller
virtual wxPoint GetClientAreaOrigin(void) const; virtual wxPoint GetClientAreaOrigin(void) const;
@@ -607,6 +611,7 @@ private:
HWND m_hWndScrollBarHorz; HWND m_hWndScrollBarHorz;
HWND m_hWndScrollBarVert; HWND m_hWndScrollBarVert;
SWP m_vWinSwp; SWP m_vWinSwp;
bool m_bIsActivePage;
// Virtual function hiding supression // Virtual function hiding supression
inline virtual bool Reparent(wxWindowBase* pNewParent) inline virtual bool Reparent(wxWindowBase* pNewParent)

View File

@@ -29,6 +29,10 @@
IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl) IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl)
IMPLEMENT_DYNAMIC_CLASS(wxBitmapCheckBox, wxCheckBox) IMPLEMENT_DYNAMIC_CLASS(wxBitmapCheckBox, wxCheckBox)
extern void wxAssociateWinWithHandle( HWND hWnd
,wxWindowOS2* pWin
);
// ============================================================================ // ============================================================================
// implementation // implementation
// ============================================================================ // ============================================================================
@@ -64,6 +68,9 @@ bool wxCheckBox::Create(
, const wxString& rsName , const wxString& rsName
) )
{ {
LONG lColor;
bool bOk;
if (!CreateControl( pParent if (!CreateControl( pParent
,vId ,vId
,rPos ,rPos
@@ -76,17 +83,27 @@ bool wxCheckBox::Create(
)) ))
return FALSE; return FALSE;
long osStyle = BS_AUTOCHECKBOX | long osStyle = BS_AUTOCHECKBOX |
WS_TABSTOP | WS_TABSTOP |
WS_VISIBLE; WS_VISIBLE;
return OS2CreateControl( wxT("BUTTON") bOk = OS2CreateControl( wxT("BUTTON")
,osStyle ,osStyle
,rPos ,rPos
,rSize ,rSize
,rsLabel ,rsLabel
,0 ,0
); );
m_backgroundColour = pParent->GetBackgroundColour();
lColor = (LONG)m_backgroundColour.GetPixel();
::WinSetPresParam( m_hWnd
,PP_BACKGROUNDCOLOR
,sizeof(LONG)
,(PVOID)&lColor
);
wxAssociateWinWithHandle(m_hWnd, this);
return bOk;
} // end of wxCheckBox::Create } // end of wxCheckBox::Create
void wxCheckBox::SetLabel( void wxCheckBox::SetLabel(

View File

@@ -105,10 +105,7 @@ bool wxControl::OS2CreateControl(
) )
{ {
bool bWant3D = FALSE; bool bWant3D = FALSE;
int nX = rPos.x == -1 ? 0 : rPos.x;
int nY = rPos.y == -1 ? 0 : rPos.y;
int nW = rSize.x == -1 ? 0 : rSize.x;
int nH = rSize.y == -1 ? 0 : rSize.y;
// //
// Doesn't do anything at all under OS/2 // Doesn't do anything at all under OS/2
// //
@@ -134,6 +131,8 @@ bool wxControl::OS2CreateControl(
zClass = WC_STATIC; zClass = WC_STATIC;
else if ((strcmp(zClassname, "BUTTON")) == 0) else if ((strcmp(zClassname, "BUTTON")) == 0)
zClass = WC_BUTTON; zClass = WC_BUTTON;
else if ((strcmp(zClassname, "NOTEBOOK")) == 0)
zClass = WC_NOTEBOOK;
dwStyle |= WS_VISIBLE; dwStyle |= WS_VISIBLE;
m_hWnd = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle m_hWnd = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle
@@ -170,8 +169,11 @@ bool wxControl::OS2CreateControl(
InheritAttributes(); InheritAttributes();
SetXComp(0); SetXComp(0);
SetYComp(0); SetYComp(0);
if (nW == 0 || nH == 0) SetSize( rPos.x
SetBestSize(rSize); ,rPos.y
,rSize.x
,rSize.y
);
return TRUE; return TRUE;
} // end of wxControl::OS2CreateControl } // end of wxControl::OS2CreateControl

View File

@@ -640,12 +640,12 @@ void wxOS2SelectMatchingFontByName(
// //
pFattrs->usRecordLength = sizeof(FATTRS); // Sets size of structure pFattrs->usRecordLength = sizeof(FATTRS); // Sets size of structure
pFattrs->lMatch = pFM[nIndex].lMatch; // Force match pFattrs->lMatch = pFM[nIndex].lMatch; // Force match
pFattrs->idRegistry = 0; // Registry pFattrs->idRegistry = 0;
pFattrs->usCodePage = 0; // Match proper CodePage pFattrs->usCodePage = 0;
pFattrs->fsFontUse = 0; // Use only outline fonts pFattrs->fsFontUse = 0;
pFattrs->fsType = 0; // Use only outline fonts pFattrs->fsType = 0;
pFattrs->lMaxBaselineExt = 0; // Use only outline fonts pFattrs->lMaxBaselineExt = 0;
pFattrs->lAveCharWidth = 0; // Use only outline fonts pFattrs->lAveCharWidth = 0;
wxStrcpy(pFattrs->szFacename, pFM[nIndex].szFacename); wxStrcpy(pFattrs->szFacename, pFM[nIndex].szFacename);
if (pFont->GetWeight() == wxNORMAL) if (pFont->GetWeight() == wxNORMAL)
pFattrs->fsSelection = 0; pFattrs->fsSelection = 0;

File diff suppressed because it is too large Load Diff

View File

@@ -36,13 +36,22 @@ MRESULT EXPENTRY wxRadioBtnWndProc( HWND hWnd
,MPARAM wParam ,MPARAM wParam
,MPARAM lParam ,MPARAM lParam
); );
MRESULT EXPENTRY wxRadioBoxWndProc( HWND hWnd
,UINT uMessage
,MPARAM wParam
,MPARAM lParam
);
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// global vars // global vars
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// the pointer to standard radio button wnd proc // the pointer to standard radio button wnd proc
extern void wxAssociateWinWithHandle( HWND hWnd
,wxWindowOS2* pWin
);
static WXFARPROC fnWndProcRadioBtn = NULL; static WXFARPROC fnWndProcRadioBtn = NULL;
static WXFARPROC fnWndProcRadioBox = NULL;
// =========================================================================== // ===========================================================================
// implementation // implementation
@@ -260,20 +269,10 @@ bool wxRadioBox::Create(
, const wxString& rsName , const wxString& rsName
) )
{ {
//
// System fonts are too big in OS/2 and they are blue
// We want smaller fonts and black by default.
//
wxFont* pTextFont = new wxFont( 10
,wxMODERN
,wxNORMAL
,wxNORMAL
);
wxColour vColour; wxColour vColour;
LONG lColor; LONG lColor;
vColour.Set(wxString("BLACK")); vColour.Set(wxString("BLACK"));
lColor = (LONG)vColour.GetPixel();
m_backgroundColour = pParent->GetBackgroundColour(); m_backgroundColour = pParent->GetBackgroundColour();
m_nSelectedButton = -1; m_nSelectedButton = -1;
m_nNoItems = 0; m_nNoItems = 0;
@@ -296,17 +295,14 @@ bool wxRadioBox::Create(
)) ))
return FALSE; return FALSE;
if (!OS2CreateControl( "STATIC" if (!OS2CreateControl( "STATIC"
#if RADIOBTN_PARENT_IS_RADIOBOX ,SS_GROUPBOX
,SS_GROUPBOX | WS_GROUP | WS_CLIPCHILDREN
#else
,SS_GROUPBOX | WS_GROUP | WS_CLIPSIBLINGS
#endif
,rPos ,rPos
,rSize ,rSize
,rsTitle ,rsTitle
)) ))
return FALSE; return FALSE;
wxAssociateWinWithHandle(m_hWnd, this);
#if RADIOBTN_PARENT_IS_RADIOBOX #if RADIOBTN_PARENT_IS_RADIOBOX
HWND hWndParent = GetHwnd(); HWND hWndParent = GetHwnd();
#else #else
@@ -323,11 +319,6 @@ bool wxRadioBox::Create(
m_pnRadioWidth = new int[nNum]; m_pnRadioWidth = new int[nNum];
m_pnRadioHeight = new int[nNum]; m_pnRadioHeight = new int[nNum];
if (pTextFont->Ok())
{
hFont = pTextFont->GetResourceHandle();
}
for (int i = 0; i < nNum; i++) for (int i = 0; i < nNum; i++)
{ {
m_pnRadioWidth[i] = m_pnRadioHeight[i] = -1; m_pnRadioWidth[i] = m_pnRadioHeight[i] = -1;
@@ -368,8 +359,9 @@ bool wxRadioBox::Create(
} }
m_ahRadioButtons[i] = (WXHWND)hWndBtn; m_ahRadioButtons[i] = (WXHWND)hWndBtn;
SubclassRadioButton((WXHWND)hWndBtn); SubclassRadioButton((WXHWND)hWndBtn);
wxAssociateWinWithHandle(hWndBtn, this);
wxOS2SetFont( hWndBtn wxOS2SetFont( hWndBtn
,*pTextFont ,*wxSMALL_FONT
); );
::WinSetWindowULong(hWndBtn, QWL_USER, (ULONG)this); ::WinSetWindowULong(hWndBtn, QWL_USER, (ULONG)this);
m_aSubControls.Add(nNewId); m_aSubControls.Add(nNewId);
@@ -389,13 +381,22 @@ bool wxRadioBox::Create(
,NULL ,NULL
,NULL ,NULL
); );
SetFont(*pTextFont); SetFont(*wxSMALL_FONT);
fnWndProcRadioBox = (WXFARPROC)::WinSubclassWindow( GetHwnd()
,(PFNWP)wxRadioBoxWndProc
);
::WinSetWindowULong(GetHwnd(), QWL_USER, (ULONG)this);
lColor = (LONG)vColour.GetPixel(); lColor = (LONG)vColour.GetPixel();
::WinSetPresParam( m_hWnd ::WinSetPresParam( m_hWnd
,PP_FOREGROUNDCOLOR ,PP_FOREGROUNDCOLOR
,sizeof(LONG) ,sizeof(LONG)
,(PVOID)&lColor ,(PVOID)&lColor
); );
::WinSetPresParam( m_hWnd
,PP_BORDERDARKCOLOR
,sizeof(LONG)
,(PVOID)&lColor
);
lColor = (LONG)m_backgroundColour.GetPixel(); lColor = (LONG)m_backgroundColour.GetPixel();
::WinSetPresParam( m_hWnd ::WinSetPresParam( m_hWnd
@@ -403,6 +404,11 @@ bool wxRadioBox::Create(
,sizeof(LONG) ,sizeof(LONG)
,(PVOID)&lColor ,(PVOID)&lColor
); );
::WinSetPresParam( m_hWnd
,PP_BORDERLIGHTCOLOR
,sizeof(LONG)
,(PVOID)&lColor
);
SetXComp(0); SetXComp(0);
SetYComp(0); SetYComp(0);
SetSelection(0); SetSelection(0);
@@ -411,7 +417,6 @@ bool wxRadioBox::Create(
,rSize.x ,rSize.x
,rSize.y ,rSize.y
); );
delete pTextFont;
return TRUE; return TRUE;
} // end of wxRadioBox::Create } // end of wxRadioBox::Create
@@ -969,10 +974,8 @@ bool wxRadioBox::OS2Command(
if (nSelectedButton == -1) if (nSelectedButton == -1)
{ {
// //
// Just ignore it - due to a hack with WM_NCHITTEST handling in our // Just ignore it
// wnd proc, we can receive dummy click messages when we click near //
// the radiobox edge (this is ugly but Julian wouldn't let me get
// rid of this...)
return FALSE; return FALSE;
} }
if (nSelectedButton != m_nSelectedButton) if (nSelectedButton != m_nSelectedButton)
@@ -1213,3 +1216,18 @@ MRESULT wxRadioBtnWndProc(
); );
} // end of wxRadioBtnWndProc } // end of wxRadioBtnWndProc
MRESULT EXPENTRY wxRadioBoxWndProc(
HWND hWnd
, UINT uMessage
, MPARAM wParam
, MPARAM lParam
)
{
return (fnWndProcRadioBox( hWnd
,(ULONG)uMessage
,(MPARAM)wParam
,(MPARAM)lParam
)
);
} // end of wxRadioBoxWndProc

View File

@@ -29,6 +29,10 @@
IMPLEMENT_DYNAMIC_CLASS(wxRadioButton, wxControl) IMPLEMENT_DYNAMIC_CLASS(wxRadioButton, wxControl)
extern void wxAssociateWinWithHandle( HWND hWnd
,wxWindowOS2* pWin
);
void wxRadioButton::Init() void wxRadioButton::Init()
{ {
m_bFocusJustSet = FALSE; m_bFocusJustSet = FALSE;
@@ -82,21 +86,16 @@ bool wxRadioButton::Create(
)) ))
return FALSE; return FALSE;
wxAssociateWinWithHandle(m_hWnd, this);
if (HasFlag(wxRB_GROUP)) if (HasFlag(wxRB_GROUP))
SetValue(TRUE); SetValue(TRUE);
wxFont* pTextFont = new wxFont( 10 SetFont(*wxSMALL_FONT);
,wxMODERN
,wxNORMAL
,wxNORMAL
);
SetFont(*pTextFont);
SetSize( rPos.x SetSize( rPos.x
,rPos.y ,rPos.y
,rSize.x ,rSize.x
,rSize.y ,rSize.y
); );
delete pTextFont;
return TRUE; return TRUE;
} // end of wxRadioButton::Create } // end of wxRadioButton::Create

View File

@@ -301,6 +301,7 @@ void wxWindowOS2::Init()
m_bUseCtl3D = FALSE; m_bUseCtl3D = FALSE;
m_bMouseInWindow = FALSE; m_bMouseInWindow = FALSE;
m_bLastKeydownProcessed = FALSE; m_bLastKeydownProcessed = FALSE;
m_bIsActivePage = TRUE;
// //
// wxWnd // wxWnd
@@ -1646,13 +1647,86 @@ void wxWindowOS2::DoMoveWindow(
::WinQueryWindowRect(HWND_DESKTOP, &vRect); ::WinQueryWindowRect(HWND_DESKTOP, &vRect);
nY = vRect.yTop - (nY + nHeight); nY = vRect.yTop - (nY + nHeight);
} }
//
// In the case of a frame whose client is sized, the client cannot be
// large than its parent frame minus its borders! This usually happens
// when using an autosizer to size a frame to precisely hold client
// controls as in the notebook sample.
//
// In this case, we may need to resize both a frame and its client so we
// need a quick calc of the frame border size, then if the frame
// (less its borders) is smaller than the client, size the frame to
// encompass the client with the appropriate border size.
//
if (IsKindOf(CLASSINFO(wxFrame)))
{
RECTL vFRect;
HWND hWndFrame;
int nWidthFrameDelta = 0;
int nHeightFrameDelta = 0;
int nHeightFrame = 0;
int nWidthFrame = 0;
ULONG ulFLag = SWP_MOVE;
wxFrame* pFrame;
pFrame = wxDynamicCast(this, wxFrame);
hWndFrame = pFrame->GetFrame();
::WinQueryWindowRect(hWndFrame, &vRect);
::WinMapWindowPoints(hWndFrame, HWND_DESKTOP, (PPOINTL)&vRect, 2);
vFRect = vRect;
::WinCalcFrameRect(hWndFrame, &vRect, TRUE);
nWidthFrameDelta = ((vRect.xLeft - vFRect.xLeft) + (vFRect.xRight - vRect.xRight));
nHeightFrameDelta = ((vRect.yBottom - vFRect.yBottom) + (vFRect.yTop - vRect.yTop));
nWidthFrame = vFRect.xRight - vFRect.xLeft;
nHeightFrame = vFRect.yTop - vFRect.yBottom;
if (nWidth == vFRect.xRight - vFRect.xLeft &&
nHeight == vFRect.yTop - vFRect.yBottom)
{
//
// In this case the caller is not aware of OS/2's need to size both
// the frame and it's client and is really only moving the window,
// not resizeing it. So move the frame, and back off the sizes
// for a proper client fit.
//
::WinSetWindowPos( hWndFrame
,HWND_TOP
,(LONG)nX - (vRect.xLeft - vFRect.xLeft)
,(LONG)nY - (vRect.yBottom - vFRect.yBottom)
,(LONG)0
,(LONG)0
,SWP_MOVE
);
nX += (vRect.xLeft - vFRect.xLeft);
nY += (vRect.yBottom - vFRect.yBottom);
nWidth -= nWidthFrameDelta;
nHeight -= nHeightFrameDelta;
}
else
{
if (nWidth > nWidthFrame - nHeightFrameDelta ||
nHeight > nHeightFrame - nHeightFrameDelta)
{
::WinSetWindowPos( hWndFrame
,HWND_TOP
,(LONG)nX - (vRect.xLeft - vFRect.xLeft)
,(LONG)nY - (vRect.yBottom - vFRect.yBottom)
,(LONG)nWidth + nWidthFrameDelta
,(LONG)nHeight + nHeightFrameDelta
,SWP_MOVE | SWP_SIZE
);
}
}
}
::WinSetWindowPos( GetHwnd() ::WinSetWindowPos( GetHwnd()
,HWND_TOP ,HWND_TOP
,(LONG)nX ,(LONG)nX
,(LONG)nY ,(LONG)nY
,(LONG)nWidth ,(LONG)nWidth
,(LONG)nHeight ,(LONG)nHeight
,SWP_ZORDER | SWP_SIZE | SWP_MOVE | SWP_SHOW ,SWP_SIZE | SWP_MOVE
); );
if (m_vWinSwp.cx == 0 && m_vWinSwp.cy == 0 && m_vWinSwp.fl == 0) if (m_vWinSwp.cx == 0 && m_vWinSwp.cy == 0 && m_vWinSwp.fl == 0)
// //
@@ -2853,6 +2927,48 @@ MRESULT wxWindowOS2::OS2WindowProc(
case WM_CONTROL: case WM_CONTROL:
switch(SHORT2FROMMP(wParam)) switch(SHORT2FROMMP(wParam))
{ {
case BN_CLICKED:
{
HWND hWnd = ::WinWindowFromID((HWND)GetHwnd(), SHORT1FROMMP(wParam));
wxWindowOS2* pWin = wxFindWinFromHandle(hWnd);
if (!pWin)
{
bProcessed = FALSE;
break;
}
//
// Simulate a WM_COMMAND here, as wxWindows expects all control
// button clicks to generate WM_COMMAND msgs, not WM_CONTROL
//
if (pWin->IsKindOf(CLASSINFO(wxRadioBox)))
{
wxRadioBox* pRadioBox = wxDynamicCast(pWin, wxRadioBox);
pRadioBox->OS2Command( (WXUINT)SHORT2FROMMP(wParam)
,(WXUINT)SHORT1FROMMP(wParam)
);
}
if (pWin->IsKindOf(CLASSINFO(wxRadioButton)))
{
wxRadioButton* pRadioButton = wxDynamicCast(pWin, wxRadioButton);
pRadioButton->OS2Command( (WXUINT)SHORT2FROMMP(wParam)
,(WXUINT)SHORT1FROMMP(wParam)
);
}
if (pWin->IsKindOf(CLASSINFO(wxCheckBox)))
{
wxCheckBox* pCheckBox = wxDynamicCast(pWin, wxCheckBox);
pCheckBox->OS2Command( (WXUINT)SHORT2FROMMP(wParam)
,(WXUINT)SHORT1FROMMP(wParam)
);
}
return 0;
}
break;
case SPBN_UPARROW: case SPBN_UPARROW:
case SPBN_DOWNARROW: case SPBN_DOWNARROW:
case SPBN_CHANGE: case SPBN_CHANGE:
@@ -3322,7 +3438,7 @@ bool wxWindowOS2::HandleKillFocus(
#endif // wxUSE_CARET #endif // wxUSE_CARET
#if wxUSE_TEXTCTRL #if wxUSE_TEXTCTRL
// //
// If it's a wxTextCtrl don't send the event as it will be done // If it's a wxTextCtrl don't send the event as it will be done
// after the control gets to process it. // after the control gets to process it.
// //
@@ -3334,7 +3450,7 @@ bool wxWindowOS2::HandleKillFocus(
} }
#endif #endif
// //
// Don't send the event when in the process of being deleted. This can // Don't send the event when in the process of being deleted. This can
// only cause problems if the event handler tries to access the object. // only cause problems if the event handler tries to access the object.
// //
@@ -3349,7 +3465,7 @@ bool wxWindowOS2::HandleKillFocus(
vEvent.SetEventObject(this); vEvent.SetEventObject(this);
// //
// wxFindWinFromHandle() may return NULL, it is ok // wxFindWinFromHandle() may return NULL, it is ok
// //
vEvent.SetWindow(wxFindWinFromHandle(hWnd)); vEvent.SetWindow(wxFindWinFromHandle(hWnd));
@@ -3718,7 +3834,9 @@ bool wxWindowOS2::HandlePaint()
{ {
// //
// OS/2 needs to process this right here, not by the default proc // OS/2 needs to process this right here, not by the default proc
// Window's default proc correctly paints everything, OS/2 does not! // Window's default proc correctly paints everything, OS/2 does not.
// For decorative panels that typically have no children, we draw
// borders.
// //
HPS hPS; HPS hPS;
RECTL vRect; RECTL vRect;
@@ -3746,35 +3864,76 @@ bool wxWindowOS2::HandlePaint()
,NULL ,NULL
); );
::WinFillRect(hPS, &vRect, GetBackgroundColour().GetPixel()); if (::WinIsWindowVisible(GetHWND()) && m_bIsActivePage)
if (m_dwExStyle)
{ {
LINEBUNDLE vLineBundle; ::WinFillRect(hPS, &vRect, GetBackgroundColour().GetPixel());
if (m_dwExStyle)
{
LINEBUNDLE vLineBundle;
vLineBundle.lColor = 0x00000000; // Black vLineBundle.lColor = 0x00000000; // Black
vLineBundle.usMixMode = FM_OVERPAINT; vLineBundle.usMixMode = FM_OVERPAINT;
vLineBundle.fxWidth = 1; vLineBundle.fxWidth = 1;
vLineBundle.lGeomWidth = 1; vLineBundle.lGeomWidth = 1;
vLineBundle.usType = LINETYPE_SOLID; vLineBundle.usType = LINETYPE_SOLID;
vLineBundle.usEnd = 0; vLineBundle.usEnd = 0;
vLineBundle.usJoin = 0; vLineBundle.usJoin = 0;
::GpiSetAttrs( hPS ::GpiSetAttrs( hPS
,PRIM_LINE ,PRIM_LINE
,LBB_COLOR | LBB_MIX_MODE | LBB_WIDTH | LBB_GEOM_WIDTH | LBB_TYPE ,LBB_COLOR | LBB_MIX_MODE | LBB_WIDTH | LBB_GEOM_WIDTH | LBB_TYPE
,0L ,0L
,&vLineBundle ,&vLineBundle
); );
::WinQueryWindowRect(GetHwnd(), &vRect); ::WinQueryWindowRect(GetHwnd(), &vRect);
wxDrawBorder( hPS wxDrawBorder( hPS
,vRect ,vRect
,m_dwExStyle ,m_dwExStyle
); );
}
} }
::WinEndPaint(hPS);
} }
::WinEndPaint(hPS);
bProcessed = TRUE; bProcessed = TRUE;
} }
else if (!bProcessed &&
IsKindOf(CLASSINFO(wxPanel))
)
{
//
// Panel with children, usually fills a frame client so no borders.
//
HPS hPS;
RECTL vRect;
wxFrame* pFrame;
wxWindow* pParent;
hPS = ::WinBeginPaint( GetHwnd()
,NULLHANDLE
,&vRect
);
if(hPS)
{
::GpiCreateLogColorTable( hPS
,0L
,LCOLF_CONSECRGB
,0L
,(LONG)wxTheColourDatabase->m_nSize
,(PLONG)wxTheColourDatabase->m_palTable
);
::GpiCreateLogColorTable( hPS
,0L
,LCOLF_RGB
,0L
,0L
,NULL
);
if (::WinIsWindowVisible(GetHWND()) && m_bIsActivePage)
::WinFillRect(hPS, &vRect, GetBackgroundColour().GetPixel());
}
::WinEndPaint(hPS);
bProcessed = TRUE;
}
return bProcessed; return bProcessed;
} // end of wxWindowOS2::HandlePaint } // end of wxWindowOS2::HandlePaint
@@ -4300,62 +4459,69 @@ void wxWindowOS2::MoveChildren(
int nDiff int nDiff
) )
{ {
SWP vSwp; if (GetAutoLayout())
for (wxWindowList::Node* pNode = GetChildren().GetFirst();
pNode;
pNode = pNode->GetNext())
{ {
wxWindow* pWin = pNode->GetData(); Layout();
}
else
{
SWP vSwp;
::WinQueryWindowPos( GetHwndOf(pWin) for (wxWindowList::Node* pNode = GetChildren().GetFirst();
,&vSwp pNode;
); pNode = pNode->GetNext())
if (pWin->IsKindOf(CLASSINFO(wxControl)))
{ {
wxControl* pCtrl; wxWindow* pWin = pNode->GetData();
// ::WinQueryWindowPos( GetHwndOf(pWin)
// Must deal with controls that have margins like ENTRYFIELD. The SWP ,&vSwp
// struct of such a control will have and origin offset from its intended );
// position by the width of the margins. if (pWin->IsKindOf(CLASSINFO(wxControl)))
// {
pCtrl = wxDynamicCast(pWin, wxControl); wxControl* pCtrl;
vSwp.y -= pCtrl->GetYComp();
vSwp.x -= pCtrl->GetXComp();
}
::WinSetWindowPos( GetHwndOf(pWin)
,HWND_TOP
,vSwp.x
,vSwp.y - nDiff
,vSwp.cx
,vSwp.cy
,SWP_MOVE | SWP_SHOW | SWP_ZORDER
);
::WinQueryWindowPos(GetHwndOf(pWin), pWin->GetSwp());
if (pWin->IsKindOf(CLASSINFO(wxRadioBox)))
{
wxRadioBox* pRadioBox;
pRadioBox = wxDynamicCast(pWin, wxRadioBox); //
pRadioBox->AdjustButtons( (int)vSwp.x // Must deal with controls that have margins like ENTRYFIELD. The SWP
,(int)vSwp.y - nDiff // struct of such a control will have and origin offset from its intended
,(int)vSwp.cx // position by the width of the margins.
,(int)vSwp.cy //
,pRadioBox->GetSizeFlags() pCtrl = wxDynamicCast(pWin, wxControl);
); vSwp.y -= pCtrl->GetYComp();
} vSwp.x -= pCtrl->GetXComp();
if (pWin->IsKindOf(CLASSINFO(wxSlider))) }
{ ::WinSetWindowPos( GetHwndOf(pWin)
wxSlider* pSlider; ,HWND_TOP
,vSwp.x
,vSwp.y - nDiff
,vSwp.cx
,vSwp.cy
,SWP_MOVE | SWP_SHOW | SWP_ZORDER
);
::WinQueryWindowPos(GetHwndOf(pWin), pWin->GetSwp());
if (pWin->IsKindOf(CLASSINFO(wxRadioBox)))
{
wxRadioBox* pRadioBox;
pSlider = wxDynamicCast(pWin, wxSlider); pRadioBox = wxDynamicCast(pWin, wxRadioBox);
pSlider->AdjustSubControls( (int)vSwp.x pRadioBox->AdjustButtons( (int)vSwp.x
,(int)vSwp.y - nDiff ,(int)vSwp.y - nDiff
,(int)vSwp.cx ,(int)vSwp.cx
,(int)vSwp.cy ,(int)vSwp.cy
,(int)pSlider->GetSizeFlags() ,pRadioBox->GetSizeFlags()
); );
}
if (pWin->IsKindOf(CLASSINFO(wxSlider)))
{
wxSlider* pSlider;
pSlider = wxDynamicCast(pWin, wxSlider);
pSlider->AdjustSubControls( (int)vSwp.x
,(int)vSwp.y - nDiff
,(int)vSwp.cx
,(int)vSwp.cy
,(int)pSlider->GetSizeFlags()
);
}
} }
} }
Refresh(); Refresh();

View File

@@ -4,7 +4,7 @@ DATA MULTIPLE NONSHARED READWRITE LOADONCALL
CODE LOADONCALL CODE LOADONCALL
EXPORTS EXPORTS
;From library: H:\DEV\WX2\WXWINDOWS\lib\wx.lib ;From library: H:\Dev\Wx2\WxWindows\lib\wx.lib
;From object file: dummy.cpp ;From object file: dummy.cpp
;PUBDEFs (Symbols available from object file): ;PUBDEFs (Symbols available from object file):
wxDummyChar wxDummyChar
@@ -13638,8 +13638,6 @@ EXPORTS
DeleteAllPages__10wxNotebookFv DeleteAllPages__10wxNotebookFv
;wxNotebook::SetPageText(int,const wxString&) ;wxNotebook::SetPageText(int,const wxString&)
SetPageText__10wxNotebookFiRC8wxString SetPageText__10wxNotebookFiRC8wxString
;wxNotebook::AdvanceSelection(unsigned long)
AdvanceSelection__10wxNotebookFUl
wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED
;wxNotebook::ChangePage(int,int) ;wxNotebook::ChangePage(int,int)
ChangePage__10wxNotebookFiT1 ChangePage__10wxNotebookFiT1
@@ -13649,6 +13647,8 @@ EXPORTS
SetPageSize__10wxNotebookFRC6wxSize SetPageSize__10wxNotebookFRC6wxSize
;wxNotebook::AddPage(wxWindow*,const wxString&,unsigned long,int) ;wxNotebook::AddPage(wxWindow*,const wxString&,unsigned long,int)
AddPage__10wxNotebookFP8wxWindowRC8wxStringUli AddPage__10wxNotebookFP8wxWindowRC8wxStringUli
;wxNotebook::OS2GetStyle(long,unsigned long*) const
OS2GetStyle__10wxNotebookCFlPUl
;wxNotebook::OnSize(wxSizeEvent&) ;wxNotebook::OnSize(wxSizeEvent&)
OnSize__10wxNotebookFR11wxSizeEvent OnSize__10wxNotebookFR11wxSizeEvent
;wxNotebook::SetSelection(int) ;wxNotebook::SetSelection(int)
@@ -13657,8 +13657,6 @@ EXPORTS
SetPageImage__10wxNotebookFiT1 SetPageImage__10wxNotebookFiT1
;wxNotebook::DoPhase(int) ;wxNotebook::DoPhase(int)
DoPhase__10wxNotebookFi DoPhase__10wxNotebookFi
;wxNotebook::DeletePage(int)
DeletePage__10wxNotebookFi
;wxNotebook::GetPageCount() const ;wxNotebook::GetPageCount() const
GetPageCount__10wxNotebookCFv GetPageCount__10wxNotebookCFv
;wxNotebook::wxNotebook(wxWindow*,int,const wxPoint&,const wxSize&,long,const wxString&) ;wxNotebook::wxNotebook(wxWindow*,int,const wxPoint&,const wxSize&,long,const wxString&)
@@ -13679,8 +13677,6 @@ EXPORTS
wxConstructorForwxNotebook__Fv wxConstructorForwxNotebook__Fv
;wxConstructorForwxNotebookEvent() ;wxConstructorForwxNotebookEvent()
wxConstructorForwxNotebookEvent__Fv wxConstructorForwxNotebookEvent__Fv
;wxNotebook::OS2OnNotify(int,void*,void**)
OS2OnNotify__10wxNotebookFiPvPPv
;wxNotebook::Init() ;wxNotebook::Init()
Init__10wxNotebookFv Init__10wxNotebookFv
;wxNotebook::sm_classwxNotebook ;wxNotebook::sm_classwxNotebook
@@ -13688,17 +13684,17 @@ EXPORTS
wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING
;wxNotebook::sm_eventTable ;wxNotebook::sm_eventTable
sm_eventTable__10wxNotebook sm_eventTable__10wxNotebook
;wxNotebook::OS2OnScroll(int,unsigned short,unsigned short,unsigned long)
OS2OnScroll__10wxNotebookFiUsT2Ul
__vft10wxNotebook8wxObject __vft10wxNotebook8wxObject
;wxNotebook::GetPageImage(int) const ;wxNotebook::GetPageImage(int) const
GetPageImage__10wxNotebookCFi GetPageImage__10wxNotebookCFi
;wxNotebook::RemovePage(int)
RemovePage__10wxNotebookFi
;wxNotebook::InsertPage(int,wxWindow*,const wxString&,unsigned long,int) ;wxNotebook::InsertPage(int,wxWindow*,const wxString&,unsigned long,int)
InsertPage__10wxNotebookFiP8wxWindowRC8wxStringUlT1 InsertPage__10wxNotebookFiP8wxWindowRC8wxStringUlT1
;wxNotebook::DoRemovePage(int)
DoRemovePage__10wxNotebookFi
;wxNotebook::GetEventTable() const ;wxNotebook::GetEventTable() const
GetEventTable__10wxNotebookCFv GetEventTable__10wxNotebookCFv
;wxNotebook::~wxNotebook()
__dt__10wxNotebookFv
;wxNotebook::GetRowCount() const ;wxNotebook::GetRowCount() const
GetRowCount__10wxNotebookCFv GetRowCount__10wxNotebookCFv
;wxNotebook::Create(wxWindow*,int,const wxPoint&,const wxSize&,long,const wxString&) ;wxNotebook::Create(wxWindow*,int,const wxPoint&,const wxSize&,long,const wxString&)
@@ -13890,6 +13886,7 @@ EXPORTS
GetRowCount__10wxRadioBoxCFv GetRowCount__10wxRadioBoxCFv
;wxRadioBox::Create(wxWindow*,int,const wxString&,const wxPoint&,const wxSize&,int,const wxString*,int,long,const wxValidator&,const wxString&) ;wxRadioBox::Create(wxWindow*,int,const wxString&,const wxPoint&,const wxSize&,int,const wxString*,int,long,const wxValidator&,const wxString&)
Create__10wxRadioBoxFP8wxWindowiRC8wxStringRC7wxPointRC6wxSizeT2PC8wxStringT2lRC11wxValidatorT3 Create__10wxRadioBoxFP8wxWindowiRC8wxStringRC7wxPointRC6wxSizeT2PC8wxStringT2lRC11wxValidatorT3
wxRadioBoxWndProc
;wxRadioBox::FindString(const wxString&) const ;wxRadioBox::FindString(const wxString&) const
FindString__10wxRadioBoxCFRC8wxString FindString__10wxRadioBoxCFRC8wxString
__vft10wxRadioBox8wxObject __vft10wxRadioBox8wxObject