]> git.saurik.com Git - wxWidgets.git/commitdiff
added wxTo/FromString(wxColour) (part of patch 1753875)
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 21 Jul 2007 23:24:10 +0000 (23:24 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 21 Jul 2007 23:24:10 +0000 (23:24 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47632 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/latex/wx/function.tex
include/wx/colour.h
src/common/colourcmn.cpp

index 18632a68561320692f80ac98f9db290a7c81a290..3c70a4f6bfbf7d2eda02a79bca95094c9e032882 100644 (file)
@@ -3261,6 +3261,15 @@ Find the deepest window at the mouse pointer position, returning the window
 and current pointer position in screen coordinates.
 
 
+\membersection{wxFromString}\label{wxfromstring}
+
+\func{bool} {wxFromString}{\param{const wxString\& }{str},
+                           \param{wxColourBase* }{col}}
+
+Converts string to the type of the second argument. Returns \true on success.
+See also: \helpref{wxToString}{wxtostring}.
+
+
 \membersection{::wxGetActiveWindow}\label{wxgetactivewindow}
 
 \func{wxWindow *}{wxGetActiveWindow}{\void}
@@ -3576,6 +3585,14 @@ class name internally. Example of using the macro:
 Notice that there should be no semicolon after this macro.
 
 
+\membersection{wxToString}\label{wxtostring}
+
+\func{wxString} {wxToString}{\param{const wxColourBase\& }{col}}
+
+Converts its argument to string.
+See also: \helpref{wxFromString}{wxfromstring}.
+
+
 \membersection{wxULL}\label{wxull}
 
 \func{wxLongLong\_t}{wxULL}{\param{}{number}}
index ecce9a4943cb8fb9cd9b3aa0a033c0a30cff7e8e..afe6371475551745b7588cf3d6b626e353ef4f6a 100644 (file)
@@ -122,6 +122,11 @@ protected:
 };
 
 
+// wxColour <-> wxString utilities, used by wxConfig, defined in colourcmn.cpp
+WXDLLIMPEXP_CORE wxString wxToString(const wxColourBase& col);
+WXDLLIMPEXP_CORE bool wxFromString(const wxString& str, wxColourBase* col);
+
+
 
 #if defined(__WXPALMOS__)
     #include "wx/generic/colour.h"
index 4868f808f2d5ad27cb0b0a18451207da50065559..99243dd383ee5a444f8fcb103dc1750b62ccf4ad 100644 (file)
@@ -163,3 +163,25 @@ void wxColourBase::InitFromName(const wxString& col)
 }
 
 #endif // WXWIN_COMPATIBILITY_2_6
+
+// wxColour <-> wxString utilities, used by wxConfig
+wxString wxToString(const wxColourBase& col)
+{
+    return col.IsOk() ? col.GetAsString(wxC2S_CSS_SYNTAX)
+                      : wxString();
+}
+
+bool wxFromString(const wxString& str, wxColourBase *col)
+{
+    wxCHECK_MSG( col, false, _T("NULL output parameter") );
+
+    if ( str.empty() )
+    {
+        *col = wxNullColour;
+        return true;
+    }
+
+    return col->Set(str);
+}
+
+