Various OS/2 changes to keep up with general library changes and some new dilaog support.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13639 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
19f1a09ac9
commit
1b086de146
@ -135,6 +135,8 @@ bool wxControl::OS2CreateControl(
|
||||
zClass = WC_COMBOBOX;
|
||||
else if ((strcmp(zClassname, "STATIC")) == 0)
|
||||
zClass = WC_STATIC;
|
||||
else if ((strcmp(zClassname, "BUTTON")) == 0)
|
||||
zClass = WC_BUTTON;
|
||||
dwStyle |= WS_VISIBLE;
|
||||
|
||||
//
|
||||
|
@ -251,6 +251,7 @@ COMMONOBJS = \
|
||||
..\common\$D\imagbmp.obj \
|
||||
..\common\$D\image.obj \
|
||||
..\common\$D\imaggif.obj \
|
||||
..\common\$D\imagiff.obj \
|
||||
..\common\$D\imagjpeg.obj \
|
||||
..\common\$D\imagpcx.obj \
|
||||
..\common\$D\imagpng.obj \
|
||||
@ -381,6 +382,7 @@ COMLIBOBJS2 = \
|
||||
imagbmp.obj \
|
||||
image.obj \
|
||||
imaggif.obj \
|
||||
imagiff.obj \
|
||||
imagjpeg.obj \
|
||||
imagpcx.obj \
|
||||
imagpng.obj \
|
||||
@ -407,10 +409,10 @@ COMLIBOBJS2 = \
|
||||
popupcmn.obj \
|
||||
prntbase.obj \
|
||||
process.obj \
|
||||
protocol.obj \
|
||||
quantize.obj
|
||||
protocol.obj
|
||||
|
||||
COMLIBOBJS3 = \
|
||||
quantize.obj \
|
||||
radiocmn.obj \
|
||||
regex.obj \
|
||||
resource.obj \
|
||||
@ -747,6 +749,7 @@ $(COMLIBOBJS2):
|
||||
copy ..\common\$D\imagbmp.obj
|
||||
copy ..\common\$D\image.obj
|
||||
copy ..\common\$D\imaggif.obj
|
||||
copy ..\common\$D\imagiff.obj
|
||||
copy ..\common\$D\imagjpeg.obj
|
||||
copy ..\common\$D\imagpcx.obj
|
||||
copy ..\common\$D\imagpng.obj
|
||||
@ -774,9 +777,9 @@ $(COMLIBOBJS2):
|
||||
copy ..\common\$D\prntbase.obj
|
||||
copy ..\common\$D\process.obj
|
||||
copy ..\common\$D\protocol.obj
|
||||
copy ..\common\$D\quantize.obj
|
||||
|
||||
$(COMLIBOBJS3):
|
||||
copy ..\common\$D\quantize.obj
|
||||
copy ..\common\$D\radiocmn.obj
|
||||
copy ..\common\$D\regex.obj
|
||||
copy ..\common\$D\resource.obj
|
||||
|
@ -80,9 +80,17 @@ inline bool IsMdiCommandId(int id)
|
||||
return (id >= wxFIRST_MDI_CHILD) && (id <= wxLAST_MDI_CHILD);
|
||||
}
|
||||
|
||||
// unpack the parameters of WM_MDIACTIVATE message
|
||||
static void UnpackMDIActivate(WXWPARAM wParam, WXLPARAM lParam,
|
||||
WXWORD *activate, WXHWND *hwndAct, WXHWND *hwndDeact);
|
||||
|
||||
// return the HMENU of the MDI menu
|
||||
static inline HMENU GetMDIWindowMenu(wxMDIParentFrame *frame)
|
||||
{
|
||||
wxMenu *menu = frame->GetWindowMenu();
|
||||
return menu ? GetHmenuOf(menu) : 0;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
// implementation
|
||||
// ===========================================================================
|
||||
|
@ -27,6 +27,11 @@
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxRadioButton, wxControl)
|
||||
|
||||
void wxRadioButton::Init()
|
||||
{
|
||||
m_bFocusJustSet = FALSE;
|
||||
} // end of wxRadioButton::Init
|
||||
|
||||
void wxRadioButton::Command (
|
||||
wxCommandEvent& rEvent
|
||||
)
|
||||
@ -48,103 +53,81 @@ bool wxRadioButton::Create(
|
||||
, const wxString& rsName
|
||||
)
|
||||
{
|
||||
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 ( !CreateControl( pParent
|
||||
,vId
|
||||
,rPos
|
||||
,rSize
|
||||
,lStyle
|
||||
#if wxUSE_VALIDATORS
|
||||
SetValidator(rValidator);
|
||||
,rValidator
|
||||
#endif
|
||||
,rsName))
|
||||
return FALSE;
|
||||
|
||||
if (pParent)
|
||||
pParent->AddChild(this);
|
||||
long lSstyle = HasFlag(wxRB_GROUP) ? WS_GROUP : 0;
|
||||
|
||||
SetBackgroundColour(pParent->GetBackgroundColour());
|
||||
SetForegroundColour(pParent->GetForegroundColour());
|
||||
lSstyle |= BS_AUTORADIOBUTTON;
|
||||
|
||||
if (vId == -1)
|
||||
m_windowId = (int)NewControlId();
|
||||
else
|
||||
m_windowId = vId;
|
||||
if (HasFlag(wxCLIP_SIBLINGS))
|
||||
lSstyle |= WS_CLIPSIBLINGS;
|
||||
|
||||
if (!OS2CreateControl( _T("BUTTON")
|
||||
,lSstyle
|
||||
,rPos
|
||||
,rSize
|
||||
,rsLabel
|
||||
,0
|
||||
))
|
||||
return FALSE;
|
||||
|
||||
m_windowStyle = lStyle ;
|
||||
if (HasFlag(wxRB_GROUP))
|
||||
SetValue(TRUE);
|
||||
|
||||
if (m_windowStyle & wxRB_GROUP)
|
||||
lGroupStyle = WS_GROUP;
|
||||
|
||||
lsStyle = lGroupStyle | BS_AUTORADIOBUTTON | WS_VISIBLE ;
|
||||
|
||||
if (m_windowStyle & wxCLIP_SIBLINGS )
|
||||
lsStyle |= WS_CLIPSIBLINGS;
|
||||
//
|
||||
// If the parent is a scrolled window the controls must
|
||||
// have this style or they will overlap the scrollbars
|
||||
//
|
||||
if (pParent)
|
||||
if (pParent->IsKindOf(CLASSINFO(wxScrolledWindow)) ||
|
||||
pParent->IsKindOf(CLASSINFO(wxGenericScrolledWindow)))
|
||||
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"));
|
||||
|
||||
if (rsLabel != wxT(""))
|
||||
{
|
||||
int nLabelWidth;
|
||||
int nLabelHeight;
|
||||
|
||||
GetTextExtent( rsLabel
|
||||
,&nLabelWidth
|
||||
,&nLabelHeight
|
||||
,NULL
|
||||
,NULL
|
||||
,&this->GetFont()
|
||||
);
|
||||
if (nWidth < 0)
|
||||
nWidth = (int)(nLabelWidth + RADIO_SIZE);
|
||||
if (nHeight<0)
|
||||
{
|
||||
nHeight = (int)(nLabelHeight);
|
||||
if (nHeight < RADIO_SIZE)
|
||||
nHeight = RADIO_SIZE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (nWidth < 0)
|
||||
nWidth = RADIO_SIZE;
|
||||
if (nHeight < 0)
|
||||
nHeight = RADIO_SIZE;
|
||||
}
|
||||
|
||||
//
|
||||
// Subclass again for purposes of dialog editing mode
|
||||
//
|
||||
SubclassWin((WXHWND)m_hWnd);
|
||||
SetFont(pParent->GetFont());
|
||||
SetSize( nX
|
||||
,nY
|
||||
,nWidth
|
||||
,nHeight
|
||||
SetFont(*wxSMALL_FONT);
|
||||
SetSize( rPos.x
|
||||
,rPos.y
|
||||
,rSize.x
|
||||
,rSize.y
|
||||
);
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
} // end of wxRadioButton::Create
|
||||
|
||||
wxSize wxRadioButton::DoGetBestSize() const
|
||||
{
|
||||
static int snRadioSize = 0;
|
||||
|
||||
if (!snRadioSize)
|
||||
{
|
||||
wxScreenDC vDC;
|
||||
|
||||
vDC.SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
|
||||
snRadioSize = vDC.GetCharHeight();
|
||||
}
|
||||
|
||||
wxString sStr = GetLabel();
|
||||
int nRadioWidth;
|
||||
int nRadioHeight;
|
||||
|
||||
if (!sStr.empty())
|
||||
{
|
||||
GetTextExtent( sStr
|
||||
,&nRadioWidth
|
||||
,&nRadioHeight
|
||||
);
|
||||
nRadioWidth += snRadioSize + GetCharWidth();
|
||||
if (nRadioHeight < snRadioSize)
|
||||
nRadioHeight = snRadioSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
nRadioWidth = snRadioSize;
|
||||
nRadioHeight = snRadioSize;
|
||||
}
|
||||
return wxSize( nRadioWidth
|
||||
,nRadioHeight
|
||||
);
|
||||
} // end of wxRadioButton::DoGetBestSize
|
||||
|
||||
//
|
||||
// Get single selection, for single choice list items
|
||||
//
|
||||
@ -172,6 +155,22 @@ bool wxRadioButton::OS2Command(
|
||||
return FALSE;
|
||||
} // end of wxRadioButton::OS2Command
|
||||
|
||||
void wxRadioButton::SetFocus()
|
||||
{
|
||||
// when the radio button receives a WM_SETFOCUS message it generates a
|
||||
// BN_CLICKED which is totally unexpected and leads to catastrophic results
|
||||
// if you pop up a dialog from the radio button event handler as, when the
|
||||
// dialog is dismissed, the focus is returned to the radio button which
|
||||
// generates BN_CLICKED which leads to showing another dialog and so on
|
||||
// without end!
|
||||
//
|
||||
// to aviod this, we drop the pseudo BN_CLICKED events generated when the
|
||||
// button gains focus
|
||||
m_bFocusJustSet = TRUE;
|
||||
|
||||
wxControl::SetFocus();
|
||||
}
|
||||
|
||||
void wxRadioButton::SetLabel(
|
||||
const wxString& rsLabel
|
||||
)
|
||||
|
@ -197,15 +197,15 @@ bool wxTopLevelWindowOS2::CreateDialog(
|
||||
}
|
||||
|
||||
HWND hWndDlg;
|
||||
HWND hWndParent;
|
||||
HWND hWndOwner;
|
||||
|
||||
if (pParent)
|
||||
hWndParent = GetHwndOf(pParent);
|
||||
hWndOwner = GetHwndOf(pParent);
|
||||
else
|
||||
hWndParent = HWND_DESKTOP;
|
||||
hWndOwner = HWND_DESKTOP;
|
||||
|
||||
hWndDlg = ::WinLoadDlg( hWndParent
|
||||
,hWndParent
|
||||
hWndDlg = ::WinLoadDlg( HWND_DESKTOP
|
||||
,hWndOwner
|
||||
,(PFNWP)wxDlgProc
|
||||
,NULL
|
||||
,(ULONG)ulDlgTemplate
|
||||
|
@ -327,7 +327,6 @@ wxWindowOS2::~wxWindowOS2()
|
||||
{
|
||||
m_isBeingDeleted = TRUE;
|
||||
|
||||
OS2DetachWindowMenu();
|
||||
for (wxWindow* pWin = GetParent(); pWin; pWin = pWin->GetParent())
|
||||
{
|
||||
wxFrame* pFrame = wxDynamicCast(pWin, wxFrame);
|
||||
@ -1545,7 +1544,7 @@ void wxWindowOS2::DoMoveWindow(
|
||||
HWND hParent;
|
||||
wxWindow* pParent = GetParent();
|
||||
|
||||
if (pParent)
|
||||
if (pParent && !IsKindOf(CLASSINFO(wxDialog)))
|
||||
{
|
||||
int nOS2Height = GetOS2ParentHeight(pParent);
|
||||
|
||||
@ -1607,7 +1606,7 @@ void wxWindowOS2::DoSetSize(
|
||||
int nY2 = nY;
|
||||
wxWindow* pParent = (wxWindow*)GetParent();
|
||||
|
||||
if (pParent)
|
||||
if (pParent && !IsKindOf(CLASSINFO(wxDialog)))
|
||||
{
|
||||
int nOS2Height = GetOS2ParentHeight(pParent);
|
||||
|
||||
@ -2718,6 +2717,8 @@ MRESULT wxWindowOS2::OS2WindowProc(
|
||||
#endif // __WXDEBUG__
|
||||
if (IsKindOf(CLASSINFO(wxFrame)))
|
||||
mResult = ::WinDefWindowProc(m_hWnd, uMsg, wParam, lParam);
|
||||
else if (IsKindOf(CLASSINFO(wxDialog)))
|
||||
mResult = ::WinDefDlgProc( m_hWnd, uMsg, wParam, lParam);
|
||||
else
|
||||
mResult = OS2DefWindowProc(uMsg, wParam, lParam);
|
||||
}
|
||||
@ -2808,40 +2809,6 @@ void wxWindowOS2::OS2DestroyWindow()
|
||||
{
|
||||
}
|
||||
|
||||
void wxWindowOS2::OS2DetachWindowMenu()
|
||||
{
|
||||
#ifndef __WXUNIVERSAL__
|
||||
if (m_hMenu)
|
||||
{
|
||||
HMENU hMenu = (HMENU)m_hMenu;
|
||||
|
||||
int nN = (int)::WinSendMsg(hMenu, MM_QUERYITEMCOUNT, 0, 0);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < nN; i++)
|
||||
{
|
||||
wxChar zBuf[100];
|
||||
int nChars = (int)::WinSendMsg( hMenu
|
||||
,MM_QUERYITEMTEXT
|
||||
,MPFROM2SHORT(i, nN)
|
||||
,zBuf
|
||||
);
|
||||
if (!nChars)
|
||||
{
|
||||
wxLogLastError(wxT("GetMenuString"));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (wxStrcmp(zBuf, wxT("&Window")) == 0)
|
||||
{
|
||||
::WinSendMsg(hMenu, MM_DELETEITEM, MPFROM2SHORT(i, TRUE), 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // __WXUNIVERSAL__
|
||||
} // end of wxWindowOS2::OS2DetachWindowMenu
|
||||
|
||||
bool wxWindowOS2::OS2GetCreateWindowCoords(
|
||||
const wxPoint& rPos
|
||||
, const wxSize& rSize
|
||||
|
Loading…
Reference in New Issue
Block a user