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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
21 #pragma implementation "sysopt.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
27 #if defined(__BORLANDC__)
31 #if wxUSE_SYSTEM_OPTIONS
37 #include "wx/string.h"
38 #include "wx/sysopt.h"
39 #include "wx/arrstr.h"
41 // ----------------------------------------------------------------------------
43 // ----------------------------------------------------------------------------
45 static wxArrayString gs_optionNames,
48 // ============================================================================
49 // wxSystemOptions implementation
50 // ============================================================================
52 // Option functions (arbitrary name/value mapping)
53 void wxSystemOptions::SetOption(const wxString& name, const wxString& value)
55 int idx = gs_optionNames.Index(name, false);
56 if (idx == wxNOT_FOUND)
58 gs_optionNames.Add(name);
59 gs_optionValues.Add(value);
63 gs_optionNames[idx] = name;
64 gs_optionValues[idx] = value;
68 void wxSystemOptions::SetOption(const wxString& name, int value)
70 SetOption(name, wxString::Format(wxT("%d"), value));
73 wxString wxSystemOptions::GetOption(const wxString& name)
75 int idx = gs_optionNames.Index(name, false);
76 if (idx == wxNOT_FOUND)
79 return gs_optionValues[idx];
82 int wxSystemOptions::GetOptionInt(const wxString& name)
84 return wxAtoi(GetOption(name));
87 bool wxSystemOptions::HasOption(const wxString& name)
89 return gs_optionNames.Index(name, false) != wxNOT_FOUND;
92 #endif // wxUSE_SYSTEM_OPTIONS