virtual int GetCount() const;
virtual wxString GetString(int n) const;
virtual void SetString(int n, const wxString& label);
- virtual void Enable(int n, bool enable = TRUE);
- virtual void Show(int n, bool show = TRUE);
+ virtual void Enable(int n, bool enable = true);
+ virtual void Show(int n, bool show = true);
virtual int GetColumnCount() const;
virtual int GetRowCount() const;
- virtual bool Show(bool show = TRUE);
+ virtual bool Show(bool show = true);
void SetFocus();
- virtual bool Enable(bool enable = TRUE);
+ virtual bool Enable(bool enable = true);
void SetLabelFont(const wxFont& WXUNUSED(font)) {};
void SetButtonFont(const wxFont& font) { SetFont(font); }
// get number of entries/subgroups in the current group, with or without
// it's subgroups
- virtual size_t GetNumberOfEntries(bool bRecursive = FALSE) const;
- virtual size_t GetNumberOfGroups(bool bRecursive = FALSE) const;
+ virtual size_t GetNumberOfEntries(bool bRecursive = false) const;
+ virtual size_t GetNumberOfGroups(bool bRecursive = false) const;
- virtual bool Flush(bool WXUNUSED(bCurrentOnly) = FALSE) { return TRUE; }
+ virtual bool Flush(bool WXUNUSED(bCurrentOnly) = false) { return true; }
// rename
virtual bool RenameEntry(const wxString& oldName, const wxString& newName);
virtual bool RenameGroup(const wxString& oldName, const wxString& newName);
// delete
- virtual bool DeleteEntry(const wxString& key, bool bGroupIfEmptyAlso = TRUE);
+ virtual bool DeleteEntry(const wxString& key, bool bGroupIfEmptyAlso = true);
virtual bool DeleteGroup(const wxString& key);
virtual bool DeleteAll();
// ----------------------------------------------------------------------------
// class wxRegKey encapsulates window HKEY handle
// ----------------------------------------------------------------------------
-class WXDLLIMPEXP_BASE wxRegKey
+class WXDLLIMPEXP_BASE wxRegKey
{
public:
// NB: do _not_ change the values of elements in these enumerations!
// get infomation about the key
// get the (full) key name. Abbreviate std root keys if bShortPrefix.
- wxString GetName(bool bShortPrefix = TRUE) const;
+ wxString GetName(bool bShortPrefix = true) const;
// return true if the key exists
bool Exists() const;
// get the info about key (any number of these pointers may be NULL)
// which need the key to be opened if the key is not opened yet)
bool Open(AccessMode mode = Write);
// create the key: will fail if the key already exists and !bOkIfExists
- bool Create(bool bOkIfExists = TRUE);
+ bool Create(bool bOkIfExists = true);
// rename a value from old name to new one
bool RenameValue(const wxChar *szValueOld, const wxChar *szValueNew);
// rename the key
// access to values and subkeys
// get value type
ValueType GetValueType(const wxChar *szValue) const;
- // returns TRUE if the value contains a number (else it's some string)
+ // returns true if the value contains a number (else it's some string)
bool IsNumericValue(const wxChar *szValue) const;
// assignment operators set the default value of the key
bool SetValue(const wxChar *szValue, const wxString& strValue);
// retrieve the string value
bool QueryValue(const wxChar *szValue, wxString& strValue) const
- { return QueryValue(szValue, strValue, FALSE); }
+ { return QueryValue(szValue, strValue, false); }
// retrieve raw string value
bool QueryRawValue(const wxChar *szValue, wxString& strValue) const
- { return QueryValue(szValue, strValue, TRUE); }
+ { return QueryValue(szValue, strValue, true); }
// retrieve either raw or expanded string value
bool QueryValue(const wxChar *szValue, wxString& strValue, bool raw) const;
wxFLAGS_MEMBER(wxBORDER_RAISED)
wxFLAGS_MEMBER(wxBORDER_STATIC)
wxFLAGS_MEMBER(wxBORDER_NONE)
-
+
// old style border flags
wxFLAGS_MEMBER(wxSIMPLE_BORDER)
wxFLAGS_MEMBER(wxSUNKEN_BORDER)
#endif
/*
- selection
- content
- label
- dimension
- item
+ selection
+ content
+ label
+ dimension
+ item
*/
// there are two possible ways to create the radio buttons: either as children
if ( cmd == BN_CLICKED )
{
if (id == GetId())
- return TRUE;
+ return true;
- int selectedButton = -1;
+ int selectedButton = wxID_ANY;
for ( int i = 0; i < m_noItems; i++ )
{
}
}
- if ( selectedButton == -1 )
+ if ( selectedButton == wxID_ANY )
{
// just ignore it - due to a hack with WM_NCHITTEST handling in our
// wnd proc, we can receive dummy click messages when we click near
// the radiobox edge (this is ugly but Julian wouldn't let me get
// rid of this...)
- return FALSE;
+ return false;
}
if ( selectedButton != m_selectedButton )
}
//else: don't generate events when the selection doesn't change
- return TRUE;
+ return true;
}
else
- return FALSE;
+ return false;
}
// Radio box item
wxRadioBox::wxRadioBox()
{
- m_selectedButton = -1;
+ m_selectedButton = wxID_ANY;
m_noItems = 0;
m_noRowsOrCols = 0;
m_radioButtons = NULL;
const wxString& name)
{
// initialize members
- m_selectedButton = -1;
+ m_selectedButton = wxID_ANY;
m_noItems = 0;
m_majorDim = majorDim == 0 ? n : majorDim;
// common initialization
if ( !CreateControl(parent, id, pos, size, style, val, name) )
- return FALSE;
+ return false;
// create the static box
if ( !MSWCreateControl(wxT("BUTTON"), BS_GROUPBOX | WS_GROUP,
pos, size, title, 0) )
- return FALSE;
+ return false;
// and now create the buttons
m_noItems = n;
for ( int i = 0; i < n; i++ )
{
m_radioWidth[i] =
- m_radioHeight[i] = -1;
+ m_radioHeight[i] = wxDefaultCoord;
long styleBtn = BS_AUTORADIOBUTTON | WS_TABSTOP | WS_CHILD | WS_VISIBLE;
if ( i == 0 && style == 0 )
styleBtn |= WS_GROUP;
{
wxLogLastError(wxT("CreateWindow(radio btn)"));
- return FALSE;
+ return false;
}
m_radioButtons[i] = (WXHWND)hwndBtn;
// Now that we have items determine what is the best size and set it.
SetBestSize(size);
-
- return TRUE;
+
+ return true;
}
bool wxRadioBox::Create(wxWindow *parent,
wxRadioBox::~wxRadioBox()
{
- m_isBeingDeleted = TRUE;
+ m_isBeingDeleted = true;
if (m_radioButtons)
{
{
wxCHECK_RET( item >= 0 && item < m_noItems, wxT("invalid radiobox index") );
- m_radioWidth[item] = m_radioHeight[item] = -1;
+ m_radioWidth[item] = m_radioHeight[item] = wxDefaultCoord;
SetWindowText((HWND)m_radioButtons[item], label.c_str());
}
extraHeight /= 2;
#endif
*/
-
+
int height = GetNumVer() * sizeBtn.y + cy1/2 + extraHeight;
int width = GetNumHor() * (sizeBtn.x + cx1) + cx1;
int xx = x;
int yy = y;
- if (x == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
+ if (x == wxDefaultCoord && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
xx = currentX;
- if (y == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
+ if (y == wxDefaultCoord && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
yy = currentY;
#if RADIOBTN_PARENT_IS_RADIOBOX
totHeight = totSize.y;
// only change our width/height if asked for
- if ( width == -1 )
+ if ( width == wxDefaultCoord )
{
if ( sizeFlags & wxSIZE_AUTO_WIDTH )
width = totWidth;
width = widthOld;
}
- if ( height == -1 )
+ if ( height == wxDefaultCoord )
{
if ( sizeFlags & wxSIZE_AUTO_HEIGHT )
height = totHeight;
void wxRadioBox::GetSize(int *width, int *height) const
{
- RECT rect;
- rect.left = -1; rect.right = -1; rect.top = -1; rect.bottom = -1;
+ RECT rect = { -1, -1, -1, -1 };
if (m_hWnd)
wxFindMaxSize(m_hWnd, &rect);
{
if (m_noItems > 0)
{
- ::SetFocus((HWND)m_radioButtons[m_selectedButton == -1
+ ::SetFocus((HWND)m_radioButtons[m_selectedButton == wxID_ANY
? 0
: m_selectedButton]);
}
bool wxRadioBox::Show(bool show)
{
if ( !wxControl::Show(show) )
- return FALSE;
+ return false;
int nCmdShow = show ? SW_SHOW : SW_HIDE;
for ( int i = 0; i < m_noItems; i++ )
::ShowWindow((HWND)m_radioButtons[i], nCmdShow);
}
- return TRUE;
+ return true;
}
// Enable a specific button
bool wxRadioBox::Enable(bool enable)
{
if ( !wxControl::Enable(enable) )
- return FALSE;
+ return false;
for (int i = 0; i < m_noItems; i++)
::EnableWindow((HWND) m_radioButtons[i], enable);
- return TRUE;
+ return true;
}
// Show a specific button
for ( size_t i = 0; i < count; i++ )
{
if ( GetRadioButtons()[i] == hWnd )
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
void wxRadioBox::Command(wxCommandEvent & event)
if ( !wxControl::SetFont(font) )
{
// nothing to do
- return FALSE;
+ return false;
}
// also set the font of our radio buttons
::InvalidateRect(hwndBtn, NULL, FALSE /* don't erase bg */);
}
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
wxCHECK_MSG( radiobox, 0, wxT("radio button without radio box?") );
- bool processed = TRUE;
+ bool processed = true;
wxDirection dir;
switch ( wParam )
break;
default:
- processed = FALSE;
+ processed = false;
// just to suppress the compiler warning
dir = wxALL;
#endif
{
wxWindow* subjectOfHelp = radiobox;
- bool eventProcessed = FALSE;
+ bool eventProcessed = false;
while (subjectOfHelp && !eventProcessed)
{
wxHelpEvent helpEvent(wxEVT_HELP, subjectOfHelp->GetId(),
wxFLAGS_MEMBER(wxBORDER_RAISED)
wxFLAGS_MEMBER(wxBORDER_STATIC)
wxFLAGS_MEMBER(wxBORDER_NONE)
-
+
// old style border flags
wxFLAGS_MEMBER(wxSIMPLE_BORDER)
wxFLAGS_MEMBER(wxSUNKEN_BORDER)
wxBEGIN_HANDLERS_TABLE(wxRadioButton)
wxEND_HANDLERS_TABLE()
-wxCONSTRUCTOR_6( wxRadioButton , wxWindow* , Parent , wxWindowID , Id , wxString , Label , wxPoint , Position , wxSize , Size , long , WindowStyle )
+wxCONSTRUCTOR_6( wxRadioButton , wxWindow* , Parent , wxWindowID , Id , wxString , Label , wxPoint , Position , wxSize , Size , long , WindowStyle )
#else
IMPLEMENT_DYNAMIC_CLASS(wxRadioButton, wxControl)
strFullPath.reserve(2*m_strPath.length());
strFullPath << m_strPath;
- if ( strFullPath.Len() == 0 ||
+ if ( strFullPath.Len() == 0 ||
strFullPath.Last() != wxCONFIG_PATH_SEPARATOR )
- strFullPath << wxCONFIG_PATH_SEPARATOR;
+ strFullPath << wxCONFIG_PATH_SEPARATOR;
strFullPath << strPath;
}
while ( m_keyGlobal.GetNextKey(str, lIndex) ) {
if ( !m_keyLocal.Exists() || !LocalKey().HasSubKey(str) ) {
// ok, found one - return it
- return TRUE;
+ return true;
}
}
// if we don't have the key at all, don't try to enumerate anything under it
if ( !m_keyLocal.Exists() )
- return FALSE;
+ return false;
// much easier with local entries: get the next one we find
// (don't forget to clear our flag bit and set it again later)
while ( m_keyGlobal.GetNextValue(str, lIndex) ) {
if ( !m_keyLocal.Exists() || !LocalKey().HasValue(str) ) {
// ok, found one - return it
- return TRUE;
+ return true;
}
}
// if we don't have the key at all, don't try to enumerate anything under it
if ( !m_keyLocal.Exists() )
- return FALSE;
+ return false;
// much easier with local entries: get the next one we find
// (don't forget to clear our flag bit and set it again later)
bool wxRegConfig::DoReadString(const wxString& key, wxString *pStr) const
{
- wxCHECK_MSG( pStr, FALSE, _T("wxRegConfig::Read(): NULL param") );
+ wxCHECK_MSG( pStr, false, _T("wxRegConfig::Read(): NULL param") );
wxConfigPathChanger path(this, key);
- bool bQueryGlobal = TRUE;
+ bool bQueryGlobal = true;
// if immutable key exists in global key we must check that it's not
// overriden by the local key with the same name
path.Name().c_str());
}
- return TRUE;
+ return true;
}
else {
// don't waste time - it's not there anyhow
- bQueryGlobal = FALSE;
+ bQueryGlobal = false;
}
}
// first try local key
if ( (m_keyLocal.Exists() && TryGetValue(LocalKey(), path.Name(), *pStr)) ||
(bQueryGlobal && TryGetValue(m_keyGlobal, path.Name(), *pStr)) ) {
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
// this exactly reproduces the string version above except for ExpandEnvVars(),
bool wxRegConfig::DoReadLong(const wxString& key, long *plResult) const
{
- wxCHECK_MSG( plResult, FALSE, _T("wxRegConfig::Read(): NULL param") );
+ wxCHECK_MSG( plResult, false, _T("wxRegConfig::Read(): NULL param") );
wxConfigPathChanger path(this, key);
- bool bQueryGlobal = TRUE;
+ bool bQueryGlobal = true;
// if immutable key exists in global key we must check that it's not
// overriden by the local key with the same name
path.Name().c_str());
}
- return TRUE;
+ return true;
}
else {
// don't waste time - it's not there anyhow
- bQueryGlobal = FALSE;
+ bQueryGlobal = false;
}
}
// first try local key
if ( (m_keyLocal.Exists() && TryGetValue(LocalKey(), path.Name(), plResult)) ||
(bQueryGlobal && TryGetValue(m_keyGlobal, path.Name(), plResult)) ) {
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
bool wxRegConfig::DoWriteString(const wxString& key, const wxString& szValue)
if ( IsImmutable(path.Name()) ) {
wxLogError(wxT("Can't change immutable entry '%s'."), path.Name().c_str());
- return FALSE;
+ return false;
}
return LocalKey().SetValue(path.Name(), szValue);
if ( IsImmutable(path.Name()) ) {
wxLogError(wxT("Can't change immutable entry '%s'."), path.Name().c_str());
- return FALSE;
+ return false;
}
return LocalKey().SetValue(path.Name(), lValue);
{
// check that the old entry exists...
if ( !HasEntry(oldName) )
- return FALSE;
+ return false;
// and that the new one doesn't
if ( HasEntry(newName) )
- return FALSE;
+ return false;
return m_keyLocal.RenameValue(oldName, newName);
}
{
// check that the old group exists...
if ( !HasGroup(oldName) )
- return FALSE;
+ return false;
// and that the new one doesn't
if ( HasGroup(newName) )
- return FALSE;
+ return false;
return wxRegKey(m_keyLocal, oldName).Rename(newName);
}
if ( m_keyLocal.Exists() ) {
if ( !m_keyLocal.DeleteValue(path.Name()) )
- return FALSE;
+ return false;
if ( bGroupIfEmptyAlso && m_keyLocal.IsEmpty() ) {
wxString strKey = GetPath().AfterLast(wxCONFIG_PATH_SEPARATOR);
}
}
- return TRUE;
+ return true;
}
bool wxRegConfig::DeleteGroup(const wxString& key)
{
wxConfigPathChanger path(this, key);
- return m_keyLocal.Exists() ? LocalKey().DeleteKey(path.Name()) : TRUE;
+ return m_keyLocal.Exists() ? LocalKey().DeleteKey(path.Name()) : true;
}
bool wxRegConfig::DeleteAll()
bool wxRegion::Offset(wxCoord x, wxCoord y)
{
- wxCHECK_MSG( M_REGION, FALSE, _T("invalid wxRegion") );
+ wxCHECK_MSG( M_REGION, false, _T("invalid wxRegion") );
if ( !x && !y )
{
// nothing to do
- return TRUE;
+ return true;
}
AllocExclusive();
{
wxLogLastError(_T("OffsetRgn"));
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
// combine another region with this one
case wxRGN_AND:
case wxRGN_DIFF:
// leave empty/invalid
- return FALSE;
+ return false;
}
}
else // we have a valid region
{
wxLogLastError(_T("CombineRgn"));
- return FALSE;
+ return false;
}
}
- return TRUE;
+ return true;
}
// Combine rectangle (x, y, w, h) with this.
// removes the trailing backslash from the string if it has one
static inline void RemoveTrailingSeparator(wxString& str);
-// returns TRUE if given registry key exists
+// returns true if given registry key exists
static bool KeyExists(WXHKEY hRootKey, const wxChar *szKey);
// combines value and key name (uses static buffer!)
// info about the key
// ----------------------------------------------------------------------------
-// returns TRUE if the key exists
+// returns true if the key exists
bool wxRegKey::Exists() const
{
// opened key has to exist, try to open it if not done yet
- return IsOpened() ? TRUE : KeyExists(m_hRootKey, m_strKey);
+ return IsOpened() ? true : KeyExists(m_hRootKey, m_strKey);
}
// returns the full name of the key (prefix is abbreviated if bShortPrefix)
if ( m_dwLastError != ERROR_SUCCESS ) {
wxLogSysError(m_dwLastError, _("Can't get info about registry key '%s'"),
GetName().c_str());
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
bool wxRegKey::Open(AccessMode mode)
{
if ( IsOpened() )
- return TRUE;
+ return true;
HKEY tmpKey;
m_dwLastError = ::RegOpenKeyEx
{
wxLogSysError(m_dwLastError, _("Can't open registry key '%s'"),
GetName().c_str());
- return FALSE;
+ return false;
}
m_hKey = (WXHKEY) tmpKey;
- return TRUE;
+ return true;
}
// creates key, failing if it exists and !bOkIfExists
{
// check for existence only if asked (i.e. order is important!)
if ( !bOkIfExists && Exists() )
- return FALSE;
+ return false;
if ( IsOpened() )
- return TRUE;
+ return true;
HKEY tmpKey;
#ifdef __WXWINCE__
if ( m_dwLastError != ERROR_SUCCESS ) {
wxLogSysError(m_dwLastError, _("Can't create registry key '%s'"),
GetName().c_str());
- return FALSE;
+ return false;
}
else
{
m_hKey = (WXHKEY) tmpKey;
- return TRUE;
+ return true;
}
}
wxLogSysError(m_dwLastError, _("Can't close registry key '%s'"),
GetName().c_str());
- return FALSE;
+ return false;
}
}
- return TRUE;
+ return true;
}
bool wxRegKey::RenameValue(const wxChar *szValueOld, const wxChar *szValueNew)
{
- bool ok = TRUE;
+ bool ok = true;
if ( HasValue(szValueNew) ) {
wxLogError(_("Registry value '%s' already exists."), szValueNew);
- ok = FALSE;
+ ok = false;
}
if ( !ok ||
wxLogError(_("Failed to rename registry value '%s' to '%s'."),
szValueOld, szValueNew);
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
bool wxRegKey::CopyValue(const wxChar *szValue,
#ifdef __WIN32__
case Type_Binary:
- {
- wxMemoryBuffer buf;
- return QueryValue(szValue,buf) &&
- keyDst.SetValue(szValueNew,buf);
- }
+ {
+ wxMemoryBuffer buf;
+ return QueryValue(szValue,buf) &&
+ keyDst.SetValue(szValueNew,buf);
+ }
// these types are unsupported because I am not sure about how
// exactly they should be copied and because they shouldn't
// occur among the application keys (supposedly created with
default:
wxLogError(_("Can't copy values of unsupported type %d."),
GetValueType(szValue));
- return FALSE;
+ return false;
}
}
bool wxRegKey::Rename(const wxChar *szNewName)
{
- wxCHECK_MSG( !!m_strKey, FALSE, _T("registry hives can't be renamed") );
+ wxCHECK_MSG( !m_strKey.IsEmpty(), false, _T("registry hives can't be renamed") );
if ( !Exists() ) {
wxLogError(_("Registry key '%s' does not exist, cannot rename it."),
GetFullName(this));
- return FALSE;
+ return false;
}
// do we stay in the same hive?
if ( inSameHive ) {
// rename the key to the new name under the same parent
wxString strKey = m_strKey.BeforeLast(REG_SEPARATOR);
- if ( !!strKey ) {
+ if ( !strKey.IsEmpty() ) {
// don't add '\\' in the start if strFullNewName is empty
strKey += REG_SEPARATOR;
}
keyDst.SetName(szNewName);
}
- bool ok = keyDst.Create(FALSE /* fail if alredy exists */);
+ bool ok = keyDst.Create(false /* fail if alredy exists */);
if ( !ok ) {
wxLogError(_("Registry key '%s' already exists."),
GetFullName(&keyDst));
{
// create the new key first
wxRegKey keyDst(szNewName);
- bool ok = keyDst.Create(FALSE /* fail if alredy exists */);
+ bool ok = keyDst.Create(false /* fail if alredy exists */);
if ( ok ) {
ok = Copy(keyDst);
bool wxRegKey::Copy(wxRegKey& keyDst)
{
- bool ok = TRUE;
+ bool ok = true;
// copy all sub keys to the new location
wxString strKey;
if ( ok )
bCont = GetNextKey(strKey, lIndex);
- else
- wxLogError(_("Failed to copy the registry subkey '%s' to '%s'."),
+ else
+ wxLogError(_("Failed to copy the registry subkey '%s' to '%s'."),
GetFullName(&key), keyName.c_str());
-
+
}
// copy all values
wxLogNull nolog;
if ( !Open() ) {
// it already doesn't exist - ok!
- return TRUE;
+ return true;
}
}
wxLogError(_("Registry key '%s' is needed for normal system operation,\ndeleting it will leave your system in unusable state:\noperation aborted."),
GetFullName(this));
- return FALSE;
+ return false;
}
// we can't delete keys while enumerating because it confuses GetNextKey, so
for ( size_t nKey = 0; nKey < nKeyCount; nKey++ ) {
wxRegKey key(*this, astrSubkeys[nKey]);
if ( !key.DeleteSelf() )
- return FALSE;
+ return false;
}
// now delete this key itself
m_dwLastError != ERROR_FILE_NOT_FOUND ) {
wxLogSysError(m_dwLastError, _("Can't delete key '%s'"),
GetName().c_str());
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
bool wxRegKey::DeleteKey(const wxChar *szKey)
{
if ( !Open() )
- return FALSE;
+ return false;
wxRegKey key(*this, szKey);
return key.DeleteSelf();
bool wxRegKey::DeleteValue(const wxChar *szValue)
{
if ( !Open() )
- return FALSE;
+ return false;
m_dwLastError = RegDeleteValue((HKEY) m_hKey, WXSTRINGCAST szValue);
(m_dwLastError != ERROR_FILE_NOT_FOUND) ) {
wxLogSysError(m_dwLastError, _("Can't delete value '%s' from key '%s'"),
szValue, GetName().c_str());
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
// access to values and subkeys
// ----------------------------------------------------------------------------
-// return TRUE if value exists
+// return true if value exists
bool wxRegKey::HasValue(const wxChar *szValue) const
{
// this function should be silent, so suppress possible messages from Open()
wxLogNull nolog;
if ( !CONST_CAST Open(Read) )
- return FALSE;
+ return false;
LONG dwRet = ::RegQueryValueEx((HKEY) m_hKey,
WXSTRINGCAST szValue,
return dwRet == ERROR_SUCCESS;
}
-// returns TRUE if this key has any values
+// returns true if this key has any values
bool wxRegKey::HasValues() const
{
// suppress possible messages from GetFirstValue()
return CONST_CAST GetFirstValue(str, l);
}
-// returns TRUE if this key has any subkeys
+// returns true if this key has any subkeys
bool wxRegKey::HasSubkeys() const
{
// suppress possible messages from GetFirstKey()
return CONST_CAST GetFirstKey(str, l);
}
-// returns TRUE if given subkey exists
+// returns true if given subkey exists
bool wxRegKey::HasSubKey(const wxChar *szKey) const
{
// this function should be silent, so suppress possible messages from Open()
wxLogNull nolog;
if ( !CONST_CAST Open(Read) )
- return FALSE;
+ return false;
return KeyExists(m_hKey, szKey);
}
m_dwLastError = RegSetValueEx((HKEY) m_hKey, szValue, (DWORD) RESERVED, REG_DWORD,
(RegString)&lValue, sizeof(lValue));
if ( m_dwLastError == ERROR_SUCCESS )
- return TRUE;
+ return true;
}
wxLogSysError(m_dwLastError, _("Can't set value of '%s'"),
GetFullName(this, szValue));
- return FALSE;
+ return false;
}
bool wxRegKey::QueryValue(const wxChar *szValue, long *plValue) const
if ( m_dwLastError != ERROR_SUCCESS ) {
wxLogSysError(m_dwLastError, _("Can't read value of key '%s'"),
GetName().c_str());
- return FALSE;
+ return false;
}
else {
// check that we read the value of right type
wxASSERT_MSG( IsNumericValue(szValue),
wxT("Type mismatch in wxRegKey::QueryValue().") );
- return TRUE;
+ return true;
}
}
else
- return FALSE;
+ return false;
}
bool wxRegKey::SetValue(const wxChar *szValue,const wxMemoryBuffer& buffer)
{
#ifdef __TWIN32__
wxFAIL_MSG("RegSetValueEx not implemented by TWIN32");
- return FALSE;
+ return false;
#else
if ( CONST_CAST Open() ) {
m_dwLastError = RegSetValueEx((HKEY) m_hKey, szValue, (DWORD) RESERVED, REG_BINARY,
(RegBinary)buffer.GetData(),buffer.GetDataLen());
if ( m_dwLastError == ERROR_SUCCESS )
- return TRUE;
+ return true;
}
wxLogSysError(m_dwLastError, _("Can't set value of '%s'"),
GetFullName(this, szValue));
- return FALSE;
+ return false;
#endif
}
DWORD dwType, dwSize;
m_dwLastError = RegQueryValueEx((HKEY) m_hKey, WXSTRINGCAST szValue, RESERVED,
&dwType, NULL, &dwSize);
-
+
if ( m_dwLastError == ERROR_SUCCESS ) {
if ( dwSize ) {
const RegBinary pBuf = (RegBinary)buffer.GetWriteBuf(dwSize);
pBuf,
&dwSize);
buffer.UngetWriteBuf(dwSize);
- } else {
- buffer.SetDataLen(0);
+ } else {
+ buffer.SetDataLen(0);
}
}
-
+
if ( m_dwLastError != ERROR_SUCCESS ) {
wxLogSysError(m_dwLastError, _("Can't read value of key '%s'"),
GetName().c_str());
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
wxASSERT_MSG( !IsNumericValue(szValue),
wxT("Type mismatch in wxRegKey::QueryValue().") );
- return TRUE;
+ return true;
}
}
}
wxLogSysError(m_dwLastError, _("Can't read value of '%s'"),
GetFullName(this, szValue));
- return FALSE;
+ return false;
}
bool wxRegKey::SetValue(const wxChar *szValue, const wxString& strValue)
(RegString)strValue.c_str(),
(strValue.Len() + 1)*sizeof(wxChar));
if ( m_dwLastError == ERROR_SUCCESS )
- return TRUE;
+ return true;
}
wxLogSysError(m_dwLastError, _("Can't set value of '%s'"),
GetFullName(this, szValue));
- return FALSE;
+ return false;
}
wxString wxRegKey::QueryDefaultValue() const
bool wxRegKey::GetFirstValue(wxString& strValueName, long& lIndex)
{
if ( !Open(Read) )
- return FALSE;
+ return false;
lIndex = 0;
return GetNextValue(strValueName, lIndex);
// are we already at the end of enumeration?
if ( lIndex == -1 )
- return FALSE;
+ return false;
wxChar szValueName[1024]; // @@ use RegQueryInfoKey...
DWORD dwValueLen = WXSIZEOF(szValueName);
GetName().c_str());
}
- return FALSE;
+ return false;
}
strValueName = szValueName;
- return TRUE;
+ return true;
}
bool wxRegKey::GetFirstKey(wxString& strKeyName, long& lIndex)
{
if ( !Open(Read) )
- return FALSE;
+ return false;
lIndex = 0;
return GetNextKey(strKeyName, lIndex);
// are we already at the end of enumeration?
if ( lIndex == -1 )
- return FALSE;
+ return false;
wxChar szKeyName[_MAX_PATH + 1];
GetName().c_str());
}
- return FALSE;
+ return false;
}
strKeyName = szKeyName;
- return TRUE;
+ return true;
}
-// returns TRUE if the value contains a number (else it's some string)
+// returns true if the value contains a number (else it's some string)
bool wxRegKey::IsNumericValue(const wxChar *szValue) const
- {
- ValueType type = GetValueType(szValue);
- switch ( type ) {
+{
+ ValueType type = GetValueType(szValue);
+ switch ( type ) {
case Type_Dword:
/* case Type_Dword_little_endian: == Type_Dword */
case Type_Dword_big_endian:
- return TRUE;
+ return true;
default:
- return FALSE;
- }
- }
+ return false;
+ }
+}
// ============================================================================
// implementation of global private functions
{
// don't close this key itself for the case of empty szKey!
if ( wxIsEmpty(szKey) )
- return TRUE;
+ return true;
HKEY hkeyDummy;
if ( ::RegOpenKeyEx
{
::RegCloseKey(hkeyDummy);
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
const wxChar *GetFullName(const wxRegKey *pKey, const wxChar *szValue)
win, dc, size, position, orient, flags);
return;
}
-
+
// I don't know if it is correct to use the rebar background for the
// splitter but it least this works ok in the default theme
wxUxThemeHandle hTheme(win, L"REBAR");
if ( orient == wxVERTICAL )
{
rect.left = position;
- rect.right = position + SASH_WIDTH;
+ rect.right = position + SASH_WIDTH;
rect.top = 0;
rect.bottom = size.y;
}
0 /* no state */ ,
&rect,
NULL
- );
+ );
}
}