no message

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6643 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Webster 2000-03-13 05:43:53 +00:00
parent 6e395e9c60
commit a06066343d
6 changed files with 373 additions and 187 deletions

View File

@ -18,72 +18,104 @@
class WXDLLEXPORT wxColour: public wxObject class WXDLLEXPORT wxColour: public wxObject
{ {
public: public:
// ctors //
// default // Ctors
wxColour(); //
//
// Default
//
wxColour();
//
// from RGB // from RGB
wxColour( unsigned char red, unsigned char green, unsigned char blue ); //
// implicit conversion from the colour name wxColour( unsigned char cRed
wxColour( const wxString &colourName ) { InitFromName(colourName); } ,unsigned char cGreen
wxColour( const char *colourName ) { InitFromName(colourName); } ,unsigned char cBlue
);
// copy ctors and assignment operators //
wxColour( const wxColour& col ); // Implicit conversion from the colour name
wxColour( const wxColour* col ); //
wxColour& operator = ( const wxColour& col ); wxColour(const wxString& rColourName) { InitFromName(rColourName); }
wxColour(const char* zColourName) { InitFromName(zColourName); }
// dtor //
~wxColour(); // Copy ctors and assignment operators
//
wxColour(const wxColour& rCol);
wxColour(const wxColour* pCol);
wxColour&operator = (const wxColour& rCol);
// Set() functions //
void Set( unsigned char red, unsigned char green, unsigned char blue ); // Dtor
void Set( unsigned long colRGB ) //
{ ~wxColour();
// we don't need to know sizeof(long) here because we assume that the three
// least significant bytes contain the R, G and B values
Set((unsigned char)colRGB,
(unsigned char)(colRGB >> 8),
(unsigned char)(colRGB >> 16));
}
// accessors //
bool Ok() const {return m_isInit; } // Set functions
//
void Set( unsigned char cRed
,unsigned char cGreen
,unsigned char cBlue
);
void Set(unsigned long lColRGB)
{
//
// We don't need to know sizeof(long) here because we assume that the three
// least significant bytes contain the R, G and B values
//
Set( (unsigned char)lColRGB
,(unsigned char)(lColRGB >> 8)
,(unsigned char)(lColRGB >> 16)
);
}
// Let's remove this inelegant function //
// Accessors
bool Ok(void) const {return m_bIsInit; }
//
// Let's remove this inelegant function
//
#if WXWIN_COMPATIBILITY #if WXWIN_COMPATIBILITY
void Get(unsigned char *r, unsigned char *g, unsigned char *b) const; void Get( unsigned char* pRed
,unsigned char* pGreen
,unsigned char* pBlue
) const;
#endif #endif
unsigned char Red() const { return m_red; } unsigned char Red(void) const { return m_cRed; }
unsigned char Green() const { return m_green; } unsigned char Green(void) const { return m_cGreen; }
unsigned char Blue() const { return m_blue; } unsigned char Blue(void) const { return m_cBlue; }
// comparison //
bool operator == (const wxColour& colour) const // Comparison
{ //
return (m_red == colour.m_red && bool operator == (const wxColour& rColour) const
m_green == colour.m_green && {
m_blue == colour.m_blue); return (m_cRed == rColour.m_cRed &&
} m_cGreen == rColour.m_cGreen &&
bool operator != (const wxColour& colour) const { return !(*this == colour); } m_cBlue == rColour.m_cBlue
);
}
bool operator != (const wxColour& rColour) const { return !(*this == rColour); }
void InitFromName(const wxString& col); void InitFromName(const wxString& rCol);
WXCOLORREF GetPixel(void) const { return m_vPixel; };
/* TODO
WXCOLORREF GetPixel() const { return m_pixel; };
*/
private: private:
bool m_isInit; bool m_bIsInit;
unsigned char m_red; unsigned char m_cRed;
unsigned char m_blue; unsigned char m_cBlue;
unsigned char m_green; unsigned char m_cGreen;
public: public:
WXCOLORREF m_pixel ; WXCOLORREF m_vPixel ;
private: private:
DECLARE_DYNAMIC_CLASS(wxColour) DECLARE_DYNAMIC_CLASS(wxColour)
}; }; // end of class wxColour
#endif #endif
// _WX_COLOUR_H_ // _WX_COLOUR_H_

View File

@ -205,7 +205,7 @@ bool wxApp::RegisterWindowClasses(
,wxFrameClassName ,wxFrameClassName
,(PFNWP)wxWndProc ,(PFNWP)wxWndProc
,CS_SIZEREDRAW | CS_SYNCPAINT ,CS_SIZEREDRAW | CS_SYNCPAINT
,0 ,sizeof(ULONG)
)) ))
{ {
vError = ::WinGetLastError(vHab); vError = ::WinGetLastError(vHab);
@ -321,19 +321,13 @@ void wxApp::CleanUp()
wxLog::DontCreateOnDemand(); wxLog::DontCreateOnDemand();
// this will flush the old messages if any // this will flush the old messages if any
#if (!(defined(__VISAGECPP__) && __IBMCPP__ < 400))
// another VA 3.0 memory problem here
delete wxLog::SetActiveTarget(new wxLogStderr); delete wxLog::SetActiveTarget(new wxLogStderr);
#endif
#endif // wxUSE_LOG #endif // wxUSE_LOG
// One last chance for pending objects to be cleaned up // One last chance for pending objects to be cleaned up
wxTheApp->DeletePendingObjects(); wxTheApp->DeletePendingObjects();
#if (!(defined(__VISAGECPP__) && __IBMCPP__ < 400))
// another VA 3.0 memory problem here
wxModule::CleanUpModules(); wxModule::CleanUpModules();
#endif
#if wxUSE_WX_RESOURCES #if wxUSE_WX_RESOURCES
wxCleanUpResourceSystem(); wxCleanUpResourceSystem();
@ -345,10 +339,7 @@ void wxApp::CleanUp()
// by deleting the bitmap list before g_globalCursor goes out of scope // by deleting the bitmap list before g_globalCursor goes out of scope
// (double deletion of the cursor). // (double deletion of the cursor).
wxSetCursor(wxNullCursor); wxSetCursor(wxNullCursor);
#if (!(defined(__VISAGECPP__) && __IBMCPP__ < 400))
// another VA 3.0 memory problem here
delete g_globalCursor; delete g_globalCursor;
#endif
g_globalCursor = NULL; g_globalCursor = NULL;
wxDeleteStockObjects(); wxDeleteStockObjects();
@ -364,7 +355,7 @@ void wxApp::CleanUp()
delete[] wxBuffer; delete[] wxBuffer;
wxBuffer = NULL; wxBuffer = NULL;
//// WINDOWS-SPECIFIC CLEANUP //// PM-SPECIFIC CLEANUP
// wxSetKeyboardHook(FALSE); // wxSetKeyboardHook(FALSE);

View File

@ -23,83 +23,100 @@ IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
wxColour::wxColour () wxColour::wxColour ()
{ {
m_isInit = FALSE; m_bIsInit = FALSE;
m_pixel = 0; m_vPixel = 0;
m_red = m_blue = m_green = 0; m_cRed = m_cBlue = m_cGreen = 0;
} } // end of wxColour::wxColour
wxColour::wxColour (unsigned char r, unsigned char g, unsigned char b) wxColour::wxColour (
unsigned char cRed
, unsigned char cGreen
, unsigned char cBlue
)
{ {
m_red = r; m_cRed = cRed;
m_green = g; m_cGreen = cGreen;
m_blue = b; m_cBlue = cBlue;
m_isInit = TRUE; m_bIsInit = TRUE;
// m_pixel = PALETTERGB (m_red, m_green, m_blue); m_vPixel = PALETTERGB (m_cRed, m_cGreen, m_cBlue);
} } // end of wxColour::wxColour
wxColour::wxColour (const wxColour& col) wxColour::wxColour (
const wxColour& rCol
)
{ {
m_red = col.m_red; m_cRed = rCol.m_cRed;
m_green = col.m_green; m_cGreen = rCol.m_cGreen;
m_blue = col.m_blue; m_cBlue = rCol.m_cBlue;
m_isInit = col.m_isInit; m_bIsInit = rCol.m_bIsInit;
m_pixel = col.m_pixel; m_vPixel = rCol.m_vPixel;
} } // end of wxColour::wxColour
wxColour& wxColour::operator =(const wxColour& col) wxColour& wxColour::operator =(
const wxColour& rCol
)
{ {
m_red = col.m_red; m_cRed = rCol.m_cRed;
m_green = col.m_green; m_cGreen = rCol.m_cGreen;
m_blue = col.m_blue; m_cBlue = rCol.m_cBlue;
m_isInit = col.m_isInit; m_bIsInit = rCol.m_bIsInit;
m_pixel = col.m_pixel; m_vPixel = rCol.m_vPixel;
return *this; return *this;
} } // end of wxColour& wxColour::operator =
void wxColour::InitFromName(const wxString& col) void wxColour::InitFromName(
const wxString& sCol
)
{ {
wxColour *the_colour = wxTheColourDatabase->FindColour (col); wxColour* pTheColour = wxTheColourDatabase->FindColour(sCol);
if (the_colour)
if (pTheColour)
{ {
m_red = the_colour->Red (); m_cRed = pTheColour->Red();
m_green = the_colour->Green (); m_cGreen = pTheColour->Green();
m_blue = the_colour->Blue (); m_cBlue = pTheColour->Blue();
m_isInit = TRUE; m_bIsInit = TRUE;
} }
else else
{ {
m_red = 0; m_cRed = 0;
m_green = 0; m_cGreen = 0;
m_blue = 0; m_cBlue = 0;
m_isInit = FALSE; m_bIsInit = FALSE;
} }
/* TODO m_vPixel = PALETTERGB (m_cRed, m_cGreen, m_cBlue);
m_pixel = PALETTERGB (m_red, m_green, m_blue); } // end of wxColour::InitFromName
*/
}
wxColour::~wxColour () wxColour::~wxColour ()
{ {
} } // end of wxColour::~wxColour
void wxColour::Set (unsigned char r, unsigned char g, unsigned char b) void wxColour::Set (
unsigned char cRed
, unsigned char cGreen
, unsigned char cBlue
)
{ {
m_red = r; m_cRed = cRed;
m_green = g; m_cGreen = cGreen;
m_blue = b; m_cBlue = cBlue;
m_isInit = TRUE; m_bIsInit = TRUE;
/* TODO m_vPixel = PALETTERGB (m_cRed, m_cGreen, m_cBlue);
m_pixel = PALETTERGB (m_red, m_green, m_blue); } // end of wxColour::Set
*/
}
//
// Obsolete // Obsolete
//
#if WXWIN_COMPATIBILITY #if WXWIN_COMPATIBILITY
void wxColour::Get (unsigned char *r, unsigned char *g, unsigned char *b) const void wxColour::Get (
unsigned char* pRed
, unsigned char* pGreen
, unsigned char* pBlue
) const
{ {
*r = m_red; *Red = m_cRed;
*g = m_green; *Green = m_cGreen;
*b = m_blue; *Blue = m_cBlue;
} } // end of wxColour::Get
#endif #endif

View File

@ -343,16 +343,37 @@ void wxFrame::DoShowWindow(
) )
{ {
HWND hClient; HWND hClient;
HWND hTitlebar = NULLHANDLE;
HWND hHScroll = NULLHANDLE;
HWND hVScroll = NULLHANDLE;
HWND hMenuBar = NULLHANDLE;
SWP vSwp;
SWP vSwpTitlebar;
SWP vSwpVScroll;
SWP vSwpHScroll;
SWP vSwpMenu;
// //
// Send anything to initialize the frame // Send anything to initialize the frame
// //
::WinSendMsg( GetHwnd() WinQueryWindowPos(GetHwnd(), &vSwp);
,WM_UPDATEFRAME hClient = WinWindowFromID(GetHwnd(), FID_CLIENT);
,(MPARAM)FCF_MENU hTitlebar = WinWindowFromID(GetHwnd(), FID_TITLEBAR);
,(MPARAM)0 WinQueryWindowPos(hTitlebar, &vSwpTitlebar);
); hHScroll = WinWindowFromID(GetHwnd(), FID_HORZSCROLL);
hClient = ::WinWindowFromID(GetHwnd(), FID_CLIENT); WinQueryWindowPos(hHScroll, &vSwpHScroll);
hVScroll = WinWindowFromID(GetHwnd(), FID_VERTSCROLL);
WinQueryWindowPos(hVScroll, &vSwpVScroll);
hMenuBar = WinWindowFromID(GetHwnd(), FID_MENU);
WinQueryWindowPos(hMenuBar, &vSwpMenu);
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 + vSwpMenu.cy + vSwpHScroll.cy)
,SWP_SIZE | SWP_MOVE
);
::WinShowWindow(GetHwnd(), (BOOL)bShowCmd); ::WinShowWindow(GetHwnd(), (BOOL)bShowCmd);
::WinShowWindow(hClient, (BOOL)bShowCmd); ::WinShowWindow(hClient, (BOOL)bShowCmd);
} // end of wxFrame::DoShowWindow } // end of wxFrame::DoShowWindow
@ -371,14 +392,7 @@ bool wxFrame::Show(
::WinQueryWindowPos(GetHwnd(), &vSwp); ::WinQueryWindowPos(GetHwnd(), &vSwp);
m_bIconized = vSwp.fl & SWP_MINIMIZE; m_bIconized = vSwp.fl & SWP_MINIMIZE;
::WinSetWindowPos( (HWND) GetHWND() ::WinEnableWindow(GetHwnd(), TRUE);
,HWND_TOP
,vSwp.x
,vSwp.y
,vSwp.cx
,vSwp.cy
,SWP_ZORDER | SWP_ACTIVATE | SWP_SHOW | SWP_MOVE
);
vEvent.SetEventObject(this); vEvent.SetEventObject(this);
GetEventHandler()->ProcessEvent(vEvent); GetEventHandler()->ProcessEvent(vEvent);
} }
@ -402,6 +416,7 @@ bool wxFrame::Show(
,vSwp.cy ,vSwp.cy
,SWP_ZORDER | SWP_ACTIVATE | SWP_SHOW | SWP_MOVE ,SWP_ZORDER | SWP_ACTIVATE | SWP_SHOW | SWP_MOVE
); );
::WinEnableWindow(hWndParent, TRUE);
} }
} }
return TRUE; return TRUE;
@ -747,16 +762,23 @@ bool wxFrame::OS2Create(
HWND hTitlebar = NULLHANDLE; HWND hTitlebar = NULLHANDLE;
HWND hHScroll = NULLHANDLE; HWND hHScroll = NULLHANDLE;
HWND hVScroll = NULLHANDLE; HWND hVScroll = NULLHANDLE;
HWND hMenuBar = NULLHANDLE;
HWND hMenu1 = NULLHANDLE;
HWND hMenu2 = NULLHANDLE;
HWND hFrame = NULLHANDLE;
SWP vSwp; SWP vSwp;
SWP vSwpTitlebar; SWP vSwpTitlebar;
SWP vSwpVScroll; SWP vSwpVScroll;
SWP vSwpHScroll; SWP vSwpHScroll;
SWP vSwpMenu;
RGB2 vRgb;
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(&vSwp, '\0', sizeof(SWP));
memset(&vSwpTitlebar, '\0', sizeof(SWP)); memset(&vSwpTitlebar, '\0', sizeof(SWP));
memset(&vSwpVScroll, '\0', sizeof(SWP)); memset(&vSwpVScroll, '\0', sizeof(SWP));
memset(&vSwpHScroll, '\0', sizeof(SWP)); memset(&vSwpHScroll, '\0', sizeof(SWP));
if (pParent) if (pParent)
hParent = GetWinHwnd(pParent); hParent = GetWinHwnd(pParent);
else else
@ -844,8 +866,8 @@ bool wxFrame::OS2Create(
// Create the client window. We must call the API from here rather than // Create the client window. We must call the API from here rather than
// the static base class create because we need a separate handle // the static base class create because we need a separate handle
// //
if ((hClient = ::WinCreateWindow( GetHwnd() // Frame is parent if ((hClient = ::WinCreateWindow( hFrame // Frame is parent
,zWclass // Custom client class ,wxFrameClassName
,NULL // Window title ,NULL // Window title
,0 // No styles ,0 // No styles
,0, 0, 0, 0 // Window position ,0, 0, 0, 0 // Window position
@ -861,7 +883,7 @@ bool wxFrame::OS2Create(
// //
// Send anything to initialize the frame // Send anything to initialize the frame
// //
::WinSendMsg( GetHwnd() ::WinSendMsg( hFrame
,WM_UPDATEFRAME ,WM_UPDATEFRAME
,(MPARAM)FCF_TASKLIST ,(MPARAM)FCF_TASKLIST
,(MPARAM)0 ,(MPARAM)0
@ -870,7 +892,7 @@ bool wxFrame::OS2Create(
// //
// Now size everything. If adding a menu the client will need to be resized. // Now size everything. If adding a menu the client will need to be resized.
// //
if (!::WinSetWindowPos( GetHwnd() if (!::WinSetWindowPos( hFrame
,HWND_TOP ,HWND_TOP
,nX ,nX
,nY ,nY
@ -880,21 +902,34 @@ bool wxFrame::OS2Create(
)) ))
return FALSE; return FALSE;
WinQueryWindowPos(GetHwnd(), &vSwp); WinQueryWindowPos(hFrame, &vSwp);
//
// Set the client window's background, otherwise it is transparent!
//
wxColour vColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW);
vRgb.bRed = (BYTE)vColour.Red();
vRgb.bGreen = (BYTE)vColour.Green();
vRgb.bBlue = (BYTE)vColour.Blue();
WinSetPresParam( hClient
,PP_BACKGROUNDCOLOR
,(ULONG)sizeof(RGB2)
,(PVOID)&vRgb
);
if (ulCreateFlags & FCF_TITLEBAR) if (ulCreateFlags & FCF_TITLEBAR)
{ {
hTitlebar = WinWindowFromID(GetHwnd(), FID_TITLEBAR); hTitlebar = WinWindowFromID(hFrame, FID_TITLEBAR);
WinQueryWindowPos(hTitlebar, &vSwpTitlebar); WinQueryWindowPos(hTitlebar, &vSwpTitlebar);
} }
if (ulCreateFlags & FCF_HORZSCROLL) if (ulCreateFlags & FCF_HORZSCROLL)
{ {
hHScroll = WinWindowFromID(GetHwnd(), FID_HORZSCROLL); hHScroll = WinWindowFromID(hFrame, FID_HORZSCROLL);
WinQueryWindowPos(hHScroll, &vSwpHScroll); WinQueryWindowPos(hHScroll, &vSwpHScroll);
} }
if (ulCreateFlags & FCF_VERTSCROLL) if (ulCreateFlags & FCF_VERTSCROLL)
{ {
hVScroll = WinWindowFromID(GetHwnd(), FID_VERTSCROLL); hVScroll = WinWindowFromID(hFrame, FID_VERTSCROLL);
WinQueryWindowPos(hVScroll, &vSwpVScroll); WinQueryWindowPos(hVScroll, &vSwpVScroll);
} }
if (!::WinSetWindowPos( hClient if (!::WinSetWindowPos( hClient
@ -907,6 +942,7 @@ bool wxFrame::OS2Create(
)) ))
return FALSE; return FALSE;
WinQueryWindowPos(hClient, &vSwp); WinQueryWindowPos(hClient, &vSwp);
::WinShowWindow(hClient, TRUE);
return TRUE; return TRUE;
} // end of wxFrame::OS2Create } // end of wxFrame::OS2Create

View File

@ -86,10 +86,16 @@ void wxMenu::Init()
,0L ,0L
,NULL ,NULL
,NULL ,NULL
)) != 0) )) == 0)
{ {
wxLogLastError("WinLoadMenu"); wxLogLastError("WinLoadMenu");
} }
m_vMenuData.iPosition = 0;
m_vMenuData.afStyle = MIS_SUBMENU | MIS_TEXT;
m_vMenuData.afAttribute = (USHORT)0;
m_vMenuData.id = (USHORT)0;
m_vMenuData.hwndSubMenu = m_hMenu;
m_vMenuData.hItem = NULLHANDLE;
// //
// 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
@ -207,6 +213,9 @@ bool wxMenu::DoInsertOrAppend(
, size_t nPos , size_t nPos
) )
{ {
ERRORID vError;
wxString sError;
#if wxUSE_ACCEL #if wxUSE_ACCEL
UpdateAccel(pItem); UpdateAccel(pItem);
#endif // wxUSE_ACCEL #endif // wxUSE_ACCEL
@ -270,47 +279,29 @@ bool wxMenu::DoInsertOrAppend(
pData = (char*)pItem->GetText().c_str(); pData = (char*)pItem->GetText().c_str();
} }
BOOL bOk; APIRET rc;
m_vMenuData.hwndSubMenu = NULLHANDLE;
m_vMenuData.hItem = NULLHANDLE;
// //
// -1 means this is a sub menu not a menuitem. We must create a window for it. // -1 means append at end
// 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 hMenuBar; m_vMenuData.iPosition = MIT_END;
if (m_menuBar)
hMenuBar = GetWinHwnd(m_menuBar);
else
hMenuBar = HWND_DESKTOP;
HWND hSubMenu = ::WinCreateWindow( hMenuBar // parent
,WC_MENU // type
,"Menu" // a generic name
,0L // no style flag
,0L,0L,0L,0L // no position
,hMenuBar // no owner
,HWND_TOP // always on top
,0L // no ID needed for dynamic creation
,NULL // no control data
,NULL // no presentation params
);
m_vMenuData.iPosition = 0;
m_vMenuData.hwndSubMenu = hSubMenu;
m_vMenuData.hItem = NULLHANDLE;
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.hItem = NULLHANDLE;
bOk = (bool)::WinSendMsg(GetHmenu(), MM_INSERTITEM, (MPARAM)&m_vMenuData, (MPARAM)pItem->GetText().c_str());
} }
if (!bOk) rc = (APIRET)::WinSendMsg(GetHmenu(), MM_INSERTITEM, (MPARAM)&m_vMenuData, (MPARAM)pData);
if (rc == MIT_MEMERROR || rc == MIT_ERROR)
{ {
vError = ::WinGetLastError(vHabmain);
sError = wxPMErrorToStr(vError);
wxLogError("Error inserting or appending a menuitem. Error: %s\n", sError);
wxLogLastError("Insert or AppendMenu"); wxLogLastError("Insert or AppendMenu");
return FALSE; return FALSE;
} }
@ -625,6 +616,7 @@ WXHMENU wxMenuBar::Create()
{ {
MENUITEM vItem; MENUITEM vItem;
HWND hFrame; HWND hFrame;
HWND hMenuBar = NULLHANDLE;
if (m_hMenu != 0 ) if (m_hMenu != 0 )
return m_hMenu; return m_hMenu;
@ -662,19 +654,13 @@ WXHMENU wxMenuBar::Create()
{ {
size_t nCount = GetMenuCount(); size_t nCount = GetMenuCount();
hMenuBar = GetHwnd();
for (size_t i = 0; i < nCount; i++) for (size_t i = 0; i < nCount; i++)
{ {
vItem.iPosition = 0; ::WinSendMsg(hMenuBar, MM_INSERTITEM, (MPARAM)&m_menus[i]->m_vMenuData, (MPARAM)m_titles[i].c_str());
vItem.afStyle = MIS_SUBMENU | MIS_TEXT;
vItem.afAttribute = (USHORT)0;
vItem.id = (USHORT)0;
vItem.hwndSubMenu = m_menus[i]->GetHMenu();
vItem.hItem = NULLHANDLE;
::WinSendMsg(GetHmenu(), MM_INSERTITEM, (MPARAM)&vItem, (MPARAM)m_titles[i].c_str());
} }
} }
return m_hMenu; return hMenuBar;
} // end of wxMenuBar::Create } // end of wxMenuBar::Create
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

View File

@ -24,17 +24,141 @@
#include "wx/window.h" #include "wx/window.h"
#include "wx/os2/private.h" #include "wx/os2/private.h"
// TODO: see ::SystemParametersInfo for all sorts of Windows settings. wxColour wxSystemSettings::GetSystemColour(
// Different args are required depending on the id. How does this differ int nIndex
// from GetSystemMetric, and should it? Perhaps call it GetSystemParameter )
// and pass an optional void* arg to get further info.
// Should also have SetSystemParameter.
// Also implement WM_WININICHANGE (NT) / WM_SETTINGCHANGE (Win95)
wxColour wxSystemSettings::GetSystemColour(int index)
{ {
// TODO COLORREF vRef;
return wxColour(); wxColour vCol;
} switch (nIndex)
{
//
// PM actually has values for these
//
case wxSYS_COLOUR_WINDOW:
vRef = (ULONG)::WinQuerySysColor( HWND_DESKTOP
,SYSCLR_WINDOW
,0L
);
vCol.Set( GetRValue(vRef)
,GetGValue(vRef)
,GetBValue(vRef)
);
return vCol;
break;
case wxSYS_COLOUR_WINDOWFRAME:
vRef = (ULONG)::WinQuerySysColor( HWND_DESKTOP
,SYSCLR_WINDOWFRAME
,0L
);
vCol.Set( GetRValue(vRef)
,GetGValue(vRef)
,GetBValue(vRef)
);
return vCol;
break;
case wxSYS_COLOUR_MENUTEXT:
vRef = (ULONG)::WinQuerySysColor( HWND_DESKTOP
,SYSCLR_MENUTEXT
,0L
);
vCol.Set( GetRValue(vRef)
,GetGValue(vRef)
,GetBValue(vRef)
);
break;
case wxSYS_COLOUR_BTNFACE:
vRef = (ULONG)::WinQuerySysColor( HWND_DESKTOP
,SYSCLR_BUTTONDEFAULT
,0L
);
vCol.Set( GetRValue(vRef)
,GetGValue(vRef)
,GetBValue(vRef)
);
return vCol;
break;
case wxSYS_COLOUR_BTNSHADOW:
vRef = (ULONG)::WinQuerySysColor( HWND_DESKTOP
,SYSCLR_BUTTONMIDDLE
,0L
);
vCol.Set( GetRValue(vRef)
,GetGValue(vRef)
,GetBValue(vRef)
);
return vCol;
break;
case wxSYS_COLOUR_BTNHIGHLIGHT:
vRef = (ULONG)::WinQuerySysColor( HWND_DESKTOP
,SYSCLR_BUTTONLIGHT
,0L
);
vCol.Set( GetRValue(vRef)
,GetGValue(vRef)
,GetBValue(vRef)
);
return vCol;
break;
//
// We'll have to just give values to these
//
case wxSYS_COLOUR_LISTBOX:
case wxSYS_COLOUR_CAPTIONTEXT:
return(*wxWHITE);
break;
case wxSYS_COLOUR_WINDOWTEXT:
case wxSYS_COLOUR_INACTIVECAPTIONTEXT:
case wxSYS_COLOUR_BTNTEXT:
case wxSYS_COLOUR_INFOTEXT:
return(*wxBLACK);
break;
//
// We should customize these to look like other ports
//
case wxSYS_COLOUR_ACTIVECAPTION:
case wxSYS_COLOUR_ACTIVEBORDER:
case wxSYS_COLOUR_HIGHLIGHT:
return(*wxBLUE);
break;
case wxSYS_COLOUR_SCROLLBAR:
case wxSYS_COLOUR_BACKGROUND:
case wxSYS_COLOUR_INACTIVECAPTION:
case wxSYS_COLOUR_MENU:
case wxSYS_COLOUR_INACTIVEBORDER:
case wxSYS_COLOUR_APPWORKSPACE:
case wxSYS_COLOUR_HIGHLIGHTTEXT:
case wxSYS_COLOUR_GRAYTEXT:
case wxSYS_COLOUR_3DDKSHADOW:
case wxSYS_COLOUR_3DLIGHT:
case wxSYS_COLOUR_INFOBK:
return(*wxLIGHT_GREY);
break;
default:
vRef = (ULONG)::WinQuerySysColor( HWND_DESKTOP
,SYSCLR_WINDOW
,0L
);
vCol.Set( GetRValue(vRef)
,GetGValue(vRef)
,GetBValue(vRef)
);
return vCol;
break;
}
return(vCol);
} // end of wxSystemSettings::GetSystemColour
wxFont wxSystemSettings::GetSystemFont(int index) wxFont wxSystemSettings::GetSystemFont(int index)
{ {