zClass = WC_COMBOBOX;
else if ((strcmp(zClassname, "STATIC")) == 0)
zClass = WC_STATIC;
+ else if ((strcmp(zClassname, "BUTTON")) == 0)
+ zClass = WC_BUTTON;
dwStyle |= WS_VISIBLE;
//
..\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 \
imagbmp.obj \
image.obj \
imaggif.obj \
+ imagiff.obj \
imagjpeg.obj \
imagpcx.obj \
imagpng.obj \
popupcmn.obj \
prntbase.obj \
process.obj \
- protocol.obj \
- quantize.obj
+ protocol.obj
COMLIBOBJS3 = \
+ quantize.obj \
radiocmn.obj \
regex.obj \
resource.obj \
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
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
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
// ===========================================================================
IMPLEMENT_DYNAMIC_CLASS(wxRadioButton, wxControl)
+void wxRadioButton::Init()
+{
+ m_bFocusJustSet = FALSE;
+} // end of wxRadioButton::Init
+
void wxRadioButton::Command (
wxCommandEvent& rEvent
)
, 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;
+ if (HasFlag(wxRB_GROUP))
+ SetValue(TRUE);
- m_windowStyle = lStyle ;
+ SetFont(*wxSMALL_FONT);
+ SetSize( rPos.x
+ ,rPos.y
+ ,rSize.x
+ ,rSize.y
+ );
+ return TRUE;
+} // end of wxRadioButton::Create
- if (m_windowStyle & wxRB_GROUP)
- lGroupStyle = WS_GROUP;
+wxSize wxRadioButton::DoGetBestSize() const
+{
+ static int snRadioSize = 0;
- lsStyle = lGroupStyle | BS_AUTORADIOBUTTON | WS_VISIBLE ;
+ if (!snRadioSize)
+ {
+ wxScreenDC vDC;
- 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(""))
+ vDC.SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
+ snRadioSize = vDC.GetCharHeight();
+ }
+
+ wxString sStr = GetLabel();
+ int nRadioWidth;
+ int nRadioHeight;
+
+ if (!sStr.empty())
{
- int nLabelWidth;
- int nLabelHeight;
-
- GetTextExtent( rsLabel
- ,&nLabelWidth
- ,&nLabelHeight
- ,NULL
- ,NULL
- ,&this->GetFont()
+ GetTextExtent( sStr
+ ,&nRadioWidth
+ ,&nRadioHeight
);
- if (nWidth < 0)
- nWidth = (int)(nLabelWidth + RADIO_SIZE);
- if (nHeight<0)
- {
- nHeight = (int)(nLabelHeight);
- if (nHeight < RADIO_SIZE)
- nHeight = RADIO_SIZE;
- }
+ nRadioWidth += snRadioSize + GetCharWidth();
+ if (nRadioHeight < snRadioSize)
+ nRadioHeight = snRadioSize;
}
else
{
- if (nWidth < 0)
- nWidth = RADIO_SIZE;
- if (nHeight < 0)
- nHeight = RADIO_SIZE;
+ nRadioWidth = snRadioSize;
+ nRadioHeight = snRadioSize;
}
-
- //
- // Subclass again for purposes of dialog editing mode
- //
- SubclassWin((WXHWND)m_hWnd);
- SetFont(pParent->GetFont());
- SetSize( nX
- ,nY
- ,nWidth
- ,nHeight
- );
- return FALSE;
-} // end of wxRadioButton::Create
+ return wxSize( nRadioWidth
+ ,nRadioHeight
+ );
+} // end of wxRadioButton::DoGetBestSize
//
// Get single selection, for single choice list items
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
)
}
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
{
m_isBeingDeleted = TRUE;
- OS2DetachWindowMenu();
for (wxWindow* pWin = GetParent(); pWin; pWin = pWin->GetParent())
{
wxFrame* pFrame = wxDynamicCast(pWin, wxFrame);
HWND hParent;
wxWindow* pParent = GetParent();
- if (pParent)
+ if (pParent && !IsKindOf(CLASSINFO(wxDialog)))
{
int nOS2Height = GetOS2ParentHeight(pParent);
int nY2 = nY;
wxWindow* pParent = (wxWindow*)GetParent();
- if (pParent)
+ if (pParent && !IsKindOf(CLASSINFO(wxDialog)))
{
int nOS2Height = GetOS2ParentHeight(pParent);
#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);
}
{
}
-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