1 /////////////////////////////////////////////////////////////////////////////
2 // Name: common/sysopt.cpp
3 // Purpose: wxSystemOptions
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ---------------------------------------------------------------------------
18 // ---------------------------------------------------------------------------
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
23 #if defined(__BORLANDC__)
27 #if wxUSE_SYSTEM_OPTIONS
33 #include "wx/string.h"
34 #include "wx/sysopt.h"
35 #include "wx/arrstr.h"
37 // ----------------------------------------------------------------------------
39 // ----------------------------------------------------------------------------
41 static wxArrayString gs_optionNames,
44 // ============================================================================
45 // wxSystemOptions implementation
46 // ============================================================================
48 // Option functions (arbitrary name/value mapping)
49 void wxSystemOptions::SetOption(const wxString& name, const wxString& value)
51 int idx = gs_optionNames.Index(name, false);
52 if (idx == wxNOT_FOUND)
54 gs_optionNames.Add(name);
55 gs_optionValues.Add(value);
59 gs_optionNames[idx] = name;
60 gs_optionValues[idx] = value;
64 void wxSystemOptions::SetOption(const wxString& name, int value)
66 SetOption(name, wxString::Format(wxT("%d"), value));
69 wxString wxSystemOptions::GetOption(const wxString& name)
71 int idx = gs_optionNames.Index(name, false);
72 if (idx == wxNOT_FOUND)
75 return gs_optionValues[idx];
78 int wxSystemOptions::GetOptionInt(const wxString& name)
80 return wxAtoi(GetOption(name));
83 bool wxSystemOptions::HasOption(const wxString& name)
85 return gs_optionNames.Index(name, false) != wxNOT_FOUND;
88 #endif // wxUSE_SYSTEM_OPTIONS