PalmOS native colour dialog.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31444 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2005-01-18 10:31:24 +00:00
parent 23ee4b4874
commit f5d9cc735c
6 changed files with 35 additions and 95 deletions

View File

@@ -105,6 +105,7 @@ wxPalmOS:
- enumeration of available volumes - enumeration of available volumes
- native wxPrefConfig around Preferences database - native wxPrefConfig around Preferences database
- native wxProgressDialog implementation - native wxProgressDialog implementation
- native wxColourDialog implementation
- native wxSystemSettings colours - native wxSystemSettings colours

View File

@@ -198,7 +198,9 @@ Destructor.
\constfunc{bool}{GetChooseFull}{\void} \constfunc{bool}{GetChooseFull}{\void}
Under Windows, determines whether the Windows colour dialog will display the full dialog 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. The default value is true.

View File

@@ -22,6 +22,8 @@
#include "wx/mac/colordlg.h" #include "wx/mac/colordlg.h"
#elif defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) #elif defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
#include "wx/gtk/colordlg.h" #include "wx/gtk/colordlg.h"
#elif defined(__WXPALMOS__)
#include "wx/palmos/colordlg.h"
#else #else
#include "wx/generic/colrdlgg.h" #include "wx/generic/colrdlgg.h"

View File

@@ -4,7 +4,7 @@
// Author: William Osborne // Author: William Osborne
// Modified by: // Modified by:
// Created: 10/13/04 // Created: 10/13/04
// RCS-ID: $Id: // RCS-ID: $Id:
// Copyright: (c) William Osborne // Copyright: (c) William Osborne
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -34,25 +34,10 @@ public:
wxColourData& GetColourData() { return m_colourData; } wxColourData& GetColourData() { return m_colourData; }
// override some base class virtuals
virtual void SetTitle(const wxString& title);
virtual wxString GetTitle() const;
virtual int ShowModal(); virtual int ShowModal();
virtual void DoGetPosition( int *x, int *y ) const;
protected: 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; wxColourData m_colourData;
wxString m_title;
wxPoint m_pos;
DECLARE_DYNAMIC_CLASS_NO_COPY(wxColourDialog) DECLARE_DYNAMIC_CLASS_NO_COPY(wxColourDialog)
}; };

View File

@@ -710,7 +710,7 @@
// Default is 1 // Default is 1
// //
// Recommended setting: 1 // Recommended setting: 1
#define wxUSE_COLOURDLG 0 #define wxUSE_COLOURDLG 1
// wxDirDlg class for getting a directory name from user // wxDirDlg class for getting a directory name from user
#define wxUSE_DIRDLG 0 #define wxUSE_DIRDLG 0

View File

@@ -4,7 +4,7 @@
// Author: William Osborne // Author: William Osborne
// Modified by: // Modified by:
// Created: 10/13/04 // Created: 10/13/04
// RCS-ID: $Id: // RCS-ID: $Id:
// Copyright: (c) William Osborne // Copyright: (c) William Osborne
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -29,28 +29,14 @@
#endif #endif
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include <stdio.h>
#include "wx/defs.h" #include "wx/defs.h"
#include "wx/bitmap.h" #include "wx/intl.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"
#endif #endif
#if wxUSE_COLOURDLG && !defined(__SMARTPHONE__) #if wxUSE_COLOURDLG
#include "wx/palmos/private.h"
#include "wx/colordlg.h"
#include "wx/cmndata.h" #include "wx/cmndata.h"
#include "wx/colordlg.h"
#include <stdlib.h>
#include <string.h>
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxWin macros // wxWin macros
@@ -72,76 +58,40 @@ wxColourDialog::wxColourDialog()
wxColourDialog::wxColourDialog(wxWindow *parent, wxColourData *data) wxColourDialog::wxColourDialog(wxWindow *parent, wxColourData *data)
{ {
Create(parent, data);
} }
bool wxColourDialog::Create(wxWindow *parent, wxColourData *data) bool wxColourDialog::Create(wxWindow *parent, wxColourData *data)
{ {
return false; m_parent = parent;
if (data)
m_colourData = *data;
return true;
} }
int wxColourDialog::ShowModal() int wxColourDialog::ShowModal()
{ {
return wxID_CANCEL; wxString title = _("Choose colour");
}
// ---------------------------------------------------------------------------- wxColour colour = m_colourData.GetColour();
// title RGBColorType rgb;
// ---------------------------------------------------------------------------- rgb.r = colour.Red();
rgb.g = colour.Green();
rgb.b = colour.Blue();
IndexedColorType i = WinRGBToIndex ( &rgb );
void wxColourDialog::SetTitle(const wxString& title) if (UIPickColor (&i,
{ &rgb,
m_title = title; (m_colourData.GetChooseFull()?UIPickColorStartRGB:UIPickColorStartPalette),
} title.ToAscii(),
NULL) == false)
return wxID_CANCEL;
wxString wxColourDialog::GetTitle() const colour.Set(rgb.r, rgb.g, rgb.b);
{ m_colourData.SetColour(colour);
return m_title; return wxID_OK;
}
// ----------------------------------------------------------------------------
// 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
{
// the standard dialog size
if ( width )
*width = 219;
if ( height )
*height = 299;
} }
#endif #endif