]> git.saurik.com Git - wxWidgets.git/commitdiff
PalmOS native colour dialog.
authorWłodzimierz Skiba <abx@abx.art.pl>
Tue, 18 Jan 2005 10:31:24 +0000 (10:31 +0000)
committerWłodzimierz Skiba <abx@abx.art.pl>
Tue, 18 Jan 2005 10:31:24 +0000 (10:31 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31444 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
docs/latex/wx/colour.tex
include/wx/colordlg.h
include/wx/palmos/colordlg.h
include/wx/palmos/setup0.h
src/palmos/colordlg.cpp

index 380862a04f676b70680dfe3cc532fe17f204552a..8a6b8487aa35e13badacaa2cfb44c01d638cc05e 100644 (file)
@@ -105,6 +105,7 @@ wxPalmOS:
 - enumeration of available volumes
 - native wxPrefConfig around Preferences database
 - native wxProgressDialog implementation
+- native wxColourDialog implementation
 - native wxSystemSettings colours
 
 
index 7cad445d00d989c06c43c061eb14ead8e183aa94..f77b1010e80d6c48c38716bcc96855fbec22cbf3 100644 (file)
@@ -198,7 +198,9 @@ Destructor.
 \constfunc{bool}{GetChooseFull}{\void}
 
 Under Windows, determines whether the Windows colour dialog will display the full dialog
-with custom colour selection controls. Has no meaning under other platforms.
+with custom colour selection controls. Under PalmOS, determines whether colour dialog
+will display full rgb colour picker or only available palette indexer.
+Has no meaning under other platforms.
 
 The default value is true.
 
index e953735ab7b88d2660c4fa1b02a078cb90f14432..6992910c67a7539b6e8cf1f81d1053a9dfa9f882 100644 (file)
@@ -22,6 +22,8 @@
     #include "wx/mac/colordlg.h"
 #elif defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
     #include "wx/gtk/colordlg.h"
+#elif defined(__WXPALMOS__)
+    #include "wx/palmos/colordlg.h"
 #else
     #include "wx/generic/colrdlgg.h"
 
index 227d5abf7945bce55e9a00d5c29a400cc160adca..b598e0f306b213c1330d309bf6242fea3920a878 100644 (file)
@@ -4,7 +4,7 @@
 // Author:      William Osborne
 // Modified by:
 // Created:     10/13/04
-// RCS-ID:      $Id: 
+// RCS-ID:      $Id:
 // Copyright:   (c) William Osborne
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -34,25 +34,10 @@ public:
 
     wxColourData& GetColourData() { return m_colourData; }
 
-    // override some base class virtuals
-    virtual void SetTitle(const wxString& title);
-    virtual wxString GetTitle() const;
-
     virtual int ShowModal();
 
-    virtual void DoGetPosition( int *x, int *y ) const;
-
 protected:
-    virtual void DoGetSize(int *width, int *height) const;
-    virtual void DoGetClientSize(int *width, int *height) const;
-    virtual void DoSetSize(int x, int y,
-                           int width, int height,
-                           int sizeFlags = wxSIZE_AUTO);
-
     wxColourData        m_colourData;
-    wxString            m_title;
-
-    wxPoint             m_pos;
 
     DECLARE_DYNAMIC_CLASS_NO_COPY(wxColourDialog)
 };
index 554f1b1a30e17cceb81a59bbc04fede98452d1c2..f34c915b4e47b6e83463fbfbe77872ad14c5f7b7 100644 (file)
 // Default is 1
 //
 // Recommended setting: 1
-#define wxUSE_COLOURDLG     0
+#define wxUSE_COLOURDLG     1
 
 // wxDirDlg class for getting a directory name from user
 #define wxUSE_DIRDLG 0
index b94f9f76840cded62e631ccd68018f66aa4739de..8c988dafbcfa10ecc970a68137a93aa59835b2a9 100644 (file)
@@ -4,7 +4,7 @@
 // Author:      William Osborne
 // Modified by:
 // Created:     10/13/04
-// RCS-ID:      $Id: 
+// RCS-ID:      $Id:
 // Copyright:   (c) William Osborne
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 #endif
 
 #ifndef WX_PRECOMP
-    #include <stdio.h>
     #include "wx/defs.h"
-    #include "wx/bitmap.h"
-    #include "wx/pen.h"
-    #include "wx/brush.h"
-    #include "wx/colour.h"
-    #include "wx/gdicmn.h"
-    #include "wx/utils.h"
-    #include "wx/frame.h"
-    #include "wx/dialog.h"
-    #include "wx/msgdlg.h"
-    #include "wx/math.h"
+    #include "wx/intl.h"
 #endif
 
-#if wxUSE_COLOURDLG && !defined(__SMARTPHONE__)
+#if wxUSE_COLOURDLG
 
-#include "wx/palmos/private.h"
-#include "wx/colordlg.h"
 #include "wx/cmndata.h"
-
-#include <stdlib.h>
-#include <string.h>
+#include "wx/colordlg.h"
 
 // ----------------------------------------------------------------------------
 // wxWin macros
@@ -72,76 +58,40 @@ wxColourDialog::wxColourDialog()
 
 wxColourDialog::wxColourDialog(wxWindow *parent, wxColourData *data)
 {
+    Create(parent, data);
 }
 
 bool wxColourDialog::Create(wxWindow *parent, wxColourData *data)
 {
-    return false;
-}
+    m_parent = parent;
 
-int wxColourDialog::ShowModal()
-{
-    return wxID_CANCEL;
-}
+    if (data)
+        m_colourData = *data;
 
-// ----------------------------------------------------------------------------
-// title
-// ----------------------------------------------------------------------------
-
-void wxColourDialog::SetTitle(const wxString& title)
-{
-    m_title = title;
+    return true;
 }
 
-wxString wxColourDialog::GetTitle() const
-{
-    return m_title;
-}
-
-// ----------------------------------------------------------------------------
-// position/size
-// ----------------------------------------------------------------------------
-
-void wxColourDialog::DoGetPosition(int *x, int *y) const
-{
-    if ( x )
-        *x = m_pos.x;
-    if ( y )
-        *y = m_pos.y;
-}
-
-void wxColourDialog::DoSetSize(int x, int y,
-                               int WXUNUSED(width), int WXUNUSED(height),
-                               int WXUNUSED(sizeFlags))
-{
-    if ( x != -1 )
-        m_pos.x = x;
-
-    if ( y != -1 )
-        m_pos.y = y;
-
-    // ignore the size params - we can't change the size of a standard dialog
-    return;
-}
-
-// NB: of course, both of these functions are completely bogus, but it's better
-//     than nothing
-void wxColourDialog::DoGetSize(int *width, int *height) const
-{
-    // the standard dialog size
-    if ( width )
-        *width = 225;
-    if ( height )
-        *height = 324;
-}
-
-void wxColourDialog::DoGetClientSize(int *width, int *height) const
+int wxColourDialog::ShowModal()
 {
-    // the standard dialog size
-    if ( width )
-        *width = 219;
-    if ( height )
-        *height = 299;
+    wxString title = _("Choose colour");
+
+    wxColour colour = m_colourData.GetColour();
+    RGBColorType rgb;
+    rgb.r = colour.Red();
+    rgb.g = colour.Green();
+    rgb.b = colour.Blue();
+    IndexedColorType i = WinRGBToIndex ( &rgb );
+
+    if (UIPickColor (&i,
+                     &rgb,
+                     (m_colourData.GetChooseFull()?UIPickColorStartRGB:UIPickColorStartPalette),
+                     title.ToAscii(),
+                     NULL) == false)
+        return wxID_CANCEL;
+
+    colour.Set(rgb.r, rgb.g, rgb.b);
+    m_colourData.SetColour(colour);
+    return wxID_OK;
 }
 
 #endif