more minimal stuff

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6511 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Webster
2000-03-07 21:28:30 +00:00
parent 49af73a59b
commit f23208cacc
5 changed files with 350 additions and 327 deletions

View File

@@ -92,7 +92,7 @@ HICON wxDEFAULT_MDIPARENTFRAME_ICON = (HICON) NULL;
HBRUSH wxDisableButtonBrush = (HBRUSH) 0; HBRUSH wxDisableButtonBrush = (HBRUSH) 0;
MRESULT wxWndProc( HWND MRESULT EXPENTRY wxWndProc( HWND
,ULONG ,ULONG
,MPARAM ,MPARAM
,MPARAM ,MPARAM
@@ -201,12 +201,12 @@ bool wxApp::RegisterWindowClasses(
ERRORID vError = 0L; ERRORID vError = 0L;
wxString sError; wxString sError;
if ((rc = ::WinRegisterClass( vHab if (!::WinRegisterClass( vHab
,wxFrameClassName ,wxFrameClassName
,(PFNWP)wxWndProc ,(PFNWP)wxWndProc
,CS_SIZEREDRAW | CS_SYNCPAINT | CS_FRAME ,CS_SIZEREDRAW | CS_SYNCPAINT
,0 ,0
)) != 0) ))
{ {
vError = ::WinGetLastError(vHab); vError = ::WinGetLastError(vHab);
sError = wxPMErrorToStr(vError); sError = wxPMErrorToStr(vError);
@@ -214,12 +214,12 @@ bool wxApp::RegisterWindowClasses(
return FALSE; return FALSE;
} }
if ((rc = ::WinRegisterClass( vHab if (!::WinRegisterClass( vHab
,wxFrameClassNameNoRedraw ,wxFrameClassNameNoRedraw
,(PFNWP)wxWndProc ,(PFNWP)wxWndProc
,CS_FRAME
,0 ,0
)) != 0) ,0
))
{ {
vError = ::WinGetLastError(vHab); vError = ::WinGetLastError(vHab);
sError = wxPMErrorToStr(vError); sError = wxPMErrorToStr(vError);
@@ -227,12 +227,12 @@ bool wxApp::RegisterWindowClasses(
return FALSE; return FALSE;
} }
if ((rc = ::WinRegisterClass( vHab if (!::WinRegisterClass( vHab
,wxMDIFrameClassName ,wxMDIFrameClassName
,(PFNWP)wxWndProc ,(PFNWP)wxWndProc
,CS_SIZEREDRAW | CS_SYNCPAINT | CS_FRAME ,CS_SIZEREDRAW | CS_SYNCPAINT
,0 ,0
)) != 0) ))
{ {
vError = ::WinGetLastError(vHab); vError = ::WinGetLastError(vHab);
sError = wxPMErrorToStr(vError); sError = wxPMErrorToStr(vError);
@@ -240,12 +240,12 @@ bool wxApp::RegisterWindowClasses(
return FALSE; return FALSE;
} }
if ((rc = ::WinRegisterClass( vHab if (!::WinRegisterClass( vHab
,wxMDIFrameClassNameNoRedraw ,wxMDIFrameClassNameNoRedraw
,(PFNWP)wxWndProc ,(PFNWP)wxWndProc
,CS_FRAME
,0 ,0
)) != 0) ,0
))
{ {
vError = ::WinGetLastError(vHab); vError = ::WinGetLastError(vHab);
sError = wxPMErrorToStr(vError); sError = wxPMErrorToStr(vError);
@@ -253,12 +253,12 @@ bool wxApp::RegisterWindowClasses(
return FALSE; return FALSE;
} }
if ((rc = ::WinRegisterClass( vHab if (!::WinRegisterClass( vHab
,wxMDIChildFrameClassName ,wxMDIChildFrameClassName
,(PFNWP)wxWndProc ,(PFNWP)wxWndProc
,CS_MOVENOTIFY | CS_SIZEREDRAW | CS_SYNCPAINT | CS_HITTEST | CS_FRAME ,CS_MOVENOTIFY | CS_SIZEREDRAW | CS_SYNCPAINT | CS_HITTEST
,0 ,0
)) != 0) ))
{ {
vError = ::WinGetLastError(vHab); vError = ::WinGetLastError(vHab);
sError = wxPMErrorToStr(vError); sError = wxPMErrorToStr(vError);
@@ -266,12 +266,12 @@ bool wxApp::RegisterWindowClasses(
return FALSE; return FALSE;
} }
if ((rc = ::WinRegisterClass( vHab if (!::WinRegisterClass( vHab
,wxMDIChildFrameClassNameNoRedraw ,wxMDIChildFrameClassNameNoRedraw
,(PFNWP)wxWndProc ,(PFNWP)wxWndProc
,CS_HITTEST | CS_FRAME ,CS_HITTEST
,0 ,0
)) != 0) ))
{ {
vError = ::WinGetLastError(vHab); vError = ::WinGetLastError(vHab);
sError = wxPMErrorToStr(vError); sError = wxPMErrorToStr(vError);
@@ -279,12 +279,12 @@ bool wxApp::RegisterWindowClasses(
return FALSE; return FALSE;
} }
if ((rc = ::WinRegisterClass( vHab if (!::WinRegisterClass( vHab
,wxPanelClassName ,wxPanelClassName
,(PFNWP)wxWndProc ,(PFNWP)wxWndProc
,CS_MOVENOTIFY | CS_SIZEREDRAW | CS_HITTEST | CS_SAVEBITS | CS_SYNCPAINT ,CS_MOVENOTIFY | CS_SIZEREDRAW | CS_HITTEST | CS_SAVEBITS | CS_SYNCPAINT
,0 ,0
)) != 0) ))
{ {
vError = ::WinGetLastError(vHab); vError = ::WinGetLastError(vHab);
sError = wxPMErrorToStr(vError); sError = wxPMErrorToStr(vError);
@@ -292,12 +292,12 @@ bool wxApp::RegisterWindowClasses(
return FALSE; return FALSE;
} }
if ((rc = ::WinRegisterClass( vHab if (!::WinRegisterClass( vHab
,wxCanvasClassName ,wxCanvasClassName
,(PFNWP)wxWndProc ,(PFNWP)wxWndProc
,CS_MOVENOTIFY | CS_SIZEREDRAW | CS_HITTEST | CS_SAVEBITS | CS_SYNCPAINT ,CS_MOVENOTIFY | CS_SIZEREDRAW | CS_HITTEST | CS_SAVEBITS | CS_SYNCPAINT
,0 ,0
)) != 0) ))
{ {
vError = ::WinGetLastError(vHab); vError = ::WinGetLastError(vHab);
sError = wxPMErrorToStr(vError); sError = wxPMErrorToStr(vError);
@@ -506,7 +506,7 @@ bool wxApp::OnInitGui()
ERRORID vError; ERRORID vError;
wxString sError; wxString sError;
m_hMq = WinCreateMsgQueue(vHabmain, 0); m_hMq = ::WinCreateMsgQueue(vHabmain, 0);
if (!m_hMq) if (!m_hMq)
{ {
vError = ::WinGetLastError(vHabmain); vError = ::WinGetLastError(vHabmain);

View File

@@ -125,12 +125,6 @@ bool wxFrame::Create(
m_bIconized = FALSE; m_bIconized = FALSE;
//
// We pass NULL as parent to MSWCreate because frames with parents behave
// very strangely under Win95 shell.
// Alteration by JACS: keep normal Windows behaviour (float on top of parent)
// with this ulStyle.
//
if ((m_windowStyle & wxFRAME_FLOAT_ON_PARENT) == 0) if ((m_windowStyle & wxFRAME_FLOAT_ON_PARENT) == 0)
pParent = NULL; pParent = NULL;
@@ -446,11 +440,16 @@ void wxFrame::SetIcon(
if (m_icon.Ok()) if (m_icon.Ok())
{ {
WinSendMsg( GetHwnd() ::WinSendMsg( GetHwnd()
,WM_SETICON ,WM_SETICON
,(MPARAM)((HICON)m_icon.GetHICON()) ,(MPARAM)((HICON)m_icon.GetHICON())
,NULL ,NULL
); );
::WinSendMsg( GetHwnd()
,WM_UPDATEFRAME
,(MPARAM)FCF_ICON
,(MPARAM)0
);
} }
} // end of wxFrame::SetIcon } // end of wxFrame::SetIcon
@@ -555,12 +554,7 @@ void wxFrame::SetMenuBar(
void wxFrame::InternalSetMenuBar() void wxFrame::InternalSetMenuBar()
{ {
WinSendMsg((HWND)GetHwnd(), WM_UPDATEFRAME, (MPARAM)FCF_MENU, (MPARAM)0);
::WinPostMsg( GetHwnd()
,WM_UPDATEFRAME
,(MPARAM)FCF_MENU
,NULL
);
} // end of wxFrame::InternalSetMenuBar } // end of wxFrame::InternalSetMenuBar
// //
@@ -727,83 +721,166 @@ bool wxFrame::OS2Create(
, long ulStyle , long ulStyle
) )
{ {
ULONG ulPmFlags = 0L; ULONG ulCreateFlags = 0L;
ULONG ulStyleFlags = 0L;
ULONG ulExtraFlags = 0L; ULONG ulExtraFlags = 0L;
ULONG ulTempFlags = FCF_STANDARD; FRAMECDATA vFrameCtlData;
HWND hParent = NULLHANDLE;
HWND hClient = NULLHANDLE;
HWND hTitlebar = NULLHANDLE;
HWND hHScroll = NULLHANDLE;
HWND hVScroll = NULLHANDLE;
SWP vSwp;
SWP vSwpTitlebar;
SWP vSwpVScroll;
SWP vSwpHScroll;
m_hDefaultIcon = (WXHICON) (wxSTD_FRAME_ICON ? wxSTD_FRAME_ICON : wxDEFAULT_FRAME_ICON); m_hDefaultIcon = (WXHICON) (wxSTD_FRAME_ICON ? wxSTD_FRAME_ICON : wxDEFAULT_FRAME_ICON);
memset(&vSwp, '\0', sizeof(SWP));
memset(&vSwpTitlebar, '\0', sizeof(SWP));
memset(&vSwpVScroll, '\0', sizeof(SWP));
memset(&vSwpHScroll, '\0', sizeof(SWP));
if (pParent)
hParent = GetWinHwnd(pParent);
else
hParent = HWND_DESKTOP;
if (ulStyle == wxDEFAULT_FRAME_STYLE) if (ulStyle == wxDEFAULT_FRAME_STYLE)
ulPmFlags = FCF_STANDARD; ulCreateFlags = FCF_SIZEBORDER | FCF_TITLEBAR | FCF_SYSMENU |
FCF_MINMAX | FCF_VERTSCROLL | FCF_HORZSCROLL | FCF_TASKLIST;
else else
{ {
if ((ulStyle & wxCAPTION) == wxCAPTION) if ((ulStyle & wxCAPTION) == wxCAPTION)
ulPmFlags = FCF_TASKLIST; ulCreateFlags = FCF_TASKLIST;
else else
ulPmFlags = FCF_NOMOVEWITHOWNER; ulCreateFlags = FCF_NOMOVEWITHOWNER;
if (ulStyle & wxMINIMIZE_BOX) if (ulStyle & wxMINIMIZE_BOX)
ulPmFlags |= FCF_MINBUTTON; ulCreateFlags |= FCF_MINBUTTON;
if (ulStyle & wxMAXIMIZE_BOX) if (ulStyle & wxMAXIMIZE_BOX)
ulPmFlags |= FCF_MAXBUTTON; ulCreateFlags |= FCF_MAXBUTTON;
if (ulStyle & wxTHICK_FRAME) if (ulStyle & wxTHICK_FRAME)
ulPmFlags |= FCF_DLGBORDER; ulCreateFlags |= FCF_DLGBORDER;
if (ulStyle & wxSYSTEM_MENU) if (ulStyle & wxSYSTEM_MENU)
ulPmFlags |= FCF_SYSMENU; ulCreateFlags |= FCF_SYSMENU;
if ((ulStyle & wxMINIMIZE) || (ulStyle & wxICONIZE))
ulPmFlags |= WS_MINIMIZED;
if (ulStyle & wxMAXIMIZE)
ulPmFlags |= WS_MAXIMIZED;
if (ulStyle & wxCAPTION) if (ulStyle & wxCAPTION)
ulPmFlags |= FCF_TASKLIST; ulCreateFlags |= FCF_TASKLIST;
if (ulStyle & wxCLIP_CHILDREN) if (ulStyle & wxCLIP_CHILDREN)
{ {
// Invalid for frame windows under PM // Invalid for frame windows under PM
} }
//
// Keep this in wxFrame because it saves recoding this function
// in wxTinyFrame
//
#if wxUSE_ITSY_BITSY
if (ulStyle & wxTINY_CAPTION_VERT) if (ulStyle & wxTINY_CAPTION_VERT)
ulExtraFlags |= kVertCaption; ulCreateFlags |= FCF_TASKLIST;
if (ulStyle & wxTINY_CAPTION_HORIZ) if (ulStyle & wxTINY_CAPTION_HORIZ)
ulExtraFlags |= kHorzCaption; ulCreateFlags |= FCF_TASKLIST;
#else
if (ulStyle & wxTINY_CAPTION_VERT)
ulPmFlags |= FCF_TASKLIST;
if (ulStyle & wxTINY_CAPTION_HORIZ)
ulPmFlags |= FCF_TASKLIST;
#endif
if ((ulStyle & wxTHICK_FRAME) == 0) if ((ulStyle & wxTHICK_FRAME) == 0)
ulPmFlags |= FCF_BORDER; ulCreateFlags |= FCF_BORDER;
if (ulStyle & wxFRAME_TOOL_WINDOW) if (ulStyle & wxFRAME_TOOL_WINDOW)
ulExtraFlags = kFrameToolWindow; ulExtraFlags = kFrameToolWindow;
if (ulStyle & wxSTAY_ON_TOP) if (ulStyle & wxSTAY_ON_TOP)
ulPmFlags |= FCF_SYSMODAL; ulCreateFlags |= FCF_SYSMODAL;
} }
if ((ulStyle & wxMINIMIZE) || (ulStyle & wxICONIZE))
ulStyleFlags |= WS_MINIMIZED;
if (ulStyle & wxMAXIMIZE)
ulStyleFlags |= WS_MAXIMIZED;
// //
// Clear the visible flag, we always call show // Clear the visible flag, we always call show
// //
ulPmFlags &= (unsigned long)~WS_VISIBLE; ulStyleFlags &= (unsigned long)~WS_VISIBLE;
m_bIconized = FALSE; m_bIconized = FALSE;
if ( !wxWindow::OS2Create( nId
,pParent //
,zWclass // Set the frame control block
,pWxWin //
vFrameCtlData.cb = sizeof(vFrameCtlData);
vFrameCtlData.flCreateFlags = ulCreateFlags;
vFrameCtlData.hmodResources = 0L;
vFrameCtlData.idResources = 0;
//
// Create the frame window
//
if (!wxWindow::OS2Create( hParent
,WC_FRAME
,zTitle ,zTitle
,ulStyleFlags
,(long)nX
,(long)nY
,(long)nWidth
,(long)nHeight
,NULLHANDLE
,HWND_TOP
,(long)nId
,(void*)&vFrameCtlData
,NULL
))
{
return FALSE;
}
//
// Create the client window. We must call the API from here rather than
// the static base class create because we need a separate handle
//
if ((hClient = ::WinCreateWindow( GetHwnd() // Frame is parent
,zWclass // Custom client class
,NULL // Window title
,0 // No styles
,0, 0, 0, 0 // Window position
,NULLHANDLE // Owner
,HWND_TOP // Sibling
,FID_CLIENT // standard client ID
,NULL // Creation data
,NULL // Window Pres Params
)) == 0L)
{
return FALSE;
}
//
// Now size everything. If adding a menu the client will need to be resized.
//
if (!::WinSetWindowPos( GetHwnd()
,HWND_TOP
,nX ,nX
,nY ,nY
,nWidth ,nWidth
,nHeight ,nHeight
,ulPmFlags ,SWP_SIZE | SWP_MOVE | SWP_ACTIVATE
,NULL ))
,ulExtraFlags))
{
return FALSE; return FALSE;
WinQueryWindowPos(GetHwnd(), &vSwp);
if (ulCreateFlags & FCF_TITLEBAR)
{
hTitlebar = WinWindowFromID(GetHwnd(), FID_TITLEBAR);
WinQueryWindowPos(hTitlebar, &vSwpTitlebar);
} }
if (ulCreateFlags & FCF_HORZSCROLL)
{
hHScroll = WinWindowFromID(GetHwnd(), FID_HORZSCROLL);
WinQueryWindowPos(hHScroll, &vSwpHScroll);
}
if (ulCreateFlags & FCF_VERTSCROLL)
{
hVScroll = WinWindowFromID(GetHwnd(), FID_VERTSCROLL);
WinQueryWindowPos(hVScroll, &vSwpVScroll);
}
if (!::WinSetWindowPos( hClient
,HWND_TOP
,SV_CXSIZEBORDER
,(SV_CYSIZEBORDER - 1) + vSwpHScroll.cy
,vSwp.cx - ((SV_CXSIZEBORDER * 2) + vSwpVScroll.cx)
,vSwp.cy - ((SV_CYSIZEBORDER * 2) + 1 + vSwpTitlebar.cy + vSwpHScroll.cy)
,SWP_SIZE | SWP_MOVE
))
return FALSE;
return TRUE; return TRUE;
} // end of wxFrame::OS2Create } // end of wxFrame::OS2Create

View File

@@ -945,16 +945,16 @@ $(WXDIR)\lib\wx.lib: \
!else !else
# Update the import library # Update the import library
$(WXDIR)\lib\wx210.lib: $(OBJECTS) $(WXDIR)\lib\wx214.lib: $(OBJECTS)
implib $(WXDIR)\lib\wx210.lib $(WXDIR)\lib\wx210.def implib $(WXDIR)\lib\wx214.lib $(WXDIR)\lib\wx214.def
# Update the dynamic link library # Update the dynamic link library
$(WXDIR)\lib\wx200.dll: $(OBJECTS) $(WXDIR)\lib\wx210.lib $(WXDIR)\lib\wx214.dll: $(OBJECTS) $(WXDIR)\lib\wx214.lib
icc @<< icc @<<
/B" $(LINKFLAGS)" /Fe$@ /B" $(LINKFLAGS)" /Fe$@
$(LIBS) $(LIBS)
$(OBJECTS) $(OBJECTS)
$(WXDIR)\lib\wx210.def $(WXDIR)\lib\wx214.def
<< <<
!endif !endif
@@ -1040,7 +1040,7 @@ clean_tiff:
clean: $(PERIPH_CLEAN_TARGET) clean_png clean_zlib clean_jpeg clean_xpm clean_tiff clean: $(PERIPH_CLEAN_TARGET) clean_png clean_zlib clean_jpeg clean_xpm clean_tiff
del $(LIBTARGET) del $(LIBTARGET)
!if "$(WXMAKINGDLL)" == "1" !if "$(WXMAKINGDLL)" == "1"
erase /N ..\..\lib\wx200.lib erase /N ..\..\lib\wx214.lib
!endif !endif
erase /N $(GENDIR)\$D\*.obj erase /N $(GENDIR)\$D\*.obj
erase /N $(COMMDIR)\$D\*.obj erase /N $(COMMDIR)\$D\*.obj

View File

@@ -71,20 +71,22 @@ void wxMenu::Init()
m_bDoBreak = FALSE; m_bDoBreak = FALSE;
// //
// Create the menu // Create the menu (to be used as a submenu or a popup)
// //
m_hMenu = ::WinCreateWindow( HWND_DESKTOP // parent if ((m_hMenu = ::WinCreateWindow( HWND_DESKTOP
,WC_MENU // type ,(const wxChar*)WC_MENU
,"Menu" // a generic name ,"Menu"
,0L // no style flag ,0L
,0L,0L,0L,0L // no position ,0L
,NULLHANDLE // no owner ,0L
,NULLHANDLE // no insertion position ,0L
,0L // no ID needed for dynamic creation ,0L
,NULL // no control data ,NULLHANDLE
,NULL // no presentation params ,HWND_TOP
); ,0L
if (!m_hMenu) ,NULL
,NULL
)) != 0)
{ {
wxLogLastError("WinLoadMenu"); wxLogLastError("WinLoadMenu");
} }
@@ -92,7 +94,7 @@ void wxMenu::Init()
// //
// If we have a title, insert it in the beginning of the menu // If we have a title, insert it in the beginning of the menu
// //
if (!!m_title) if (!m_title.IsEmpty())
{ {
Append( idMenuTitle Append( idMenuTitle
,m_title ,m_title
@@ -230,13 +232,13 @@ bool wxMenu::DoInsertOrAppend(
// //
wxMenu* pSubmenu = pItem->GetSubMenu(); wxMenu* pSubmenu = pItem->GetSubMenu();
MENUITEM vItem;
if (pSubmenu != NULL) if (pSubmenu != NULL)
{ {
wxASSERT_MSG(pSubmenu->GetHMenu(), wxT("invalid submenu")); wxASSERT_MSG(pSubmenu->GetHMenu(), wxT("invalid submenu"));
pSubmenu->SetParent(this); pSubmenu->SetParent(this);
m_vMenuData.iPosition = 0; // submenus have a 0 position
m_vMenuData.id = (USHORT)pSubmenu->GetHMenu(); m_vMenuData.id = (USHORT)pSubmenu->GetHMenu();
m_vMenuData.afStyle |= MIS_SUBMENU; m_vMenuData.afStyle |= MIS_SUBMENU;
} }
@@ -253,6 +255,7 @@ bool wxMenu::DoInsertOrAppend(
// //
// Want to get {Measure|Draw}Item messages? // Want to get {Measure|Draw}Item messages?
// item draws itself, pass pointer to it in data parameter // item draws itself, pass pointer to it in data parameter
// Will eventually need to set the image handle somewhere into m_vMenuData.hItem
// //
m_vMenuData.afStyle |= MIS_OWNERDRAW; m_vMenuData.afStyle |= MIS_OWNERDRAW;
pData = (BYTE*)pItem; pData = (BYTE*)pItem;
@@ -270,17 +273,18 @@ bool wxMenu::DoInsertOrAppend(
BOOL bOk; BOOL bOk;
// //
// -1 means this is a sub menu not a menuitem // -1 means this is a sub menu not a menuitem. We must create a window for it.
// Submenus are also attached to a menubar so its parent and owner should be the handle of the menubar.
// //
if (nPos == (size_t)-1) if (nPos == (size_t)-1)
{ {
HWND hSubMenu = ::WinCreateWindow( HWND_DESKTOP // parent HWND hSubMenu = ::WinCreateWindow( GetWinHwnd(m_menuBar) // parent
,WC_MENU // type ,WC_MENU // type
,"Menu" // a generic name ,"Menu" // a generic name
,0L // no style flag ,0L // no style flag
,0L,0L,0L,0L // no position ,0L,0L,0L,0L // no position
,NULLHANDLE // no owner ,GetWinHwnd(m_menuBar) // no owner
,NULLHANDLE // no insertion position ,HWND_TOP // always on top
,0L // no ID needed for dynamic creation ,0L // no ID needed for dynamic creation
,NULL // no control data ,NULL // no control data
,NULL // no presentation params ,NULL // no presentation params
@@ -290,14 +294,14 @@ bool wxMenu::DoInsertOrAppend(
m_vMenuData.hwndSubMenu = hSubMenu; m_vMenuData.hwndSubMenu = hSubMenu;
m_vMenuData.hItem = NULLHANDLE; m_vMenuData.hItem = NULLHANDLE;
bOk = (bool)::WinSendMsg(GetHmenu(), MM_INSERTITEM, (MPARAM)&vItem, (MPARAM)NULL); bOk = (bool)::WinSendMsg(GetHmenu(), MM_INSERTITEM, (MPARAM)&m_vMenuData, (MPARAM)pItem->GetText().c_str());
} }
else else
{ {
m_vMenuData.iPosition = nPos; m_vMenuData.iPosition = nPos;
m_vMenuData.hwndSubMenu = NULLHANDLE; m_vMenuData.hwndSubMenu = NULLHANDLE;
m_vMenuData.hItem = NULLHANDLE; m_vMenuData.hItem = NULLHANDLE;
bOk = (bool)::WinSendMsg(GetHmenu(), MM_INSERTITEM, (MPARAM)&vItem, (MPARAM)pData); bOk = (bool)::WinSendMsg(GetHmenu(), MM_INSERTITEM, (MPARAM)&m_vMenuData, (MPARAM)pItem->GetText().c_str());
} }
if (!bOk) if (!bOk)
@@ -609,33 +613,43 @@ void wxMenuBar::Refresh()
{ {
wxCHECK_RET( IsAttached(), wxT("can't refresh unatteched menubar") ); wxCHECK_RET( IsAttached(), wxT("can't refresh unatteched menubar") );
// DrawMenuBar(GetHwndOf(m_menuBarFrame)); WinSendMsg(GetWinHwnd(m_pMenuBarFrame), WM_UPDATEFRAME, (MPARAM)FCF_MENU, (MPARAM)0);
} } // end of wxMenuBar::Refresh
WXHMENU wxMenuBar::Create() WXHMENU wxMenuBar::Create()
{ {
MENUITEM vItem; MENUITEM vItem;
HWND hFrame;
if (m_hMenu != 0 ) if (m_hMenu != 0 )
return m_hMenu; return m_hMenu;
wxCHECK_MSG(!m_hMenu, TRUE, wxT("menubar already created")); wxCHECK_MSG(!m_hMenu, TRUE, wxT("menubar already created"));
//
// Menubars should be associated with a frame otherwise they are popups
//
if (m_pMenuBarFrame != NULL)
hFrame = GetWinHwnd(m_pMenuBarFrame);
else
hFrame = HWND_DESKTOP;
// //
// Create an empty menu and then fill it with insertions // Create an empty menu and then fill it with insertions
// //
m_hMenu = ::WinCreateWindow( HWND_DESKTOP // parent if (!wxWindow::OS2Create( hFrame
,WC_MENU // type ,WC_MENU
,"Menu" // a generic name ,"Menu"
,0L // no style flag ,MS_ACTIONBAR | WS_SYNCPAINT | WS_VISIBLE
,0L,0L,0L,0L // no position ,0L
,NULLHANDLE // no owner ,0L
,NULLHANDLE // no insertion position ,0L
,0L // no ID needed for dynamic creation ,0L
,NULL // no control data ,hFrame
,NULL // no presentation params ,HWND_TOP
); ,FID_MENU
if (!m_hMenu) ,(PVOID)NULL
,(PVOID)NULL
))
{ {
wxLogLastError("CreateMenu"); wxLogLastError("CreateMenu");
} }

View File

@@ -111,7 +111,7 @@ wxList* wxWinHandleList = NULL;
// //
// the window proc for all our windows; most gui's have something similar // the window proc for all our windows; most gui's have something similar
// //
MRESULT wxWndProc( HWND hWnd MRESULT EXPENTRY wxWndProc( HWND hWnd
,ULONG message ,ULONG message
,MPARAM mp1 ,MPARAM mp1
,MPARAM mp2 ,MPARAM mp2
@@ -326,6 +326,8 @@ bool wxWindow::Create(
, const wxString& rName , const wxString& rName
) )
{ {
HWND hParent = NULLHANDLE;
wxCHECK_MSG(pParent, FALSE, wxT("can't create wxWindow without parent")); wxCHECK_MSG(pParent, FALSE, wxT("can't create wxWindow without parent"));
if ( !CreateBase( pParent if ( !CreateBase( pParent
@@ -338,53 +340,47 @@ bool wxWindow::Create(
)) ))
return(FALSE); return(FALSE);
if (pParent)
{
pParent->AddChild(this); pParent->AddChild(this);
hParent = GetWinHwnd(pParent);
}
else
hParent = HWND_DESKTOP;
ULONG ulCreateFlags = 0L;
ULONG ulFlags = 0L;
// //
// Frame windows and their derivatives only // Most wxSTYLES are really PM Class specific styles and will be
// set in those class create procs. PM's basic windows styles are
// very limited.
// //
if (lStyle & wxBORDER)
ulFlags |= FCF_BORDER;
if (lStyle & wxTHICK_FRAME )
ulFlags |= FCF_SIZEBORDER;
//
// Some generic window styles
//
ulFlags |= WS_VISIBLE;
if (lStyle & wxCLIP_CHILDREN ) if (lStyle & wxCLIP_CHILDREN )
ulFlags |= WS_CLIPCHILDREN; ulCreateFlags |= WS_CLIPCHILDREN;
//
// Empty stuff for now since PM has no custome 3D effects
// Doesn't mean someone cannot make some up though
//
bool bWant3D; bool bWant3D;
WXDWORD dwExStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &bWant3D); WXDWORD dwExStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &bWant3D);
// //
// OS/2 PM doesn't have "extended" styles but if the library specifies // Generic OS/2 Windows are created with no owner, no Z Order, no Control data,
// them and we are creating a frame window then at least give it a border // and no presentation parameters
// //
if ( bWant3D || OS2Create( hParent
(m_windowStyle & wxSIMPLE_BORDER) || ,(PSZ)wxCanvasClassName
(m_windowStyle & wxRAISED_BORDER ) || ,rName.c_str()
(m_windowStyle & wxSUNKEN_BORDER) || ,ulCreateFlags
(m_windowStyle & wxDOUBLE_BORDER)
)
{
ulFlags |= FCF_BORDER;
}
OS2Create( m_windowId
,pParent
,wxCanvasClassName
,this
,NULL
,rPos.x ,rPos.x
,rPos.y ,rPos.y
,WidthDefault(rSize.x) ,WidthDefault(rSize.x)
,HeightDefault(rSize.y) ,HeightDefault(rSize.y)
,ulFlags ,NULLHANDLE
,NULL ,NULLHANDLE
,dwExStyle ,m_windowId
); );
return(TRUE); return(TRUE);
} // end of wxWindow::Create } // end of wxWindow::Create
@@ -1773,7 +1769,7 @@ wxWindow* wxWndHook = NULL;
// //
// Main window proc // Main window proc
// //
MRESULT wxWndProc( MRESULT EXPENTRY wxWndProc(
HWND hWnd HWND hWnd
, ULONG ulMsg , ULONG ulMsg
, MPARAM wParam , MPARAM wParam
@@ -2313,26 +2309,28 @@ void wxWindow::OS2DetachWindowMenu()
} // end of wxWindow::OS2DetachWindowMenu } // end of wxWindow::OS2DetachWindowMenu
bool wxWindow::OS2Create( bool wxWindow::OS2Create(
int vId WXHWND hParent
, wxWindow* pParent , PSZ zClass
, const wxChar* zWclass
, wxWindow* pWxWin
, const wxChar* zTitle , const wxChar* zTitle
, int nX
, int nY
, int nWidth
, int nHeight
, WXDWORD dwStyle , WXDWORD dwStyle
, const wxChar* zDialogTemplate , long lX
, WXDWORD dwExtendedStyle // Port compatability only , long lY
, long lWidth
, long lHeight
, WXHWND hOwner
, WXHWND hZOrder
, unsigned long ulId
, void* pCtlData
, void* pPresParams
) )
{ {
ERRORID vError; ERRORID vError;
wxString sError; wxString sError;
int nX1 = CW_USEDEFAULT; long lX1 = (long)CW_USEDEFAULT;
int nY1 = 0; long lY1 = 0L;
int nWidth1 = CW_USEDEFAULT; long lWidth1 = (long)CW_USEDEFAULT;
int nHeight1 = 100; long lHeight1 = 100L;
int nControlId = 0;
// //
// Find parent's size, if it exists, to set up a possible default // Find parent's size, if it exists, to set up a possible default
@@ -2341,127 +2339,61 @@ bool wxWindow::OS2Create(
RECTL vParentRect; RECTL vParentRect;
HWND hWndClient; HWND hWndClient;
HWND hParent = (HWND)NULL; if (lX > -1L)
lX1 = lX;
if (pParent) if (lY > -1L)
{ lY1 = lY;
hParent = (HWND)pParent->GetHWND(); if (lWidth > -1L)
hWndClient = ::WinWindowFromID(hParent, FID_CLIENT); lWidth1 = lWidth;
::WinQueryWindowRect(hWndClient, &vParentRect); if (lHeight > -1L)
lHeight1 = lHeight;
nWidth1 = vParentRect.xRight - vParentRect.xLeft;
nHeight1 = vParentRect.yTop - vParentRect.yBottom;
}
else
hParent = HWND_DESKTOP;
if (nX > -1)
nX1 = nX;
if (nY > -1)
nY1 = nY;
if (nWidth > -1)
nWidth1 = nWidth;
if (nHeight > -1)
nHeight1 = nHeight;
wxWndHook = this; wxWndHook = this;
if (zDialogTemplate)
{
//
// We can use extended styles for custom default user config params
// These can be processed in the dialog proc's WM_INITDLG
// Dialog template is defined by vId and should be loaded from the
// resource file in the current .exe
//
PDLGTEMPLATE pDlgt;
::DosGetResource(0L, RT_DIALOG, vId, (PPVOID)&pDlgt);
m_hWnd = (WXHWND)::WinCreateDlg( hParent
,NULLHANDLE
,(PFNWP)wxDlgProc
,pDlgt
,(PVOID)&dwExtendedStyle
);
if (m_hWnd == 0)
{
vError = ::WinGetLastError(vHabmain);
sError = wxPMErrorToStr(vError);
wxLogError("Can't find dummy dialog template!\n"
"Check resource include path for finding wx.rc.\n"
"Error: %s\n", sError);
return FALSE;
}
//
// Move the dialog to its initial position without forcing repainting
//
if (!::WinSetWindowPos( m_hWnd
,HWND_TOP
,nX1
,nY1
,nWidth1
,nHeight1
,SWP_MOVE | SWP_SIZE | SWP_NOREDRAW
));
{
vError = ::WinGetLastError(vHabmain);
sError = wxPMErrorToStr(vError);
wxLogError("MoveWindow, error: %s\n", sError);
}
}
else
{
int nControlId = 0;
WXDWORD dwClass = dwStyle | 0xffff0000;
// //
// check to see if the new window is a standard control // check to see if the new window is a standard control
// //
if (dwClass & (ULONG)WC_BUTTON || if ((ULONG)zClass == (ULONG)WC_BUTTON ||
dwClass & (ULONG)WC_COMBOBOX || (ULONG)zClass == (ULONG)WC_COMBOBOX ||
dwClass & (ULONG)WC_CONTAINER || (ULONG)zClass == (ULONG)WC_CONTAINER ||
dwClass & (ULONG)WC_ENTRYFIELD || (ULONG)zClass == (ULONG)WC_ENTRYFIELD ||
dwClass & (ULONG)WC_LISTBOX || (ULONG)zClass == (ULONG)WC_LISTBOX ||
dwClass & (ULONG)WC_MENU || (ULONG)zClass == (ULONG)WC_MENU ||
dwClass & (ULONG)WC_NOTEBOOK || (ULONG)zClass == (ULONG)WC_NOTEBOOK ||
dwClass & (ULONG)WC_SCROLLBAR || (ULONG)zClass == (ULONG)WC_SCROLLBAR ||
dwClass & (ULONG)WC_SPINBUTTON || (ULONG)zClass == (ULONG)WC_SPINBUTTON ||
dwClass & (ULONG)WC_STATIC || (ULONG)zClass == (ULONG)WC_STATIC ||
dwClass & (ULONG)WC_TITLEBAR || (ULONG)zClass == (ULONG)WC_TITLEBAR ||
dwClass & (ULONG)WC_VALUESET (ULONG)zClass == (ULONG)WC_VALUESET
) )
nControlId = vId;
wxString sClassName(zWclass);
if (GetWindowStyleFlag() & wxNO_FULL_REPAINT_ON_RESIZE )
{ {
sClassName += wxT("NR"); nControlId = ulId;
} }
m_hWnd = (WXHWND)::WinCreateWindow( hParent //
,(PSZ)sClassName.c_str() // We will either have a registered class via string name or a standard PM Class via a long
,zTitle ? zTitle : wxT("") //
,dwStyle m_hWnd = (WXHWND)::WinCreateWindow( (HWND)hParent
,nX1 ,zClass
,nY1 ,(PSZ)zTitle ? zTitle : wxT("")
,nWidth ,(ULONG)dwStyle
,nHeight ,(LONG)lX1
,(LONG)lY1
,(LONG)lWidth
,(LONG)lHeight
,NULLHANDLE ,NULLHANDLE
,HWND_TOP ,HWND_TOP
,vId ,(ULONG)ulId
,NULL ,pCtlData
,NULL ,pPresParams
); );
if (!m_hWnd) if (!m_hWnd)
{ {
vError = ::WinGetLastError(vHabmain); vError = ::WinGetLastError(vHabmain);
sError = wxPMErrorToStr(vError); sError = wxPMErrorToStr(vError);
wxLogError("Can't create window of class %s!. Error: %s\n", zWclass, sError); wxLogError("Can't create window of class %s!. Error: %s\n", zClass, sError);
return FALSE; return FALSE;
} }
}
wxWndHook = NULL; wxWndHook = NULL;
#ifdef __WXDEBUG__ #ifdef __WXDEBUG__