From 8de6b9bbb8259608d7ec8bdab0c4d3d7910ea2b6 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 23 Mar 2005 20:48:50 +0000 Subject: [PATCH] added IsFalse() to simplify code doing HasOption(very-long-option-name) && !GetOptionInt(the-same-very-long-option-name) elsewhere git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33004 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/latex/wx/sysopt.tex | 10 ++++++++++ include/wx/sysopt.h | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/docs/latex/wx/sysopt.tex b/docs/latex/wx/sysopt.tex index 4a8a6ee7fc..91ffd8eba4 100644 --- a/docs/latex/wx/sysopt.tex +++ b/docs/latex/wx/sysopt.tex @@ -125,6 +125,16 @@ Returns \true if the given option is present. The function is case-insensitive t \helpref{wxSystemOptions::GetOptionInt}{wxsystemoptionsgetoptionint} +\membersection{wxSystemOptions::IsFalse}\label{wxsystemoptionsisfalse} + +\constfunc{bool}{IsFalse}{\param{const wxString\&}{ name}} + +Returns \true if the option with the given \arg{name} had been set to $0$ +value. This is mostly useful for boolean options for which you can't use +\texttt{GetOptionInt(name) == 0} as this would also be true if the option +hadn't been set at all. + + \membersection{wxSystemOptions::SetOption}\label{wxsystemoptionssetoption} \func{void}{SetOption}{\param{const wxString\&}{ name}, \param{const wxString\&}{ value}} diff --git a/include/wx/sysopt.h b/include/wx/sysopt.h index 90d802215b..0b8a771666 100644 --- a/include/wx/sysopt.h +++ b/include/wx/sysopt.h @@ -34,6 +34,11 @@ public: static wxString GetOption(const wxString& name); static int GetOptionInt(const wxString& name); static bool HasOption(const wxString& name); + + static bool IsFalse(const wxString& name) + { + return HasOption(name) && GetOptionInt(name) == 0; + } }; #if !wxUSE_SYSTEM_OPTIONS -- 2.45.2