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;
|
zClass = WC_COMBOBOX;
|
||||||
else if ((strcmp(zClassname, "STATIC")) == 0)
|
else if ((strcmp(zClassname, "STATIC")) == 0)
|
||||||
zClass = WC_STATIC;
|
zClass = WC_STATIC;
|
||||||
|
else if ((strcmp(zClassname, "BUTTON")) == 0)
|
||||||
|
zClass = WC_BUTTON;
|
||||||
dwStyle |= WS_VISIBLE;
|
dwStyle |= WS_VISIBLE;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -251,6 +251,7 @@ COMMONOBJS = \
|
|||||||
..\common\$D\imagbmp.obj \
|
..\common\$D\imagbmp.obj \
|
||||||
..\common\$D\image.obj \
|
..\common\$D\image.obj \
|
||||||
..\common\$D\imaggif.obj \
|
..\common\$D\imaggif.obj \
|
||||||
|
..\common\$D\imagiff.obj \
|
||||||
..\common\$D\imagjpeg.obj \
|
..\common\$D\imagjpeg.obj \
|
||||||
..\common\$D\imagpcx.obj \
|
..\common\$D\imagpcx.obj \
|
||||||
..\common\$D\imagpng.obj \
|
..\common\$D\imagpng.obj \
|
||||||
@ -381,6 +382,7 @@ COMLIBOBJS2 = \
|
|||||||
imagbmp.obj \
|
imagbmp.obj \
|
||||||
image.obj \
|
image.obj \
|
||||||
imaggif.obj \
|
imaggif.obj \
|
||||||
|
imagiff.obj \
|
||||||
imagjpeg.obj \
|
imagjpeg.obj \
|
||||||
imagpcx.obj \
|
imagpcx.obj \
|
||||||
imagpng.obj \
|
imagpng.obj \
|
||||||
@ -407,10 +409,10 @@ COMLIBOBJS2 = \
|
|||||||
popupcmn.obj \
|
popupcmn.obj \
|
||||||
prntbase.obj \
|
prntbase.obj \
|
||||||
process.obj \
|
process.obj \
|
||||||
protocol.obj \
|
protocol.obj
|
||||||
quantize.obj
|
|
||||||
|
|
||||||
COMLIBOBJS3 = \
|
COMLIBOBJS3 = \
|
||||||
|
quantize.obj \
|
||||||
radiocmn.obj \
|
radiocmn.obj \
|
||||||
regex.obj \
|
regex.obj \
|
||||||
resource.obj \
|
resource.obj \
|
||||||
@ -747,6 +749,7 @@ $(COMLIBOBJS2):
|
|||||||
copy ..\common\$D\imagbmp.obj
|
copy ..\common\$D\imagbmp.obj
|
||||||
copy ..\common\$D\image.obj
|
copy ..\common\$D\image.obj
|
||||||
copy ..\common\$D\imaggif.obj
|
copy ..\common\$D\imaggif.obj
|
||||||
|
copy ..\common\$D\imagiff.obj
|
||||||
copy ..\common\$D\imagjpeg.obj
|
copy ..\common\$D\imagjpeg.obj
|
||||||
copy ..\common\$D\imagpcx.obj
|
copy ..\common\$D\imagpcx.obj
|
||||||
copy ..\common\$D\imagpng.obj
|
copy ..\common\$D\imagpng.obj
|
||||||
@ -774,9 +777,9 @@ $(COMLIBOBJS2):
|
|||||||
copy ..\common\$D\prntbase.obj
|
copy ..\common\$D\prntbase.obj
|
||||||
copy ..\common\$D\process.obj
|
copy ..\common\$D\process.obj
|
||||||
copy ..\common\$D\protocol.obj
|
copy ..\common\$D\protocol.obj
|
||||||
copy ..\common\$D\quantize.obj
|
|
||||||
|
|
||||||
$(COMLIBOBJS3):
|
$(COMLIBOBJS3):
|
||||||
|
copy ..\common\$D\quantize.obj
|
||||||
copy ..\common\$D\radiocmn.obj
|
copy ..\common\$D\radiocmn.obj
|
||||||
copy ..\common\$D\regex.obj
|
copy ..\common\$D\regex.obj
|
||||||
copy ..\common\$D\resource.obj
|
copy ..\common\$D\resource.obj
|
||||||
|
@ -80,9 +80,17 @@ inline bool IsMdiCommandId(int id)
|
|||||||
return (id >= wxFIRST_MDI_CHILD) && (id <= wxLAST_MDI_CHILD);
|
return (id >= wxFIRST_MDI_CHILD) && (id <= wxLAST_MDI_CHILD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// unpack the parameters of WM_MDIACTIVATE message
|
||||||
static void UnpackMDIActivate(WXWPARAM wParam, WXLPARAM lParam,
|
static void UnpackMDIActivate(WXWPARAM wParam, WXLPARAM lParam,
|
||||||
WXWORD *activate, WXHWND *hwndAct, WXHWND *hwndDeact);
|
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
|
// implementation
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
@ -27,6 +27,11 @@
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxRadioButton, wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxRadioButton, wxControl)
|
||||||
|
|
||||||
|
void wxRadioButton::Init()
|
||||||
|
{
|
||||||
|
m_bFocusJustSet = FALSE;
|
||||||
|
} // end of wxRadioButton::Init
|
||||||
|
|
||||||
void wxRadioButton::Command (
|
void wxRadioButton::Command (
|
||||||
wxCommandEvent& rEvent
|
wxCommandEvent& rEvent
|
||||||
)
|
)
|
||||||
@ -48,103 +53,81 @@ bool wxRadioButton::Create(
|
|||||||
, const wxString& rsName
|
, const wxString& rsName
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int nX = rPos.x;
|
if ( !CreateControl( pParent
|
||||||
int nY = rPos.y;
|
,vId
|
||||||
int nWidth = rSize.x;
|
,rPos
|
||||||
int nHeight = rSize.y;
|
,rSize
|
||||||
long lsStyle = 0L;
|
,lStyle
|
||||||
long lGroupStyle = 0L;
|
|
||||||
|
|
||||||
SetName(rsName);
|
|
||||||
#if wxUSE_VALIDATORS
|
#if wxUSE_VALIDATORS
|
||||||
SetValidator(rValidator);
|
,rValidator
|
||||||
#endif
|
#endif
|
||||||
|
,rsName))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if (pParent)
|
long lSstyle = HasFlag(wxRB_GROUP) ? WS_GROUP : 0;
|
||||||
pParent->AddChild(this);
|
|
||||||
|
|
||||||
SetBackgroundColour(pParent->GetBackgroundColour());
|
lSstyle |= BS_AUTORADIOBUTTON;
|
||||||
SetForegroundColour(pParent->GetForegroundColour());
|
|
||||||
|
|
||||||
if (vId == -1)
|
if (HasFlag(wxCLIP_SIBLINGS))
|
||||||
m_windowId = (int)NewControlId();
|
lSstyle |= WS_CLIPSIBLINGS;
|
||||||
else
|
|
||||||
m_windowId = vId;
|
|
||||||
|
|
||||||
|
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)
|
SetFont(*wxSMALL_FONT);
|
||||||
lGroupStyle = WS_GROUP;
|
SetSize( rPos.x
|
||||||
|
,rPos.y
|
||||||
lsStyle = lGroupStyle | BS_AUTORADIOBUTTON | WS_VISIBLE ;
|
,rSize.x
|
||||||
|
,rSize.y
|
||||||
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
|
|
||||||
);
|
);
|
||||||
return FALSE;
|
return TRUE;
|
||||||
} // end of wxRadioButton::Create
|
} // 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
|
// Get single selection, for single choice list items
|
||||||
//
|
//
|
||||||
@ -172,6 +155,22 @@ bool wxRadioButton::OS2Command(
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
} // end of wxRadioButton::OS2Command
|
} // 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(
|
void wxRadioButton::SetLabel(
|
||||||
const wxString& rsLabel
|
const wxString& rsLabel
|
||||||
)
|
)
|
||||||
|
@ -197,15 +197,15 @@ bool wxTopLevelWindowOS2::CreateDialog(
|
|||||||
}
|
}
|
||||||
|
|
||||||
HWND hWndDlg;
|
HWND hWndDlg;
|
||||||
HWND hWndParent;
|
HWND hWndOwner;
|
||||||
|
|
||||||
if (pParent)
|
if (pParent)
|
||||||
hWndParent = GetHwndOf(pParent);
|
hWndOwner = GetHwndOf(pParent);
|
||||||
else
|
else
|
||||||
hWndParent = HWND_DESKTOP;
|
hWndOwner = HWND_DESKTOP;
|
||||||
|
|
||||||
hWndDlg = ::WinLoadDlg( hWndParent
|
hWndDlg = ::WinLoadDlg( HWND_DESKTOP
|
||||||
,hWndParent
|
,hWndOwner
|
||||||
,(PFNWP)wxDlgProc
|
,(PFNWP)wxDlgProc
|
||||||
,NULL
|
,NULL
|
||||||
,(ULONG)ulDlgTemplate
|
,(ULONG)ulDlgTemplate
|
||||||
|
@ -327,7 +327,6 @@ wxWindowOS2::~wxWindowOS2()
|
|||||||
{
|
{
|
||||||
m_isBeingDeleted = TRUE;
|
m_isBeingDeleted = TRUE;
|
||||||
|
|
||||||
OS2DetachWindowMenu();
|
|
||||||
for (wxWindow* pWin = GetParent(); pWin; pWin = pWin->GetParent())
|
for (wxWindow* pWin = GetParent(); pWin; pWin = pWin->GetParent())
|
||||||
{
|
{
|
||||||
wxFrame* pFrame = wxDynamicCast(pWin, wxFrame);
|
wxFrame* pFrame = wxDynamicCast(pWin, wxFrame);
|
||||||
@ -1545,7 +1544,7 @@ void wxWindowOS2::DoMoveWindow(
|
|||||||
HWND hParent;
|
HWND hParent;
|
||||||
wxWindow* pParent = GetParent();
|
wxWindow* pParent = GetParent();
|
||||||
|
|
||||||
if (pParent)
|
if (pParent && !IsKindOf(CLASSINFO(wxDialog)))
|
||||||
{
|
{
|
||||||
int nOS2Height = GetOS2ParentHeight(pParent);
|
int nOS2Height = GetOS2ParentHeight(pParent);
|
||||||
|
|
||||||
@ -1607,7 +1606,7 @@ void wxWindowOS2::DoSetSize(
|
|||||||
int nY2 = nY;
|
int nY2 = nY;
|
||||||
wxWindow* pParent = (wxWindow*)GetParent();
|
wxWindow* pParent = (wxWindow*)GetParent();
|
||||||
|
|
||||||
if (pParent)
|
if (pParent && !IsKindOf(CLASSINFO(wxDialog)))
|
||||||
{
|
{
|
||||||
int nOS2Height = GetOS2ParentHeight(pParent);
|
int nOS2Height = GetOS2ParentHeight(pParent);
|
||||||
|
|
||||||
@ -2718,6 +2717,8 @@ MRESULT wxWindowOS2::OS2WindowProc(
|
|||||||
#endif // __WXDEBUG__
|
#endif // __WXDEBUG__
|
||||||
if (IsKindOf(CLASSINFO(wxFrame)))
|
if (IsKindOf(CLASSINFO(wxFrame)))
|
||||||
mResult = ::WinDefWindowProc(m_hWnd, uMsg, wParam, lParam);
|
mResult = ::WinDefWindowProc(m_hWnd, uMsg, wParam, lParam);
|
||||||
|
else if (IsKindOf(CLASSINFO(wxDialog)))
|
||||||
|
mResult = ::WinDefDlgProc( m_hWnd, uMsg, wParam, lParam);
|
||||||
else
|
else
|
||||||
mResult = OS2DefWindowProc(uMsg, wParam, lParam);
|
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(
|
bool wxWindowOS2::OS2GetCreateWindowCoords(
|
||||||
const wxPoint& rPos
|
const wxPoint& rPos
|
||||||
, const wxSize& rSize
|
, const wxSize& rSize
|
||||||
|
Loading…
Reference in New Issue
Block a user