No changes, just minor wxMSW code cleanup: use WinStruct<>.

Use WinStruct instead of the usual ZeroMemory() + cbSize setting fragment to
initialize Win32 structs that need to be initialized in this way.

No real changes.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70383 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-01-18 10:05:27 +00:00
parent 89041b2513
commit be85a191e1
4 changed files with 8 additions and 24 deletions

View File

@@ -190,9 +190,7 @@ void SetDefaultMenuItem(HMENU WXUNUSED_IN_WINCE(hmenu),
UINT WXUNUSED_IN_WINCE(id))
{
#ifndef __WXWINCE__
MENUITEMINFO mii;
wxZeroMemory(mii);
mii.cbSize = sizeof(MENUITEMINFO);
WinStruct<MENUITEMINFO> mii;
mii.fMask = MIIM_STATE;
mii.fState = MFS_DEFAULT;
@@ -210,9 +208,7 @@ void SetOwnerDrawnMenuItem(HMENU WXUNUSED_IN_WINCE(hmenu),
BOOL WXUNUSED_IN_WINCE(byPositon = FALSE))
{
#ifndef __WXWINCE__
MENUITEMINFO mii;
wxZeroMemory(mii);
mii.cbSize = sizeof(MENUITEMINFO);
WinStruct<MENUITEMINFO> mii;
mii.fMask = MIIM_FTYPE | MIIM_DATA;
mii.fType = MFT_OWNERDRAW;
mii.dwItemData = data;
@@ -230,9 +226,7 @@ void SetOwnerDrawnMenuItem(HMENU WXUNUSED_IN_WINCE(hmenu),
#ifdef __WXWINCE__
UINT GetMenuState(HMENU hMenu, UINT id, UINT flags)
{
MENUITEMINFO info;
wxZeroMemory(info);
info.cbSize = sizeof(info);
WinStruct<MENUITEMINFO> info;
info.fMask = MIIM_STATE;
// MF_BYCOMMAND is zero so test MF_BYPOSITION
if ( !::GetMenuItemInfo(hMenu, id, flags & MF_BYPOSITION ? TRUE : FALSE , & info) )
@@ -913,9 +907,7 @@ void wxMenu::SetTitle(const wxString& label)
{
// modify the title
#ifdef __WXWINCE__
MENUITEMINFO info;
wxZeroMemory(info);
info.cbSize = sizeof(info);
WinStruct<MENUITEMINFO> info;
info.fMask = MIIM_TYPE;
info.fType = MFT_STRING;
info.cch = m_title.length();
@@ -1269,9 +1261,7 @@ void wxMenuBar::SetMenuLabel(size_t pos, const wxString& label)
}
#ifdef __WXWINCE__
MENUITEMINFO info;
wxZeroMemory(info);
info.cbSize = sizeof(info);
WinStruct<MENUITEMINFO> info;
info.fMask = MIIM_TYPE;
info.fType = MFT_STRING;
info.cch = label.length();

View File

@@ -156,9 +156,7 @@ void wxScrollBar::SetThumbPosition(int viewStart)
int wxScrollBar::GetThumbPosition(void) const
{
SCROLLINFO scrollInfo;
wxZeroMemory(scrollInfo);
scrollInfo.cbSize = sizeof(SCROLLINFO);
WinStruct<SCROLLINFO> scrollInfo;
scrollInfo.fMask = SIF_POS;
if ( !::GetScrollInfo(GetHwnd(), SB_CTL, &scrollInfo) )

View File

@@ -2397,9 +2397,7 @@ bool wxTextCtrl::SetForegroundColour(const wxColour& colour)
if ( IsRich() )
{
// change the colour of everything
CHARFORMAT cf;
wxZeroMemory(cf);
cf.cbSize = sizeof(cf);
WinStruct<CHARFORMAT> cf;
cf.dwMask = CFM_COLOR;
cf.crTextColor = wxColourToRGB(colour);
::SendMessage(GetHwnd(), EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);

View File

@@ -5794,9 +5794,7 @@ int wxWindowMSW::HandleMenuChar(int WXUNUSED_IN_WINCE(chAccel),
#ifndef __WXWINCE__
const HMENU hmenu = (HMENU)lParam;
MENUITEMINFO mii;
wxZeroMemory(mii);
mii.cbSize = sizeof(MENUITEMINFO);
WinStruct<MENUITEMINFO> mii;
// we could use MIIM_FTYPE here as we only need to know if the item is
// ownerdrawn or not and not dwTypeData which MIIM_TYPE also returns, but