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
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_NOTEBOOK_H_
#define _WX_NOTEBOOK_H_
#ifndef _NOTEBOOK_H
#define _NOTEBOOK_H
#if wxUSE_NOTEBOOK
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/dynarray.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);
#include "wx/control.h"
// ----------------------------------------------------------------------------
// 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
{
public:
// ctors
// -----
// default for dynamic class
wxNotebook();
// the same arguments as for wxControl (@@@ any special styles?)
wxNotebook(wxWindow *parent,
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();
//
// Ctors
// -----
// Default for dynamic class
//
wxNotebook();
// accessors
// ---------
// get number of pages in the dialog
int GetPageCount() const;
//
// the same arguments as for wxControl
//
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)
// NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
int SetSelection(int nPage);
// cycle thru the tabs
void AdvanceSelection(bool bForward = TRUE);
// get the currently selected page
int GetSelection() const { return m_nSelection; }
//
int SetSelection(int nPage);
// set/get the title of a page
bool SetPageText(int nPage, const wxString& strText);
wxString GetPageText(int nPage) const;
//
// Get the currently selected page
//
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
// 1) create an image list
// 2) associate it with the notebook
// 3) set for each page it's image
//
// Set/Get the title of a page
//
bool SetPageText( int nPage
,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
void SetImageList(wxImageList* imageList);
// get pointer (may be NULL) to the associated image list
wxImageList* GetImageList() const { return m_pImageList; }
//
void SetImageList(wxImageList* pImageList);
// sets/returns item's image index in the current image list
int GetPageImage(int nPage) const;
bool SetPageImage(int nPage, int nImage);
//
// Sets/returns item's image index in the current image list
//
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
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)
void SetPageSize(const wxSize& size);
// set the padding between tabs (in pixels)
void SetPadding(const wxSize& padding);
//
void SetPageSize(const wxSize& rSize);
// operations
// ----------
// remove one page from the notebook
bool DeletePage(int nPage);
// remove one page from the notebook, without deleting
bool RemovePage(int nPage);
// remove all pages
bool DeleteAllPages();
// adds a new page to the notebook (it will be deleted ny the notebook,
//
// Set the padding between tabs (in pixels)
//
void SetPadding(const wxSize& rPadding);
//
// Operations
// ----------
// 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.
bool AddPage(wxNotebookPage *pPage,
const wxString& strText,
bool bSelect = FALSE,
int imageId = -1);
// the same as AddPage(), but adds it at the specified position
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]; }
//
bool AddPage( wxNotebookPage* pPage
,const wxString& rsStrText
,bool bSelect = FALSE
,int nImageId = -1
);
//
// 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
// style.
void SetTabSize(const wxSize& sz);
//
void SetTabSize(const wxSize& rSize);
// callbacks
// ---------
void OnSize(wxSizeEvent& event);
void OnSelChange(wxNotebookEvent& event);
void OnSetFocus(wxFocusEvent& event);
void OnNavigationKey(wxNavigationKeyEvent& event);
//
// Callbacks
// ---------
//
void OnSize(wxSizeEvent& rEvent);
void OnSelChange(wxNotebookEvent& rEvent);
void OnSetFocus(wxFocusEvent& rEvent);
void OnNavigationKey(wxNavigationKeyEvent& rEvent);
// base class virtuals
// -------------------
virtual bool OS2OnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
virtual void SetConstraintSizes(bool recurse = TRUE);
virtual bool DoPhase(int nPhase);
//
// Base class virtuals
// -------------------
//
virtual bool OS2OnScroll( int nOrientation
,WXWORD wSBCode
,WXWORD wPos
,WXHWND hControl
);
virtual void SetConstraintSizes(bool bRecurse = TRUE);
virtual bool DoPhase(int nPhase);
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)
DECLARE_EVENT_TABLE()
};
int m_nSelection; // The current selection (-1 if none)
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);
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
// smaller
virtual wxPoint GetClientAreaOrigin(void) const;
@ -607,6 +611,7 @@ private:
HWND m_hWndScrollBarHorz;
HWND m_hWndScrollBarVert;
SWP m_vWinSwp;
bool m_bIsActivePage;
// Virtual function hiding supression
inline virtual bool Reparent(wxWindowBase* pNewParent)

View File

@ -29,6 +29,10 @@
IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl)
IMPLEMENT_DYNAMIC_CLASS(wxBitmapCheckBox, wxCheckBox)
extern void wxAssociateWinWithHandle( HWND hWnd
,wxWindowOS2* pWin
);
// ============================================================================
// implementation
// ============================================================================
@ -64,6 +68,9 @@ bool wxCheckBox::Create(
, const wxString& rsName
)
{
LONG lColor;
bool bOk;
if (!CreateControl( pParent
,vId
,rPos
@ -76,17 +83,27 @@ bool wxCheckBox::Create(
))
return FALSE;
long osStyle = BS_AUTOCHECKBOX |
WS_TABSTOP |
WS_VISIBLE;
return OS2CreateControl( wxT("BUTTON")
,osStyle
,rPos
,rSize
,rsLabel
,0
);
bOk = OS2CreateControl( wxT("BUTTON")
,osStyle
,rPos
,rSize
,rsLabel
,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
void wxCheckBox::SetLabel(

View File

@ -105,10 +105,7 @@ bool wxControl::OS2CreateControl(
)
{
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
//
@ -134,6 +131,8 @@ bool wxControl::OS2CreateControl(
zClass = WC_STATIC;
else if ((strcmp(zClassname, "BUTTON")) == 0)
zClass = WC_BUTTON;
else if ((strcmp(zClassname, "NOTEBOOK")) == 0)
zClass = WC_NOTEBOOK;
dwStyle |= WS_VISIBLE;
m_hWnd = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle
@ -170,8 +169,11 @@ bool wxControl::OS2CreateControl(
InheritAttributes();
SetXComp(0);
SetYComp(0);
if (nW == 0 || nH == 0)
SetBestSize(rSize);
SetSize( rPos.x
,rPos.y
,rSize.x
,rSize.y
);
return TRUE;
} // end of wxControl::OS2CreateControl

View File

@ -640,12 +640,12 @@ void wxOS2SelectMatchingFontByName(
//
pFattrs->usRecordLength = sizeof(FATTRS); // Sets size of structure
pFattrs->lMatch = pFM[nIndex].lMatch; // Force match
pFattrs->idRegistry = 0; // Registry
pFattrs->usCodePage = 0; // Match proper CodePage
pFattrs->fsFontUse = 0; // Use only outline fonts
pFattrs->fsType = 0; // Use only outline fonts
pFattrs->lMaxBaselineExt = 0; // Use only outline fonts
pFattrs->lAveCharWidth = 0; // Use only outline fonts
pFattrs->idRegistry = 0;
pFattrs->usCodePage = 0;
pFattrs->fsFontUse = 0;
pFattrs->fsType = 0;
pFattrs->lMaxBaselineExt = 0;
pFattrs->lAveCharWidth = 0;
wxStrcpy(pFattrs->szFacename, pFM[nIndex].szFacename);
if (pFont->GetWeight() == wxNORMAL)
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 lParam
);
MRESULT EXPENTRY wxRadioBoxWndProc( HWND hWnd
,UINT uMessage
,MPARAM wParam
,MPARAM lParam
);
// ---------------------------------------------------------------------------
// global vars
// ---------------------------------------------------------------------------
// the pointer to standard radio button wnd proc
extern void wxAssociateWinWithHandle( HWND hWnd
,wxWindowOS2* pWin
);
static WXFARPROC fnWndProcRadioBtn = NULL;
static WXFARPROC fnWndProcRadioBox = NULL;
// ===========================================================================
// implementation
@ -260,20 +269,10 @@ bool wxRadioBox::Create(
, 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;
LONG lColor;
vColour.Set(wxString("BLACK"));
lColor = (LONG)vColour.GetPixel();
m_backgroundColour = pParent->GetBackgroundColour();
m_nSelectedButton = -1;
m_nNoItems = 0;
@ -296,17 +295,14 @@ bool wxRadioBox::Create(
))
return FALSE;
if (!OS2CreateControl( "STATIC"
#if RADIOBTN_PARENT_IS_RADIOBOX
,SS_GROUPBOX | WS_GROUP | WS_CLIPCHILDREN
#else
,SS_GROUPBOX | WS_GROUP | WS_CLIPSIBLINGS
#endif
,SS_GROUPBOX
,rPos
,rSize
,rsTitle
))
return FALSE;
wxAssociateWinWithHandle(m_hWnd, this);
#if RADIOBTN_PARENT_IS_RADIOBOX
HWND hWndParent = GetHwnd();
#else
@ -323,11 +319,6 @@ bool wxRadioBox::Create(
m_pnRadioWidth = new int[nNum];
m_pnRadioHeight = new int[nNum];
if (pTextFont->Ok())
{
hFont = pTextFont->GetResourceHandle();
}
for (int i = 0; i < nNum; i++)
{
m_pnRadioWidth[i] = m_pnRadioHeight[i] = -1;
@ -368,8 +359,9 @@ bool wxRadioBox::Create(
}
m_ahRadioButtons[i] = (WXHWND)hWndBtn;
SubclassRadioButton((WXHWND)hWndBtn);
wxAssociateWinWithHandle(hWndBtn, this);
wxOS2SetFont( hWndBtn
,*pTextFont
,*wxSMALL_FONT
);
::WinSetWindowULong(hWndBtn, QWL_USER, (ULONG)this);
m_aSubControls.Add(nNewId);
@ -389,13 +381,22 @@ bool wxRadioBox::Create(
,NULL
,NULL
);
SetFont(*pTextFont);
SetFont(*wxSMALL_FONT);
fnWndProcRadioBox = (WXFARPROC)::WinSubclassWindow( GetHwnd()
,(PFNWP)wxRadioBoxWndProc
);
::WinSetWindowULong(GetHwnd(), QWL_USER, (ULONG)this);
lColor = (LONG)vColour.GetPixel();
::WinSetPresParam( m_hWnd
,PP_FOREGROUNDCOLOR
,sizeof(LONG)
,(PVOID)&lColor
);
::WinSetPresParam( m_hWnd
,PP_BORDERDARKCOLOR
,sizeof(LONG)
,(PVOID)&lColor
);
lColor = (LONG)m_backgroundColour.GetPixel();
::WinSetPresParam( m_hWnd
@ -403,6 +404,11 @@ bool wxRadioBox::Create(
,sizeof(LONG)
,(PVOID)&lColor
);
::WinSetPresParam( m_hWnd
,PP_BORDERLIGHTCOLOR
,sizeof(LONG)
,(PVOID)&lColor
);
SetXComp(0);
SetYComp(0);
SetSelection(0);
@ -411,7 +417,6 @@ bool wxRadioBox::Create(
,rSize.x
,rSize.y
);
delete pTextFont;
return TRUE;
} // end of wxRadioBox::Create
@ -969,10 +974,8 @@ bool wxRadioBox::OS2Command(
if (nSelectedButton == -1)
{
//
// Just ignore it - due to a hack with WM_NCHITTEST handling in our
// 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...)
// Just ignore it
//
return FALSE;
}
if (nSelectedButton != m_nSelectedButton)
@ -1213,3 +1216,18 @@ MRESULT 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)
extern void wxAssociateWinWithHandle( HWND hWnd
,wxWindowOS2* pWin
);
void wxRadioButton::Init()
{
m_bFocusJustSet = FALSE;
@ -82,21 +86,16 @@ bool wxRadioButton::Create(
))
return FALSE;
wxAssociateWinWithHandle(m_hWnd, this);
if (HasFlag(wxRB_GROUP))
SetValue(TRUE);
wxFont* pTextFont = new wxFont( 10
,wxMODERN
,wxNORMAL
,wxNORMAL
);
SetFont(*pTextFont);
SetFont(*wxSMALL_FONT);
SetSize( rPos.x
,rPos.y
,rSize.x
,rSize.y
);
delete pTextFont;
return TRUE;
} // end of wxRadioButton::Create

View File

@ -301,6 +301,7 @@ void wxWindowOS2::Init()
m_bUseCtl3D = FALSE;
m_bMouseInWindow = FALSE;
m_bLastKeydownProcessed = FALSE;
m_bIsActivePage = TRUE;
//
// wxWnd
@ -1646,13 +1647,86 @@ void wxWindowOS2::DoMoveWindow(
::WinQueryWindowRect(HWND_DESKTOP, &vRect);
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()
,HWND_TOP
,(LONG)nX
,(LONG)nY
,(LONG)nWidth
,(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)
//
@ -2853,6 +2927,48 @@ MRESULT wxWindowOS2::OS2WindowProc(
case WM_CONTROL:
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_DOWNARROW:
case SPBN_CHANGE:
@ -3322,7 +3438,7 @@ bool wxWindowOS2::HandleKillFocus(
#endif // wxUSE_CARET
#if wxUSE_TEXTCTRL
//
//
// If it's a wxTextCtrl don't send the event as it will be done
// after the control gets to process it.
//
@ -3334,7 +3450,7 @@ bool wxWindowOS2::HandleKillFocus(
}
#endif
//
//
// 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.
//
@ -3349,7 +3465,7 @@ bool wxWindowOS2::HandleKillFocus(
vEvent.SetEventObject(this);
//
//
// wxFindWinFromHandle() may return NULL, it is ok
//
vEvent.SetWindow(wxFindWinFromHandle(hWnd));
@ -3718,7 +3834,9 @@ bool wxWindowOS2::HandlePaint()
{
//
// 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;
RECTL vRect;
@ -3746,35 +3864,76 @@ bool wxWindowOS2::HandlePaint()
,NULL
);
::WinFillRect(hPS, &vRect, GetBackgroundColour().GetPixel());
if (m_dwExStyle)
if (::WinIsWindowVisible(GetHWND()) && m_bIsActivePage)
{
LINEBUNDLE vLineBundle;
::WinFillRect(hPS, &vRect, GetBackgroundColour().GetPixel());
if (m_dwExStyle)
{
LINEBUNDLE vLineBundle;
vLineBundle.lColor = 0x00000000; // Black
vLineBundle.usMixMode = FM_OVERPAINT;
vLineBundle.fxWidth = 1;
vLineBundle.lGeomWidth = 1;
vLineBundle.usType = LINETYPE_SOLID;
vLineBundle.usEnd = 0;
vLineBundle.usJoin = 0;
::GpiSetAttrs( hPS
,PRIM_LINE
,LBB_COLOR | LBB_MIX_MODE | LBB_WIDTH | LBB_GEOM_WIDTH | LBB_TYPE
,0L
,&vLineBundle
);
::WinQueryWindowRect(GetHwnd(), &vRect);
wxDrawBorder( hPS
,vRect
,m_dwExStyle
);
vLineBundle.lColor = 0x00000000; // Black
vLineBundle.usMixMode = FM_OVERPAINT;
vLineBundle.fxWidth = 1;
vLineBundle.lGeomWidth = 1;
vLineBundle.usType = LINETYPE_SOLID;
vLineBundle.usEnd = 0;
vLineBundle.usJoin = 0;
::GpiSetAttrs( hPS
,PRIM_LINE
,LBB_COLOR | LBB_MIX_MODE | LBB_WIDTH | LBB_GEOM_WIDTH | LBB_TYPE
,0L
,&vLineBundle
);
::WinQueryWindowRect(GetHwnd(), &vRect);
wxDrawBorder( hPS
,vRect
,m_dwExStyle
);
}
}
::WinEndPaint(hPS);
}
::WinEndPaint(hPS);
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;
} // end of wxWindowOS2::HandlePaint
@ -4300,62 +4459,69 @@ void wxWindowOS2::MoveChildren(
int nDiff
)
{
SWP vSwp;
for (wxWindowList::Node* pNode = GetChildren().GetFirst();
pNode;
pNode = pNode->GetNext())
if (GetAutoLayout())
{
wxWindow* pWin = pNode->GetData();
Layout();
}
else
{
SWP vSwp;
::WinQueryWindowPos( GetHwndOf(pWin)
,&vSwp
);
if (pWin->IsKindOf(CLASSINFO(wxControl)))
for (wxWindowList::Node* pNode = GetChildren().GetFirst();
pNode;
pNode = pNode->GetNext())
{
wxControl* pCtrl;
wxWindow* pWin = pNode->GetData();
//
// Must deal with controls that have margins like ENTRYFIELD. The SWP
// struct of such a control will have and origin offset from its intended
// position by the width of the margins.
//
pCtrl = wxDynamicCast(pWin, wxControl);
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;
::WinQueryWindowPos( GetHwndOf(pWin)
,&vSwp
);
if (pWin->IsKindOf(CLASSINFO(wxControl)))
{
wxControl* pCtrl;
pRadioBox = wxDynamicCast(pWin, wxRadioBox);
pRadioBox->AdjustButtons( (int)vSwp.x
,(int)vSwp.y - nDiff
,(int)vSwp.cx
,(int)vSwp.cy
,pRadioBox->GetSizeFlags()
);
}
if (pWin->IsKindOf(CLASSINFO(wxSlider)))
{
wxSlider* pSlider;
//
// Must deal with controls that have margins like ENTRYFIELD. The SWP
// struct of such a control will have and origin offset from its intended
// position by the width of the margins.
//
pCtrl = wxDynamicCast(pWin, wxControl);
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;
pSlider = wxDynamicCast(pWin, wxSlider);
pSlider->AdjustSubControls( (int)vSwp.x
,(int)vSwp.y - nDiff
,(int)vSwp.cx
,(int)vSwp.cy
,(int)pSlider->GetSizeFlags()
);
pRadioBox = wxDynamicCast(pWin, wxRadioBox);
pRadioBox->AdjustButtons( (int)vSwp.x
,(int)vSwp.y - nDiff
,(int)vSwp.cx
,(int)vSwp.cy
,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();

View File

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