X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ffecfa5aeb540b54914739dbb8603edbbd4c00a0..062dfc9a96dc9e796c53544f41ff92dc47f26e82:/src/palmos/colordlg.cpp diff --git a/src/palmos/colordlg.cpp b/src/palmos/colordlg.cpp index 9720f46368..8de8b5746b 100644 --- a/src/palmos/colordlg.cpp +++ b/src/palmos/colordlg.cpp @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// // Name: src/palmos/colordlg.cpp // Purpose: wxColourDialog class -// Author: William Osborne +// Author: William Osborne - minimal working wxPalmOS port // Modified by: // Created: 10/13/04 -// RCS-ID: $Id: +// RCS-ID: $Id$ // Copyright: (c) William Osborne // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -17,10 +17,6 @@ // headers // ---------------------------------------------------------------------------- -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma implementation "colordlg.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -28,29 +24,16 @@ #pragma hdrstop #endif -#ifndef WX_PRECOMP - #include - #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" -#endif - -#if wxUSE_COLOURDLG && !defined(__SMARTPHONE__) +#if wxUSE_COLOURDLG -#include "wx/palmos/private.h" #include "wx/colordlg.h" -#include "wx/cmndata.h" -#include -#include -#include +#ifndef WX_PRECOMP + #include "wx/intl.h" +#endif + +#include +#include // ---------------------------------------------------------------------------- // wxWin macros @@ -72,76 +55,40 @@ wxColourDialog::wxColourDialog() wxColourDialog::wxColourDialog(wxWindow *parent, wxColourData *data) { + Create(parent, data); } bool wxColourDialog::Create(wxWindow *parent, wxColourData *data) { - return false; -} - -int wxColourDialog::ShowModal() -{ - return wxID_CANCEL; -} - -// ---------------------------------------------------------------------------- -// title -// ---------------------------------------------------------------------------- - -void wxColourDialog::SetTitle(const wxString& title) -{ - m_title = title; -} + m_parent = parent; -wxString wxColourDialog::GetTitle() const -{ - return m_title; -} + if (data) + m_colourData = *data; -// ---------------------------------------------------------------------------- -// position/size -// ---------------------------------------------------------------------------- - -void wxColourDialog::DoGetPosition(int *x, int *y) const -{ - if ( x ) - *x = m_pos.x; - if ( y ) - *y = m_pos.y; + return true; } -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