Source cleaning: -1/wxID_ANY/wxDefaultCoord, ::, !!, TRUE/true, FALSE/false, whitespaces, tabs.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28966 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2004-08-30 10:18:55 +00:00
parent 95a8b77a94
commit 598ddd96f4
21 changed files with 288 additions and 288 deletions

View File

@@ -91,7 +91,7 @@ public:
virtual int FindString(const wxString& s) const; virtual int FindString(const wxString& s) const;
virtual bool IsSelected(int n) const; virtual bool IsSelected(int n) const;
virtual void SetSelection(int n, bool select = TRUE); virtual void SetSelection(int n, bool select = true);
virtual int GetSelection() const; virtual int GetSelection() const;
virtual int GetSelections(wxArrayInt& aSelections) const; virtual int GetSelections(wxArrayInt& aSelections) const;

View File

@@ -90,7 +90,7 @@ public:
wxListCtrl() { Init(); } wxListCtrl() { Init(); }
wxListCtrl(wxWindow *parent, wxListCtrl(wxWindow *parent,
wxWindowID id = -1, wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
long style = wxLC_ICON, long style = wxLC_ICON,
@@ -105,7 +105,7 @@ public:
virtual ~wxListCtrl(); virtual ~wxListCtrl();
bool Create(wxWindow *parent, bool Create(wxWindow *parent,
wxWindowID id = -1, wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
long style = wxLC_ICON, long style = wxLC_ICON,
@@ -214,7 +214,7 @@ public:
long GetTopItem() const ; long GetTopItem() const ;
// Add or remove a single window style // Add or remove a single window style
void SetSingleStyle(long style, bool add = TRUE) ; void SetSingleStyle(long style, bool add = true) ;
// Set the whole window style // Set the whole window style
void SetWindowStyleFlag(long style) ; void SetWindowStyleFlag(long style) ;
@@ -280,7 +280,7 @@ public:
// Find an item whose label matches this string, starting from the item after 'start' // Find an item whose label matches this string, starting from the item after 'start'
// or the beginning if 'start' is -1. // or the beginning if 'start' is -1.
long FindItem(long start, const wxString& str, bool partial = FALSE); long FindItem(long start, const wxString& str, bool partial = false);
// Find an item whose data matches this data, starting from the item after 'start' // Find an item whose data matches this data, starting from the item after 'start'
// or the beginning if 'start' is -1. // or the beginning if 'start' is -1.
@@ -390,10 +390,10 @@ protected:
// ListView_GetItemCount // ListView_GetItemCount
bool m_ignoreChangeMessages; bool m_ignoreChangeMessages;
// TRUE if we have any internal data (user data & attributes) // true if we have any internal data (user data & attributes)
bool m_AnyInternalData; bool m_AnyInternalData;
// TRUE if we have any items with custom attributes // true if we have any items with custom attributes
bool m_hasAnyAttr; bool m_hasAnyAttr;
// these functions are only used for virtual list view controls, i.e. the // these functions are only used for virtual list view controls, i.e. the

View File

@@ -106,7 +106,7 @@ protected:
wxMDIChildFrame * m_currentChild; wxMDIChildFrame * m_currentChild;
wxMenu* m_windowMenu; wxMenu* m_windowMenu;
// TRUE if MDI Frame is intercepting commands, not child // true if MDI Frame is intercepting commands, not child
bool m_parentFrameActive; bool m_parentFrameActive;
private: private:
@@ -148,10 +148,10 @@ public:
long style = wxDEFAULT_FRAME_STYLE, long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr); const wxString& name = wxFrameNameStr);
virtual bool IsTopLevel() const { return FALSE; } virtual bool IsTopLevel() const { return false; }
// MDI operations // MDI operations
virtual void Maximize(bool maximize = TRUE); virtual void Maximize(bool maximize = true);
virtual void Restore(); virtual void Restore();
virtual void Activate(); virtual void Activate();
@@ -178,7 +178,7 @@ protected:
virtual void DoGetPosition(int *x, int *y) const; virtual void DoGetPosition(int *x, int *y) const;
virtual void DoSetClientSize(int width, int height); virtual void DoSetClientSize(int width, int height);
virtual void InternalSetMenuBar(); virtual void InternalSetMenuBar();
virtual bool IsMDIChild() const { return TRUE; } virtual bool IsMDIChild() const { return true; }
virtual WXHICON GetDefaultIcon() const; virtual WXHICON GetDefaultIcon() const;

View File

@@ -116,7 +116,7 @@ private:
// terminate the current radio group, if any // terminate the current radio group, if any
void EndRadioGroup(); void EndRadioGroup();
// if TRUE, insert a breal before appending the next item // if true, insert a breal before appending the next item
bool m_doBreak; bool m_doBreak;
// the position of the first item in the current radio group or -1 // the position of the first item in the current radio group or -1

View File

@@ -47,8 +47,8 @@ public:
virtual void SetText(const wxString& strName); virtual void SetText(const wxString& strName);
virtual void SetCheckable(bool checkable); virtual void SetCheckable(bool checkable);
virtual void Enable(bool bDoEnable = TRUE); virtual void Enable(bool bDoEnable = true);
virtual void Check(bool bDoCheck = TRUE); virtual void Check(bool bDoCheck = true);
virtual bool IsChecked() const; virtual bool IsChecked() const;
// unfortunately needed to resolve ambiguity between // unfortunately needed to resolve ambiguity between
@@ -79,7 +79,7 @@ private:
// the positions of the first and last items of the radio group this item // the positions of the first and last items of the radio group this item
// belongs to or -1: start is the radio group start and is valid for all // belongs to or -1: start is the radio group start and is valid for all
// but first radio group items (m_isRadioGroupStart == FALSE), end is valid // but first radio group items (m_isRadioGroupStart == false), end is valid
// only for the first one // only for the first one
union union
{ {

View File

@@ -106,7 +106,7 @@ public:
virtual void SetMapMode(int mode); virtual void SetMapMode(int mode);
virtual void GetTextExtent(const wxString& string, long *x, long *y, virtual void GetTextExtent(const wxString& string, long *x, long *y,
long *descent = NULL, long *externalLeading = NULL, long *descent = NULL, long *externalLeading = NULL,
wxFont *theFont = NULL, bool use16bit = FALSE) const; wxFont *theFont = NULL, bool use16bit = false) const;
// Implementation // Implementation
wxMetafile *GetMetaFile() const { return m_metaFile; } wxMetafile *GetMetaFile() const { return m_metaFile; }
@@ -133,7 +133,7 @@ private:
bool WXDLLEXPORT wxMakeMetafilePlaceable(const wxString& filename, float scale = 1.0); bool WXDLLEXPORT wxMakeMetafilePlaceable(const wxString& filename, float scale = 1.0);
// Optional origin and extent // Optional origin and extent
bool WXDLLEXPORT wxMakeMetaFilePlaceable(const wxString& filename, int x1, int y1, int x2, int y2, float scale = 1.0, bool useOriginAndExtent = TRUE); bool WXDLLEXPORT wxMakeMetaFilePlaceable(const wxString& filename, int x1, int y1, int x2, int y2, float scale = 1.0, bool useOriginAndExtent = true);
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxMetafileDataObject is a specialization of wxDataObject for metafile data // wxMetafileDataObject is a specialization of wxDataObject for metafile data

View File

@@ -57,10 +57,10 @@ public:
bool Unassociate(); bool Unassociate();
// set an arbitrary command, ask confirmation if it already exists and // set an arbitrary command, ask confirmation if it already exists and
// overwriteprompt is TRUE // overwriteprompt is true
bool SetCommand(const wxString& cmd, bool SetCommand(const wxString& cmd,
const wxString& verb, const wxString& verb,
bool overwriteprompt = TRUE); bool overwriteprompt = true);
bool SetDefaultIcon(const wxString& cmd = wxEmptyString, int index = 0); bool SetDefaultIcon(const wxString& cmd = wxEmptyString, int index = 0);
@@ -76,7 +76,7 @@ private:
wxString GetVerbPath(const wxString& verb) const; wxString GetVerbPath(const wxString& verb) const;
// check that the registry key for our extension exists, create it if it // check that the registry key for our extension exists, create it if it
// doesn't, return FALSE if this failed // doesn't, return false if this failed
bool EnsureExtKeyExists(); bool EnsureExtKeyExists();
wxString m_strFileType, // may be empty wxString m_strFileType, // may be empty
@@ -107,10 +107,10 @@ public:
size_t EnumAllFileTypes(wxArrayString& mimetypes); size_t EnumAllFileTypes(wxArrayString& mimetypes);
// this are NOPs under Windows // this are NOPs under Windows
bool ReadMailcap(const wxString& WXUNUSED(filename), bool WXUNUSED(fallback) = TRUE) bool ReadMailcap(const wxString& WXUNUSED(filename), bool WXUNUSED(fallback) = true)
{ return TRUE; } { return true; }
bool ReadMimeTypes(const wxString& WXUNUSED(filename)) bool ReadMimeTypes(const wxString& WXUNUSED(filename))
{ return TRUE; } { return true; }
// create a new filetype association // create a new filetype association
wxFileType *Associate(const wxFileTypeInfo& ftInfo); wxFileType *Associate(const wxFileTypeInfo& ftInfo);

View File

@@ -17,7 +17,7 @@
#include "wx/wxchar.h" #include "wx/wxchar.h"
#if !wxUSE_UNICODE_MSLU #if !wxUSE_UNICODE_MSLU
inline bool wxUsingUnicowsDll() { return FALSE; } inline bool wxUsingUnicowsDll() { return false; }
#else #else
// Returns true if we are running under Unicode emulation in Win9x environment. // Returns true if we are running under Unicode emulation in Win9x environment.

View File

@@ -513,11 +513,11 @@ bool wxJoystick::HasRudder() const
#if defined(__WIN32__) #if defined(__WIN32__)
JOYCAPS joyCaps; JOYCAPS joyCaps;
if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR)
return FALSE; return false;
else else
return ((joyCaps.wCaps & JOYCAPS_HASR) == JOYCAPS_HASR); return ((joyCaps.wCaps & JOYCAPS_HASR) == JOYCAPS_HASR);
#else #else
return FALSE; return false;
#endif #endif
} }
@@ -526,11 +526,11 @@ bool wxJoystick::HasZ() const
#if defined(__WIN32__) #if defined(__WIN32__)
JOYCAPS joyCaps; JOYCAPS joyCaps;
if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR)
return FALSE; return false;
else else
return ((joyCaps.wCaps & JOYCAPS_HASZ) == JOYCAPS_HASZ); return ((joyCaps.wCaps & JOYCAPS_HASZ) == JOYCAPS_HASZ);
#else #else
return FALSE; return false;
#endif #endif
} }
@@ -539,11 +539,11 @@ bool wxJoystick::HasU() const
#if defined(__WIN32__) #if defined(__WIN32__)
JOYCAPS joyCaps; JOYCAPS joyCaps;
if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR)
return FALSE; return false;
else else
return ((joyCaps.wCaps & JOYCAPS_HASU) == JOYCAPS_HASU); return ((joyCaps.wCaps & JOYCAPS_HASU) == JOYCAPS_HASU);
#else #else
return FALSE; return false;
#endif #endif
} }
@@ -552,11 +552,11 @@ bool wxJoystick::HasV() const
#if defined(__WIN32__) #if defined(__WIN32__)
JOYCAPS joyCaps; JOYCAPS joyCaps;
if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR)
return FALSE; return false;
else else
return ((joyCaps.wCaps & JOYCAPS_HASV) == JOYCAPS_HASV); return ((joyCaps.wCaps & JOYCAPS_HASV) == JOYCAPS_HASV);
#else #else
return FALSE; return false;
#endif #endif
} }
@@ -565,11 +565,11 @@ bool wxJoystick::HasPOV() const
#if defined(__WIN32__) #if defined(__WIN32__)
JOYCAPS joyCaps; JOYCAPS joyCaps;
if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR)
return FALSE; return false;
else else
return ((joyCaps.wCaps & JOYCAPS_HASPOV) == JOYCAPS_HASPOV); return ((joyCaps.wCaps & JOYCAPS_HASPOV) == JOYCAPS_HASPOV);
#else #else
return FALSE; return false;
#endif #endif
} }
@@ -578,11 +578,11 @@ bool wxJoystick::HasPOV4Dir() const
#if defined(__WIN32__) #if defined(__WIN32__)
JOYCAPS joyCaps; JOYCAPS joyCaps;
if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR)
return FALSE; return false;
else else
return ((joyCaps.wCaps & JOYCAPS_POV4DIR) == JOYCAPS_POV4DIR); return ((joyCaps.wCaps & JOYCAPS_POV4DIR) == JOYCAPS_POV4DIR);
#else #else
return FALSE; return false;
#endif #endif
} }
@@ -591,11 +591,11 @@ bool wxJoystick::HasPOVCTS() const
#if defined(__WIN32__) #if defined(__WIN32__)
JOYCAPS joyCaps; JOYCAPS joyCaps;
if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR)
return FALSE; return false;
else else
return ((joyCaps.wCaps & JOYCAPS_POVCTS) == JOYCAPS_POVCTS); return ((joyCaps.wCaps & JOYCAPS_POVCTS) == JOYCAPS_POVCTS);
#else #else
return FALSE; return false;
#endif #endif
} }

View File

@@ -127,7 +127,7 @@ public:
wxListBoxItem(const wxString& str = wxEmptyString); wxListBoxItem(const wxString& str = wxEmptyString);
}; };
wxListBoxItem::wxListBoxItem(const wxString& str) : wxOwnerDrawn(str, FALSE) wxListBoxItem::wxListBoxItem(const wxString& str) : wxOwnerDrawn(str, false)
{ {
// no bitmaps/checkmarks // no bitmaps/checkmarks
SetMarginWidth(0); SetMarginWidth(0);
@@ -408,10 +408,10 @@ void wxListBox::SetSelection(int N, bool select)
bool wxListBox::IsSelected(int N) const bool wxListBox::IsSelected(int N) const
{ {
wxCHECK_MSG( N >= 0 && N < m_noItems, FALSE, wxCHECK_MSG( N >= 0 && N < m_noItems, false,
wxT("invalid index in wxListBox::Selected") ); wxT("invalid index in wxListBox::Selected") );
return SendMessage(GetHwnd(), LB_GETSEL, N, 0) == 0 ? FALSE : TRUE; return SendMessage(GetHwnd(), LB_GETSEL, N, 0) == 0 ? false : true;
} }
wxClientData* wxListBox::DoGetItemClientObject(int n) const wxClientData* wxListBox::DoGetItemClientObject(int n) const
@@ -716,7 +716,7 @@ bool wxListBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
else else
{ {
// some event we're not interested in // some event we're not interested in
return FALSE; return false;
} }
wxCommandEvent event(evtType, m_windowId); wxCommandEvent event(evtType, m_windowId);
@@ -732,7 +732,7 @@ bool wxListBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
event.SetClientData( GetClientData(n) ); event.SetClientData( GetClientData(n) );
event.SetString( GetString(n) ); event.SetString( GetString(n) );
event.SetExtraLong( HasMultipleSelection() ? IsSelected(n) : TRUE ); event.SetExtraLong( HasMultipleSelection() ? IsSelected(n) : true );
} }
event.m_commandInt = n; event.m_commandInt = n;
@@ -761,7 +761,7 @@ bool wxListBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
bool wxListBox::MSWOnMeasure(WXMEASUREITEMSTRUCT *item) bool wxListBox::MSWOnMeasure(WXMEASUREITEMSTRUCT *item)
{ {
// only owner-drawn control should receive this message // only owner-drawn control should receive this message
wxCHECK( ((m_windowStyle & wxLB_OWNERDRAW) == wxLB_OWNERDRAW), FALSE ); wxCHECK( ((m_windowStyle & wxLB_OWNERDRAW) == wxLB_OWNERDRAW), false );
MEASUREITEMSTRUCT *pStruct = (MEASUREITEMSTRUCT *)item; MEASUREITEMSTRUCT *pStruct = (MEASUREITEMSTRUCT *)item;
@@ -782,25 +782,25 @@ bool wxListBox::MSWOnMeasure(WXMEASUREITEMSTRUCT *item)
DeleteDC(hdc); DeleteDC(hdc);
return TRUE; return true;
} }
// forward the message to the appropriate item // forward the message to the appropriate item
bool wxListBox::MSWOnDraw(WXDRAWITEMSTRUCT *item) bool wxListBox::MSWOnDraw(WXDRAWITEMSTRUCT *item)
{ {
// only owner-drawn control should receive this message // only owner-drawn control should receive this message
wxCHECK( ((m_windowStyle & wxLB_OWNERDRAW) == wxLB_OWNERDRAW), FALSE ); wxCHECK( ((m_windowStyle & wxLB_OWNERDRAW) == wxLB_OWNERDRAW), false );
DRAWITEMSTRUCT *pStruct = (DRAWITEMSTRUCT *)item; DRAWITEMSTRUCT *pStruct = (DRAWITEMSTRUCT *)item;
UINT itemID = pStruct->itemID; UINT itemID = pStruct->itemID;
// the item may be -1 for an empty listbox // the item may be -1 for an empty listbox
if ( itemID == (UINT)-1 ) if ( itemID == (UINT)-1 )
return FALSE; return false;
long data = ListBox_GetItemData(GetHwnd(), pStruct->itemID); long data = ListBox_GetItemData(GetHwnd(), pStruct->itemID);
wxCHECK( data && (data != LB_ERR), FALSE ); wxCHECK( data && (data != LB_ERR), false );
wxListBoxItem *pItem = (wxListBoxItem *)data; wxListBoxItem *pItem = (wxListBoxItem *)data;

View File

@@ -328,13 +328,13 @@ void wxListCtrl::Init()
m_imageListNormal = NULL; m_imageListNormal = NULL;
m_imageListSmall = NULL; m_imageListSmall = NULL;
m_imageListState = NULL; m_imageListState = NULL;
m_ownsImageListNormal = m_ownsImageListSmall = m_ownsImageListState = FALSE; m_ownsImageListNormal = m_ownsImageListSmall = m_ownsImageListState = false;
m_colCount = 0; m_colCount = 0;
m_count = 0; m_count = 0;
m_ignoreChangeMessages = FALSE; m_ignoreChangeMessages = false;
m_textCtrl = NULL; m_textCtrl = NULL;
m_AnyInternalData = FALSE; m_AnyInternalData = false;
m_hasAnyAttr = FALSE; m_hasAnyAttr = false;
} }
bool wxListCtrl::Create(wxWindow *parent, bool wxListCtrl::Create(wxWindow *parent,
@@ -346,10 +346,10 @@ bool wxListCtrl::Create(wxWindow *parent,
const wxString& name) const wxString& name)
{ {
if ( !CreateControl(parent, id, pos, size, style, validator, name) ) if ( !CreateControl(parent, id, pos, size, style, validator, name) )
return FALSE; return false;
if ( !MSWCreateControl(WC_LISTVIEW, _T(""), pos, size) ) if ( !MSWCreateControl(WC_LISTVIEW, _T(""), pos, size) )
return FALSE; return false;
// explicitly say that we want to use Unicode because otherwise we get ANSI // explicitly say that we want to use Unicode because otherwise we get ANSI
// versions of _some_ messages (notably LVN_GETDISPINFOA) in MSLU build // versions of _some_ messages (notably LVN_GETDISPINFOA) in MSLU build
@@ -363,7 +363,7 @@ bool wxListCtrl::Create(wxWindow *parent,
0, LVS_EX_FULLROWSELECT); 0, LVS_EX_FULLROWSELECT);
} }
return TRUE; return true;
} }
WXDWORD wxListCtrl::MSWGetStyle(long style, WXDWORD *exstyle) const WXDWORD wxListCtrl::MSWGetStyle(long style, WXDWORD *exstyle) const
@@ -464,12 +464,12 @@ void wxListCtrl::FreeAllInternalData()
{ {
int n = GetItemCount(); int n = GetItemCount();
m_ignoreChangeMessages = TRUE; m_ignoreChangeMessages = true;
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
wxDeleteInternalData(this, i); wxDeleteInternalData(this, i);
m_ignoreChangeMessages = FALSE; m_ignoreChangeMessages = false;
m_AnyInternalData = FALSE; m_AnyInternalData = false;
} }
} }
@@ -555,18 +555,18 @@ wxListCtrl::GetClassDefaultAttributes(wxWindowVariant variant)
bool wxListCtrl::SetForegroundColour(const wxColour& col) bool wxListCtrl::SetForegroundColour(const wxColour& col)
{ {
if ( !wxWindow::SetForegroundColour(col) ) if ( !wxWindow::SetForegroundColour(col) )
return FALSE; return false;
ListView_SetTextColor(GetHwnd(), wxColourToRGB(col)); ListView_SetTextColor(GetHwnd(), wxColourToRGB(col));
return TRUE; return true;
} }
// Sets the background colour // Sets the background colour
bool wxListCtrl::SetBackgroundColour(const wxColour& col) bool wxListCtrl::SetBackgroundColour(const wxColour& col)
{ {
if ( !wxWindow::SetBackgroundColour(col) ) if ( !wxWindow::SetBackgroundColour(col) )
return FALSE; return false;
// we set the same colour for both the "empty" background and the items // we set the same colour for both the "empty" background and the items
// background // background
@@ -574,7 +574,7 @@ bool wxListCtrl::SetBackgroundColour(const wxColour& col)
ListView_SetBkColor(GetHwnd(), color); ListView_SetBkColor(GetHwnd(), color);
ListView_SetTextBkColor(GetHwnd(), color); ListView_SetTextBkColor(GetHwnd(), color);
return TRUE; return true;
} }
// Gets information about this column // Gets information about this column
@@ -762,7 +762,7 @@ bool wxListCtrl::SetItem(wxListItem& info)
if (! data) if (! data)
{ {
// need to set it // need to set it
m_AnyInternalData = TRUE; m_AnyInternalData = true;
data = new wxListItemInternalData(); data = new wxListItemInternalData();
item.lParam = (LPARAM) data; item.lParam = (LPARAM) data;
item.mask |= LVIF_PARAM; item.mask |= LVIF_PARAM;
@@ -793,7 +793,7 @@ bool wxListCtrl::SetItem(wxListItem& info)
{ {
wxLogDebug(_T("ListView_SetItem() failed")); wxLogDebug(_T("ListView_SetItem() failed"));
return FALSE; return false;
} }
} }
@@ -803,10 +803,10 @@ bool wxListCtrl::SetItem(wxListItem& info)
// check whether it has any custom attributes // check whether it has any custom attributes
if ( info.HasAttributes() ) if ( info.HasAttributes() )
{ {
m_hasAnyAttr = TRUE; m_hasAnyAttr = true;
// if the colour has changed, we must redraw the item // if the colour has changed, we must redraw the item
updateNow = TRUE; updateNow = true;
} }
if ( updateNow ) if ( updateNow )
@@ -815,7 +815,7 @@ bool wxListCtrl::SetItem(wxListItem& info)
RefreshItem(item.iItem); RefreshItem(item.iItem);
} }
return TRUE; return true;
} }
long wxListCtrl::SetItem(long index, int col, const wxString& label, int imageId) long wxListCtrl::SetItem(long index, int col, const wxString& label, int imageId)
@@ -880,7 +880,7 @@ bool wxListCtrl::SetItemState(long item, long state, long stateMask)
{ {
wxLogLastError(_T("ListView_SetItemState")); wxLogLastError(_T("ListView_SetItemState"));
return FALSE; return false;
} }
if ( focusOld != -1 ) if ( focusOld != -1 )
@@ -894,7 +894,7 @@ bool wxListCtrl::SetItemState(long item, long state, long stateMask)
} }
} }
return TRUE; return true;
} }
// Sets the item image // Sets the item image
@@ -1166,21 +1166,21 @@ void wxListCtrl::SetImageList(wxImageList *imageList, int which)
flags = LVSIL_NORMAL; flags = LVSIL_NORMAL;
if (m_ownsImageListNormal) delete m_imageListNormal; if (m_ownsImageListNormal) delete m_imageListNormal;
m_imageListNormal = imageList; m_imageListNormal = imageList;
m_ownsImageListNormal = FALSE; m_ownsImageListNormal = false;
} }
else if ( which == wxIMAGE_LIST_SMALL ) else if ( which == wxIMAGE_LIST_SMALL )
{ {
flags = LVSIL_SMALL; flags = LVSIL_SMALL;
if (m_ownsImageListSmall) delete m_imageListSmall; if (m_ownsImageListSmall) delete m_imageListSmall;
m_imageListSmall = imageList; m_imageListSmall = imageList;
m_ownsImageListSmall = FALSE; m_ownsImageListSmall = false;
} }
else if ( which == wxIMAGE_LIST_STATE ) else if ( which == wxIMAGE_LIST_STATE )
{ {
flags = LVSIL_STATE; flags = LVSIL_STATE;
if (m_ownsImageListState) delete m_imageListState; if (m_ownsImageListState) delete m_imageListState;
m_imageListState = imageList; m_imageListState = imageList;
m_ownsImageListState = FALSE; m_ownsImageListState = false;
} }
ListView_SetImageList(GetHwnd(), (HIMAGELIST) imageList ? imageList->GetHIMAGELIST() : 0, flags); ListView_SetImageList(GetHwnd(), (HIMAGELIST) imageList ? imageList->GetHIMAGELIST() : 0, flags);
} }
@@ -1189,11 +1189,11 @@ void wxListCtrl::AssignImageList(wxImageList *imageList, int which)
{ {
SetImageList(imageList, which); SetImageList(imageList, which);
if ( which == wxIMAGE_LIST_NORMAL ) if ( which == wxIMAGE_LIST_NORMAL )
m_ownsImageListNormal = TRUE; m_ownsImageListNormal = true;
else if ( which == wxIMAGE_LIST_SMALL ) else if ( which == wxIMAGE_LIST_SMALL )
m_ownsImageListSmall = TRUE; m_ownsImageListSmall = true;
else if ( which == wxIMAGE_LIST_STATE ) else if ( which == wxIMAGE_LIST_STATE )
m_ownsImageListState = TRUE; m_ownsImageListState = true;
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -1222,7 +1222,7 @@ bool wxListCtrl::DeleteItem(long item)
if ( !ListView_DeleteItem(GetHwnd(), (int) item) ) if ( !ListView_DeleteItem(GetHwnd(), (int) item) )
{ {
wxLogLastError(_T("ListView_DeleteItem")); wxLogLastError(_T("ListView_DeleteItem"));
return FALSE; return false;
} }
m_count -= 1; m_count -= 1;
@@ -1251,7 +1251,7 @@ bool wxListCtrl::DeleteItem(long item)
RefreshRect(rectWin); RefreshRect(rectWin);
} }
return TRUE; return true;
} }
// Deletes all items // Deletes all items
@@ -1270,7 +1270,7 @@ bool wxListCtrl::DeleteAllColumns()
{ {
wxLogLastError(wxT("ListView_DeleteColumn")); wxLogLastError(wxT("ListView_DeleteColumn"));
return FALSE; return false;
} }
m_colCount--; m_colCount--;
@@ -1278,7 +1278,7 @@ bool wxListCtrl::DeleteAllColumns()
wxASSERT_MSG( m_colCount == 0, wxT("no columns should be left") ); wxASSERT_MSG( m_colCount == 0, wxT("no columns should be left") );
return TRUE; return true;
} }
// Deletes a column // Deletes a column
@@ -1340,13 +1340,13 @@ bool wxListCtrl::EndEditLabel(bool WXUNUSED(cancel))
{ {
wxFAIL_MSG( _T("not implemented") ); wxFAIL_MSG( _T("not implemented") );
return FALSE; return false;
} }
// Ensures this item is visible // Ensures this item is visible
bool wxListCtrl::EnsureVisible(long item) bool wxListCtrl::EnsureVisible(long item)
{ {
return ListView_EnsureVisible(GetHwnd(), (int) item, FALSE) != 0; return ListView_EnsureVisible(GetHwnd(), (int) item, FALSE) != FALSE;
} }
// Find an item whose label matches this string, starting from the item after 'start' // Find an item whose label matches this string, starting from the item after 'start'
@@ -1456,7 +1456,7 @@ long wxListCtrl::InsertItem(wxListItem& info)
bool needInternalData = ((info.m_mask & wxLIST_MASK_DATA) || info.HasAttributes()); bool needInternalData = ((info.m_mask & wxLIST_MASK_DATA) || info.HasAttributes());
if (needInternalData) if (needInternalData)
{ {
m_AnyInternalData = TRUE; m_AnyInternalData = true;
item.mask |= LVIF_PARAM; item.mask |= LVIF_PARAM;
// internal stucture that manages data // internal stucture that manages data
@@ -1473,7 +1473,7 @@ long wxListCtrl::InsertItem(wxListItem& info)
data->attr = new wxListItemAttr(*info.GetAttributes()); data->attr = new wxListItemAttr(*info.GetAttributes());
// and remember that we have some now... // and remember that we have some now...
m_hasAnyAttr = TRUE; m_hasAnyAttr = true;
} }
}; };
@@ -1570,10 +1570,10 @@ bool wxListCtrl::ScrollList(int dx, int dy)
{ {
wxLogDebug(_T("ListView_Scroll(%d, %d) failed"), dx, dy); wxLogDebug(_T("ListView_Scroll(%d, %d) failed"), dx, dy);
return FALSE; return false;
} }
return TRUE; return true;
} }
// Sort items. // Sort items.
@@ -1625,10 +1625,10 @@ bool wxListCtrl::SortItems(wxListCtrlCompare fn, long data)
{ {
wxLogDebug(_T("ListView_SortItems() failed")); wxLogDebug(_T("ListView_SortItems() failed"));
return FALSE; return false;
} }
return TRUE; return true;
} }
@@ -1644,17 +1644,17 @@ bool wxListCtrl::MSWCommand(WXUINT cmd, WXWORD id)
wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, id); wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, id);
event.SetEventObject( this ); event.SetEventObject( this );
ProcessCommand(event); ProcessCommand(event);
return TRUE; return true;
} }
else if (cmd == EN_KILLFOCUS) else if (cmd == EN_KILLFOCUS)
{ {
wxCommandEvent event(wxEVT_KILL_FOCUS, id); wxCommandEvent event(wxEVT_KILL_FOCUS, id);
event.SetEventObject( this ); event.SetEventObject( this );
ProcessCommand(event); ProcessCommand(event);
return TRUE; return true;
} }
else else
return FALSE; return false;
} }
bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
@@ -1774,13 +1774,13 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
// This is a fix for a strange bug under XP. // This is a fix for a strange bug under XP.
// Normally, info->iItem is a valid index, but // Normally, info->iItem is a valid index, but
// sometimes this is a silly (large) number // sometimes this is a silly (large) number
// and when we return FALSE via wxControl::MSWOnNotify // and when we return false via wxControl::MSWOnNotify
// to indicate that it hasn't yet been processed, // to indicate that it hasn't yet been processed,
// there's a GPF in Windows. // there's a GPF in Windows.
// By returning TRUE here, we avoid further processing // By returning true here, we avoid further processing
// of this strange message. // of this strange message.
if ( (unsigned)info->iItem >= (unsigned)GetColumnCount() ) if ( (unsigned)info->iItem >= (unsigned)GetColumnCount() )
return TRUE; return true;
} }
// fall through // fall through
@@ -1804,7 +1804,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
if ( m_ignoreChangeMessages && if ( m_ignoreChangeMessages &&
( (nmLV->hdr.code == LVN_ITEMCHANGED) || (nmLV->hdr.code == LVN_ITEMCHANGING))) ( (nmLV->hdr.code == LVN_ITEMCHANGED) || (nmLV->hdr.code == LVN_ITEMCHANGING)))
{ {
return TRUE; return true;
} }
@@ -1912,7 +1912,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
if (m_count == 0) if (m_count == 0)
// this should be prevented by the post-processing code below, // this should be prevented by the post-processing code below,
// but "just in case" // but "just in case"
return FALSE; return false;
eventType = wxEVT_COMMAND_LIST_DELETE_ITEM; eventType = wxEVT_COMMAND_LIST_DELETE_ITEM;
event.m_itemIndex = iItem; event.m_itemIndex = iItem;
@@ -1985,7 +1985,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
if ( eventType == wxEVT_NULL ) if ( eventType == wxEVT_NULL )
{ {
// not an interesting event for us // not an interesting event for us
return FALSE; return false;
} }
break; break;
@@ -2036,7 +2036,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
// anything else // anything else
if ( wxControl::MSWOnNotify(idCtrl, lParam, result) ) if ( wxControl::MSWOnNotify(idCtrl, lParam, result) )
{ {
return TRUE; return true;
} }
// else translate it into wxEVT_COMMAND_LIST_ITEM_ACTIVATED event // else translate it into wxEVT_COMMAND_LIST_ITEM_ACTIVATED event
@@ -2044,7 +2044,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
if ( iItem == -1 ) if ( iItem == -1 )
{ {
// not on item // not on item
return FALSE; return false;
} }
eventType = wxEVT_COMMAND_LIST_ITEM_ACTIVATED; eventType = wxEVT_COMMAND_LIST_ITEM_ACTIVATED;
@@ -2061,7 +2061,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
// don't do anything else // don't do anything else
if ( wxControl::MSWOnNotify(idCtrl, lParam, result) ) if ( wxControl::MSWOnNotify(idCtrl, lParam, result) )
{ {
return TRUE; return true;
} }
// else translate it into wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK event // else translate it into wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK event
@@ -2091,7 +2091,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
case NM_CUSTOMDRAW: case NM_CUSTOMDRAW:
*result = OnCustomDraw(lParam); *result = OnCustomDraw(lParam);
return TRUE; return true;
#endif // _WIN32_IE >= 0x300 #endif // _WIN32_IE >= 0x300
case LVN_ODCACHEHINT: case LVN_ODCACHEHINT:
@@ -2105,7 +2105,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
// deleting an item, for items in invalid range -- filter // deleting an item, for items in invalid range -- filter
// this garbage out // this garbage out
if ( cacheHint->iFrom > cacheHint->iTo ) if ( cacheHint->iFrom > cacheHint->iTo )
return FALSE; return false;
event.m_oldItemIndex = cacheHint->iFrom; event.m_oldItemIndex = cacheHint->iFrom;
@@ -2142,7 +2142,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
wxASSERT_MSG( !(lvi.mask & LVIF_STATE), wxASSERT_MSG( !(lvi.mask & LVIF_STATE),
_T("we don't support state callbacks yet!") ); _T("we don't support state callbacks yet!") );
return TRUE; return true;
} }
// fall through // fall through
@@ -2153,7 +2153,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
else else
{ {
// where did this one come from? // where did this one come from?
return FALSE; return false;
} }
// process the event // process the event
@@ -2168,11 +2168,11 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
switch ( nmhdr->code ) switch ( nmhdr->code )
{ {
case LVN_DELETEALLITEMS: case LVN_DELETEALLITEMS:
// always return TRUE to suppress all additional LVN_DELETEITEM // always return true to suppress all additional LVN_DELETEITEM
// notifications - this makes deleting all items from a list ctrl // notifications - this makes deleting all items from a list ctrl
// much faster // much faster
*result = TRUE; *result = TRUE;
return TRUE; return true;
case LVN_ENDLABELEDITA: case LVN_ENDLABELEDITA:
case LVN_ENDLABELEDITW: case LVN_ENDLABELEDITW:
@@ -2190,7 +2190,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
m_textCtrl = NULL; m_textCtrl = NULL;
} }
return TRUE; return true;
} }
if ( processed ) if ( processed )
@@ -2493,13 +2493,13 @@ static void wxConvertFromMSWListItem(HWND hwndListCtrl,
long oldMask = lvItem.mask; long oldMask = lvItem.mask;
bool needText = FALSE; bool needText = false;
if (hwndListCtrl != 0) if (hwndListCtrl != 0)
{ {
if ( lvItem.mask & LVIF_TEXT ) if ( lvItem.mask & LVIF_TEXT )
needText = FALSE; needText = false;
else else
needText = TRUE; needText = true;
if ( needText ) if ( needText )
{ {

View File

@@ -203,7 +203,7 @@ bool wxMDIParentFrame::Create(wxWindow *parent,
if ( parent ) if ( parent )
parent->AddChild(this); parent->AddChild(this);
if ( id > -1 ) if ( id != wxID_ANY )
m_windowId = id; m_windowId = id;
else else
m_windowId = NewControlId(); m_windowId = NewControlId();
@@ -655,7 +655,7 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
SetName(name); SetName(name);
wxWindowBase::Show(true); // MDI child frame starts off shown wxWindowBase::Show(true); // MDI child frame starts off shown
if ( id > -1 ) if ( id != wxID_ANY )
m_windowId = id; m_windowId = id;
else else
m_windowId = (int)NewControlId(); m_windowId = (int)NewControlId();
@@ -677,22 +677,22 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
: wxMDIChildFrameClassNameNoRedraw; : wxMDIChildFrameClassNameNoRedraw;
mcs.szTitle = title; mcs.szTitle = title;
mcs.hOwner = wxGetInstance(); mcs.hOwner = wxGetInstance();
if (x > -1) if (x != wxDefaultCoord)
mcs.x = x; mcs.x = x;
else else
mcs.x = CW_USEDEFAULT; mcs.x = CW_USEDEFAULT;
if (y > -1) if (y != wxDefaultCoord)
mcs.y = y; mcs.y = y;
else else
mcs.y = CW_USEDEFAULT; mcs.y = CW_USEDEFAULT;
if (width > -1) if (width != wxDefaultCoord)
mcs.cx = width; mcs.cx = width;
else else
mcs.cx = CW_USEDEFAULT; mcs.cx = CW_USEDEFAULT;
if (height > -1) if (height != wxDefaultCoord)
mcs.cy = height; mcs.cy = height;
else else
mcs.cy = CW_USEDEFAULT; mcs.cy = CW_USEDEFAULT;

View File

@@ -106,7 +106,7 @@ UINT GetMenuState(HMENU hMenu, UINT id, UINT flags)
wxZeroMemory(info); wxZeroMemory(info);
info.cbSize = sizeof(info); info.cbSize = sizeof(info);
info.fMask = MIIM_STATE; info.fMask = MIIM_STATE;
if ( !GetMenuItemInfo(hMenu, id, flags & MF_BYCOMMAND ? FALSE : TRUE, & info) ) if ( !::GetMenuItemInfo(hMenu, id, flags & MF_BYCOMMAND ? FALSE : TRUE, & info) )
wxLogLastError(wxT("GetMenuItemInfo")); wxLogLastError(wxT("GetMenuItemInfo"));
return info.fState; return info.fState;
} }
@@ -217,7 +217,7 @@ const wxMenuInfoList& wxMenuBar::GetMenuInfos() const
// Construct a menu with optional title (then use append) // Construct a menu with optional title (then use append)
void wxMenu::Init() void wxMenu::Init()
{ {
m_doBreak = FALSE; m_doBreak = false;
m_startRadioGroup = -1; m_startRadioGroup = -1;
// create the menu // create the menu
@@ -228,7 +228,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, m_title); Append(idMenuTitle, m_title);
AppendSeparator(); AppendSeparator();
@@ -258,7 +258,7 @@ wxMenu::~wxMenu()
void wxMenu::Break() void wxMenu::Break()
{ {
// this will take effect during the next call to Append() // this will take effect during the next call to Append()
m_doBreak = TRUE; m_doBreak = true;
} }
void wxMenu::Attach(wxMenuBarBase *menubar) void wxMenu::Attach(wxMenuBarBase *menubar)
@@ -345,7 +345,7 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
// (and don't forget to reset the flag) // (and don't forget to reset the flag)
if ( m_doBreak ) { if ( m_doBreak ) {
flags |= MF_MENUBREAK; flags |= MF_MENUBREAK;
m_doBreak = FALSE; m_doBreak = false;
} }
if ( pItem->IsSeparator() ) { if ( pItem->IsSeparator() ) {
@@ -409,7 +409,7 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
{ {
wxLogLastError(wxT("Insert or AppendMenu")); wxLogLastError(wxT("Insert or AppendMenu"));
return FALSE; return false;
} }
// if we just appended the title, highlight it // if we just appended the title, highlight it
@@ -427,7 +427,7 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
GetMenuBar()->Refresh(); GetMenuBar()->Refresh();
} }
return TRUE; return true;
} }
void wxMenu::EndRadioGroup() void wxMenu::EndRadioGroup()
@@ -440,7 +440,7 @@ wxMenuItem* wxMenu::DoAppend(wxMenuItem *item)
{ {
wxCHECK_MSG( item, NULL, _T("NULL item in wxMenu::DoAppend") ); wxCHECK_MSG( item, NULL, _T("NULL item in wxMenu::DoAppend") );
bool check = FALSE; bool check = false;
if ( item->GetKind() == wxITEM_RADIO ) if ( item->GetKind() == wxITEM_RADIO )
{ {
@@ -456,7 +456,7 @@ wxMenuItem* wxMenu::DoAppend(wxMenuItem *item)
item->SetRadioGroupEnd(m_startRadioGroup); item->SetRadioGroupEnd(m_startRadioGroup);
// ensure that we have a checked item in the radio group // ensure that we have a checked item in the radio group
check = TRUE; check = true;
} }
else // extend the current radio group else // extend the current radio group
{ {
@@ -487,7 +487,7 @@ wxMenuItem* wxMenu::DoAppend(wxMenuItem *item)
if ( check ) if ( check )
{ {
// check the item initially // check the item initially
item->Check(TRUE); item->Check(true);
} }
return item; return item;
@@ -654,7 +654,7 @@ bool wxMenu::MSWCommand(WXUINT WXUNUSED(param), WXWORD id)
SendEvent(id, menuState & MF_CHECKED); SendEvent(id, menuState & MF_CHECKED);
} }
return TRUE; return true;
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -996,7 +996,7 @@ bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title)
: MSWPositionForWxMenu(GetMenu(pos),pos); : MSWPositionForWxMenu(GetMenu(pos),pos);
if ( !wxMenuBarBase::Insert(pos, menu, title) ) if ( !wxMenuBarBase::Insert(pos, menu, title) )
return FALSE; return false;
m_titles.Insert(title, pos); m_titles.Insert(title, pos);
@@ -1004,7 +1004,7 @@ bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title)
{ {
#if defined(WINCE_WITHOUT_COMMANDAR) #if defined(WINCE_WITHOUT_COMMANDAR)
if (!GetToolBar()) if (!GetToolBar())
return FALSE; return false;
TBBUTTON tbButton; TBBUTTON tbButton;
memset(&tbButton, 0, sizeof(TBBUTTON)); memset(&tbButton, 0, sizeof(TBBUTTON));
tbButton.iBitmap = I_IMAGENONE; tbButton.iBitmap = I_IMAGENONE;
@@ -1020,7 +1020,7 @@ bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title)
if (!::SendMessage((HWND) GetToolBar()->GetHWND(), TB_INSERTBUTTON, pos, (LPARAM)&tbButton)) if (!::SendMessage((HWND) GetToolBar()->GetHWND(), TB_INSERTBUTTON, pos, (LPARAM)&tbButton))
{ {
wxLogLastError(wxT("TB_INSERTBUTTON")); wxLogLastError(wxT("TB_INSERTBUTTON"));
return FALSE; return false;
} }
#else #else
if ( !::InsertMenu(GetHmenu(), mswpos, if ( !::InsertMenu(GetHmenu(), mswpos,
@@ -1041,16 +1041,16 @@ bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title)
Refresh(); Refresh();
} }
return TRUE; return true;
} }
bool wxMenuBar::Append(wxMenu *menu, const wxString& title) bool wxMenuBar::Append(wxMenu *menu, const wxString& title)
{ {
WXHMENU submenu = menu ? menu->GetHMenu() : 0; WXHMENU submenu = menu ? menu->GetHMenu() : 0;
wxCHECK_MSG( submenu, FALSE, wxT("can't append invalid menu to menubar") ); wxCHECK_MSG( submenu, false, wxT("can't append invalid menu to menubar") );
if ( !wxMenuBarBase::Append(menu, title) ) if ( !wxMenuBarBase::Append(menu, title) )
return FALSE; return false;
m_titles.Add(title); m_titles.Add(title);
@@ -1058,7 +1058,7 @@ bool wxMenuBar::Append(wxMenu *menu, const wxString& title)
{ {
#if defined(WINCE_WITHOUT_COMMANDAR) #if defined(WINCE_WITHOUT_COMMANDAR)
if (!GetToolBar()) if (!GetToolBar())
return FALSE; return false;
TBBUTTON tbButton; TBBUTTON tbButton;
memset(&tbButton, 0, sizeof(TBBUTTON)); memset(&tbButton, 0, sizeof(TBBUTTON));
tbButton.iBitmap = I_IMAGENONE; tbButton.iBitmap = I_IMAGENONE;
@@ -1075,7 +1075,7 @@ bool wxMenuBar::Append(wxMenu *menu, const wxString& title)
if (!::SendMessage((HWND) GetToolBar()->GetHWND(), TB_INSERTBUTTON, pos, (LPARAM)&tbButton)) if (!::SendMessage((HWND) GetToolBar()->GetHWND(), TB_INSERTBUTTON, pos, (LPARAM)&tbButton))
{ {
wxLogLastError(wxT("TB_INSERTBUTTON")); wxLogLastError(wxT("TB_INSERTBUTTON"));
return FALSE; return false;
} }
#else #else
if ( !::AppendMenu(GetHmenu(), MF_POPUP | MF_STRING, if ( !::AppendMenu(GetHmenu(), MF_POPUP | MF_STRING,
@@ -1096,7 +1096,7 @@ bool wxMenuBar::Append(wxMenu *menu, const wxString& title)
Refresh(); Refresh();
} }
return TRUE; return true;
} }
wxMenu *wxMenuBar::Remove(size_t pos) wxMenu *wxMenuBar::Remove(size_t pos)

View File

@@ -159,7 +159,7 @@ wxMenuItem::wxMenuItem(wxMenu *parentMenu,
void wxMenuItem::Init() void wxMenuItem::Init()
{ {
m_radioGroup.start = -1; m_radioGroup.start = -1;
m_isRadioGroupStart = FALSE; m_isRadioGroupStart = false;
#if wxUSE_OWNER_DRAWN #if wxUSE_OWNER_DRAWN
// set default menu colors // set default menu colors
@@ -217,7 +217,7 @@ wxString wxMenuItemBase::GetLabelFromText(const wxString& text)
void wxMenuItem::SetAsRadioGroupStart() void wxMenuItem::SetAsRadioGroupStart()
{ {
m_isRadioGroupStart = TRUE; m_isRadioGroupStart = true;
} }
void wxMenuItem::SetRadioGroupStart(int start) void wxMenuItem::SetRadioGroupStart(int start)
@@ -318,7 +318,7 @@ void wxMenuItem::Check(bool check)
{ {
if ( n != pos ) if ( n != pos )
{ {
node->GetData()->m_isChecked = FALSE; node->GetData()->m_isChecked = false;
} }
node = node->GetNext(); node = node->GetNext();
@@ -401,7 +401,7 @@ void wxMenuItem::SetText(const wxString& text)
info.fType = MFT_STRING; info.fType = MFT_STRING;
info.cch = text.Length(); info.cch = text.Length();
info.dwTypeData = (LPTSTR) data ; info.dwTypeData = (LPTSTR) data ;
if ( !SetMenuItemInfo(hMenu, id, FALSE, & info) ) if ( !::SetMenuItemInfo(hMenu, id, FALSE, & info) )
{ {
wxLogLastError(wxT("SetMenuItemInfo")); wxLogLastError(wxT("SetMenuItemInfo"));
} }

View File

@@ -105,17 +105,17 @@ wxMetafile::~wxMetafile()
bool wxMetafile::SetClipboard(int width, int height) bool wxMetafile::SetClipboard(int width, int height)
{ {
#if !wxUSE_CLIPBOARD #if !wxUSE_CLIPBOARD
return FALSE; return false;
#else #else
if (!m_refData) if (!m_refData)
return FALSE; return false;
bool alreadyOpen = wxClipboardOpen(); bool alreadyOpen = wxClipboardOpen();
if (!alreadyOpen) if (!alreadyOpen)
{ {
wxOpenClipboard(); wxOpenClipboard();
if (!wxEmptyClipboard()) if (!wxEmptyClipboard())
return FALSE; return false;
} }
bool success = wxSetClipboardData(wxDF_METAFILE, this, width,height); bool success = wxSetClipboardData(wxDF_METAFILE, this, width,height);
if (!alreadyOpen) if (!alreadyOpen)
@@ -128,7 +128,7 @@ bool wxMetafile::SetClipboard(int width, int height)
bool wxMetafile::Play(wxDC *dc) bool wxMetafile::Play(wxDC *dc)
{ {
if (!m_refData) if (!m_refData)
return FALSE; return false;
dc->BeginDrawing(); dc->BeginDrawing();
@@ -143,7 +143,7 @@ bool wxMetafile::Play(wxDC *dc)
dc->EndDrawing(); dc->EndDrawing();
return TRUE; return true;
} }
void wxMetafile::SetHMETAFILE(WXHANDLE mf) void wxMetafile::SetHMETAFILE(WXHANDLE mf)
@@ -201,11 +201,11 @@ wxMetafileDC::wxMetafileDC(const wxString& file, int xext, int yext, int xorg, i
m_minY = 10000; m_minY = 10000;
m_maxX = -10000; m_maxX = -10000;
m_maxY = -10000; m_maxY = -10000;
if ( !!file && wxFileExists(file)) if ( !file.IsEmpty() && wxFileExists(file))
wxRemoveFile(file); wxRemoveFile(file);
m_hDC = (WXHDC) CreateMetaFile(file); m_hDC = (WXHDC) CreateMetaFile(file);
m_ok = TRUE; m_ok = true;
::SetWindowOrgEx((HDC) m_hDC,xorg,yorg, NULL); ::SetWindowOrgEx((HDC) m_hDC,xorg,yorg, NULL);
::SetWindowExtEx((HDC) m_hDC,xext,yext, NULL); ::SetWindowExtEx((HDC) m_hDC,xext,yext, NULL);
@@ -351,7 +351,7 @@ struct mfPLACEABLEHEADER {
bool wxMakeMetafilePlaceable(const wxString& filename, float scale) bool wxMakeMetafilePlaceable(const wxString& filename, float scale)
{ {
return wxMakeMetafilePlaceable(filename, 0, 0, 0, 0, scale, FALSE); return wxMakeMetafilePlaceable(filename, 0, 0, 0, 0, scale, false);
} }
bool wxMakeMetafilePlaceable(const wxString& filename, int x1, int y1, int x2, int y2, float scale, bool useOriginAndExtent) bool wxMakeMetafilePlaceable(const wxString& filename, int x1, int y1, int x2, int y2, float scale, bool useOriginAndExtent)
@@ -378,13 +378,13 @@ bool wxMakeMetafilePlaceable(const wxString& filename, int x1, int y1, int x2, i
pMFHead ->checksum ^= *p; pMFHead ->checksum ^= *p;
FILE *fd = wxFopen(filename.fn_str(), _T("rb")); FILE *fd = wxFopen(filename.fn_str(), _T("rb"));
if (!fd) return FALSE; if (!fd) return false;
wxChar tempFileBuf[256]; wxChar tempFileBuf[256];
wxGetTempFileName(wxT("mf"), tempFileBuf); wxGetTempFileName(wxT("mf"), tempFileBuf);
FILE *fHandle = wxFopen(wxFNCONV(tempFileBuf), _T("wb")); FILE *fHandle = wxFopen(wxFNCONV(tempFileBuf), _T("wb"));
if (!fHandle) if (!fHandle)
return FALSE; return false;
fwrite((void *)&header, sizeof(unsigned char), sizeof(mfPLACEABLEHEADER), fHandle); fwrite((void *)&header, sizeof(unsigned char), sizeof(mfPLACEABLEHEADER), fHandle);
// Calculate origin and extent // Calculate origin and extent
@@ -449,7 +449,7 @@ bool wxMakeMetafilePlaceable(const wxString& filename, int x1, int y1, int x2, i
wxRemoveFile(filename); wxRemoveFile(filename);
wxCopyFile(tempFileBuf, filename); wxCopyFile(tempFileBuf, filename);
wxRemoveFile(tempFileBuf); wxRemoveFile(tempFileBuf);
return TRUE; return true;
} }
@@ -469,7 +469,7 @@ bool wxMetafileDataObject::GetDataHere(void *buf) const
METAFILEPICT *mfpict = (METAFILEPICT *)buf; METAFILEPICT *mfpict = (METAFILEPICT *)buf;
const wxMetafile& mf = GetMetafile(); const wxMetafile& mf = GetMetafile();
wxCHECK_MSG( mf.GetHMETAFILE(), FALSE, _T("copying invalid metafile") ); wxCHECK_MSG( mf.GetHMETAFILE(), false, _T("copying invalid metafile") );
// doesn't seem to work with any other mapping mode... // doesn't seem to work with any other mapping mode...
mfpict->mm = MM_ANISOTROPIC; //mf.GetWindowsMappingMode(); mfpict->mm = MM_ANISOTROPIC; //mf.GetWindowsMappingMode();
@@ -482,7 +482,7 @@ bool wxMetafileDataObject::GetDataHere(void *buf) const
mfpict->hMF = CopyMetaFile((HMETAFILE)mf.GetHMETAFILE(), NULL); mfpict->hMF = CopyMetaFile((HMETAFILE)mf.GetHMETAFILE(), NULL);
return TRUE; return true;
} }
bool wxMetafileDataObject::SetData(size_t WXUNUSED(len), const void *buf) bool wxMetafileDataObject::SetData(size_t WXUNUSED(len), const void *buf)
@@ -505,11 +505,11 @@ bool wxMetafileDataObject::SetData(size_t WXUNUSED(len), const void *buf)
mf.SetHeight(h); mf.SetHeight(h);
mf.SetHMETAFILE((WXHANDLE)mfpict->hMF); mf.SetHMETAFILE((WXHANDLE)mfpict->hMF);
wxCHECK_MSG( mfpict->hMF, FALSE, _T("pasting invalid metafile") ); wxCHECK_MSG( mfpict->hMF, false, _T("pasting invalid metafile") );
SetMetafile(mf); SetMetafile(mf);
return TRUE; return true;
} }
#endif // wxUSE_DRAG_AND_DROP #endif // wxUSE_DRAG_AND_DROP

View File

@@ -192,11 +192,11 @@ bool wxFileTypeImpl::EnsureExtKeyExists()
{ {
wxLogError(_("Failed to create registry entry for '%s' files."), wxLogError(_("Failed to create registry entry for '%s' files."),
m_ext.c_str()); m_ext.c_str());
return FALSE; return false;
} }
} }
return TRUE; return true;
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -306,14 +306,14 @@ bool wxFileTypeImpl::GetExtensions(wxArrayString& extensions)
if ( m_ext.IsEmpty() ) { if ( m_ext.IsEmpty() ) {
// the only way to get the list of extensions from the file type is to // the only way to get the list of extensions from the file type is to
// scan through all extensions in the registry - too slow... // scan through all extensions in the registry - too slow...
return FALSE; return false;
} }
else { else {
extensions.Empty(); extensions.Empty();
extensions.Add(m_ext); extensions.Add(m_ext);
// it's a lie too, we don't return _all_ extensions... // it's a lie too, we don't return _all_ extensions...
return TRUE; return true;
} }
} }
@@ -333,12 +333,12 @@ bool wxFileTypeImpl::GetMimeTypes(wxArrayString& mimeTypes) const
if ( !GetMimeType(&s) ) if ( !GetMimeType(&s) )
{ {
return FALSE; return false;
} }
mimeTypes.Clear(); mimeTypes.Clear();
mimeTypes.Add(s); mimeTypes.Add(s);
return TRUE; return true;
} }
@@ -375,12 +375,12 @@ bool wxFileTypeImpl::GetIcon(wxIconLocation *iconLoc) const
iconLoc->SetIndex(wxAtoi(strIndex)); iconLoc->SetIndex(wxAtoi(strIndex));
} }
return TRUE; return true;
} }
} }
// no such file type or no value or incorrect icon entry // no such file type or no value or incorrect icon entry
return FALSE; return false;
} }
bool wxFileTypeImpl::GetDescription(wxString *desc) const bool wxFileTypeImpl::GetDescription(wxString *desc) const
@@ -392,11 +392,11 @@ bool wxFileTypeImpl::GetDescription(wxString *desc) const
if ( key.Open(wxRegKey::Read) ) { if ( key.Open(wxRegKey::Read) ) {
// it's the default value of the key // it's the default value of the key
if ( key.QueryValue(wxEmptyString, *desc) ) { if ( key.QueryValue(wxEmptyString, *desc) ) {
return TRUE; return true;
} }
} }
return FALSE; return false;
} }
// helper function // helper function
@@ -422,7 +422,7 @@ wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString& ext)
// suppress possible error messages // suppress possible error messages
wxLogNull nolog; wxLogNull nolog;
bool knownExtension = FALSE; bool knownExtension = false;
wxString strFileType; wxString strFileType;
wxRegKey key(wxRegKey::HKCR, str); wxRegKey key(wxRegKey::HKCR, str);
@@ -436,7 +436,7 @@ wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString& ext)
// this extension doesn't have a filetype, but it's known to the // this extension doesn't have a filetype, but it's known to the
// system and may be has some other useful keys (open command or // system and may be has some other useful keys (open command or
// content-type), so still return a file type object for it // content-type), so still return a file type object for it
knownExtension = TRUE; knownExtension = true;
} }
} }
@@ -651,11 +651,11 @@ bool wxFileTypeImpl::SetCommand(const wxString& cmd,
const wxString& verb, const wxString& verb,
bool WXUNUSED(overwriteprompt)) bool WXUNUSED(overwriteprompt))
{ {
wxCHECK_MSG( !m_ext.IsEmpty() && !verb.IsEmpty(), FALSE, wxCHECK_MSG( !m_ext.IsEmpty() && !verb.IsEmpty(), false,
_T("SetCommand() needs an extension and a verb") ); _T("SetCommand() needs an extension and a verb") );
if ( !EnsureExtKeyExists() ) if ( !EnsureExtKeyExists() )
return FALSE; return false;
wxRegKey rkey(wxRegKey::HKCR, GetVerbPath(verb)); wxRegKey rkey(wxRegKey::HKCR, GetVerbPath(verb));
#if 0 #if 0
@@ -680,7 +680,7 @@ bool wxFileTypeImpl::SetCommand(const wxString& cmd,
#endif // wxUSE_GUI #endif // wxUSE_GUI
{ {
// cancelled by user // cancelled by user
return FALSE; return false;
} }
} }
#endif #endif
@@ -693,10 +693,10 @@ bool wxFileTypeImpl::SetCommand(const wxString& cmd,
/* // no longer used /* // no longer used
bool wxFileTypeImpl::SetMimeType(const wxString& mimeTypeOrig) bool wxFileTypeImpl::SetMimeType(const wxString& mimeTypeOrig)
{ {
wxCHECK_MSG( !m_ext.IsEmpty(), FALSE, _T("SetMimeType() needs extension") ); wxCHECK_MSG( !m_ext.IsEmpty(), false, _T("SetMimeType() needs extension") );
if ( !EnsureExtKeyExists() ) if ( !EnsureExtKeyExists() )
return FALSE; return false;
// VZ: is this really useful? (FIXME) // VZ: is this really useful? (FIXME)
wxString mimeType; wxString mimeType;
@@ -719,13 +719,13 @@ bool wxFileTypeImpl::SetMimeType(const wxString& mimeTypeOrig)
bool wxFileTypeImpl::SetDefaultIcon(const wxString& cmd, int index) bool wxFileTypeImpl::SetDefaultIcon(const wxString& cmd, int index)
{ {
wxCHECK_MSG( !m_ext.IsEmpty(), FALSE, _T("SetDefaultIcon() needs extension") ); wxCHECK_MSG( !m_ext.IsEmpty(), false, _T("SetDefaultIcon() needs extension") );
wxCHECK_MSG( !m_strFileType.IsEmpty(), FALSE, _T("File key not found") ); wxCHECK_MSG( !m_strFileType.IsEmpty(), false, _T("File key not found") );
// the next line fails on a SMBshare, I think because it is case mangled // the next line fails on a SMBshare, I think because it is case mangled
// wxCHECK_MSG( !wxFileExists(cmd), FALSE, _T("Icon file not found.") ); // wxCHECK_MSG( !wxFileExists(cmd), false, _T("Icon file not found.") );
if ( !EnsureExtKeyExists() ) if ( !EnsureExtKeyExists() )
return FALSE; return false;
wxRegKey rkey(wxRegKey::HKCR, m_strFileType + _T("\\DefaultIcon")); wxRegKey rkey(wxRegKey::HKCR, m_strFileType + _T("\\DefaultIcon"));
@@ -736,11 +736,11 @@ bool wxFileTypeImpl::SetDefaultIcon(const wxString& cmd, int index)
bool wxFileTypeImpl::SetDescription (const wxString& desc) bool wxFileTypeImpl::SetDescription (const wxString& desc)
{ {
wxCHECK_MSG( !m_strFileType.IsEmpty(), FALSE, _T("File key not found") ); wxCHECK_MSG( !m_strFileType.IsEmpty(), false, _T("File key not found") );
wxCHECK_MSG( !desc.IsEmpty(), FALSE, _T("No file description supplied") ); wxCHECK_MSG( !desc.IsEmpty(), false, _T("No file description supplied") );
if ( !EnsureExtKeyExists() ) if ( !EnsureExtKeyExists() )
return FALSE; return false;
wxRegKey rkey(wxRegKey::HKCR, m_strFileType ); wxRegKey rkey(wxRegKey::HKCR, m_strFileType );
@@ -754,15 +754,15 @@ bool wxFileTypeImpl::SetDescription (const wxString& desc)
bool wxFileTypeImpl::Unassociate() bool wxFileTypeImpl::Unassociate()
{ {
bool result = TRUE; bool result = true;
if ( !RemoveOpenCommand() ) if ( !RemoveOpenCommand() )
result = FALSE; result = false;
if ( !RemoveDefaultIcon() ) if ( !RemoveDefaultIcon() )
result = FALSE; result = false;
if ( !RemoveMimeType() ) if ( !RemoveMimeType() )
result = FALSE; result = false;
if ( !RemoveDescription() ) if ( !RemoveDescription() )
result = FALSE; result = false;
/* /*
//this might hold other keys, eg some have CSLID keys //this might hold other keys, eg some have CSLID keys
@@ -784,7 +784,7 @@ bool wxFileTypeImpl::RemoveOpenCommand()
bool wxFileTypeImpl::RemoveCommand(const wxString& verb) bool wxFileTypeImpl::RemoveCommand(const wxString& verb)
{ {
wxCHECK_MSG( !m_ext.IsEmpty() && !verb.IsEmpty(), FALSE, wxCHECK_MSG( !m_ext.IsEmpty() && !verb.IsEmpty(), false,
_T("RemoveCommand() needs an extension and a verb") ); _T("RemoveCommand() needs an extension and a verb") );
wxString sKey = m_strFileType; wxString sKey = m_strFileType;
@@ -796,7 +796,7 @@ bool wxFileTypeImpl::RemoveCommand(const wxString& verb)
bool wxFileTypeImpl::RemoveMimeType() bool wxFileTypeImpl::RemoveMimeType()
{ {
wxCHECK_MSG( !m_ext.IsEmpty(), FALSE, _T("RemoveMimeType() needs extension") ); wxCHECK_MSG( !m_ext.IsEmpty(), false, _T("RemoveMimeType() needs extension") );
wxRegKey rkey(wxRegKey::HKCR, m_ext); wxRegKey rkey(wxRegKey::HKCR, m_ext);
return !rkey.Exists() || rkey.DeleteSelf(); return !rkey.Exists() || rkey.DeleteSelf();
@@ -804,7 +804,7 @@ bool wxFileTypeImpl::RemoveMimeType()
bool wxFileTypeImpl::RemoveDefaultIcon() bool wxFileTypeImpl::RemoveDefaultIcon()
{ {
wxCHECK_MSG( !m_ext.IsEmpty(), FALSE, wxCHECK_MSG( !m_ext.IsEmpty(), false,
_T("RemoveDefaultIcon() needs extension") ); _T("RemoveDefaultIcon() needs extension") );
wxRegKey rkey (wxRegKey::HKCR, m_strFileType + _T("\\DefaultIcon")); wxRegKey rkey (wxRegKey::HKCR, m_strFileType + _T("\\DefaultIcon"));
@@ -813,7 +813,7 @@ bool wxFileTypeImpl::RemoveDefaultIcon()
bool wxFileTypeImpl::RemoveDescription() bool wxFileTypeImpl::RemoveDescription()
{ {
wxCHECK_MSG( !m_ext.IsEmpty(), FALSE, wxCHECK_MSG( !m_ext.IsEmpty(), false,
_T("RemoveDescription() needs extension") ); _T("RemoveDescription() needs extension") );
wxRegKey rkey (wxRegKey::HKCR, m_strFileType ); wxRegKey rkey (wxRegKey::HKCR, m_strFileType );