]> git.saurik.com Git - wxWidgets.git/blobdiff - src/palmos/font.cpp
don't use wxVector<wxDataFormat> from wx/clipbrd.h as wxDataFormat definition is...
[wxWidgets.git] / src / palmos / font.cpp
index 3fa24740e965c1014913481f3c3f8368b598a066..56bc52c737355bd37c367366a0e276fef91d1ad6 100644 (file)
@@ -1,10 +1,10 @@
 /////////////////////////////////////////////////////////////////////////////
 // Name:        src/palmos/font.cpp
 // Purpose:     wxFont class
 /////////////////////////////////////////////////////////////////////////////
 // Name:        src/palmos/font.cpp
 // Purpose:     wxFont class
-// Author:      William Osborne
+// Author:      William Osborne - minimal working wxPalmOS port
 // Modified by:
 // Created:     10/14/04
 // Modified by:
 // Created:     10/14/04
-// RCS-ID:      $Id:
+// RCS-ID:      $Id$
 // Copyright:   (c) wxWidgets team
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 // Copyright:   (c) wxWidgets team
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 // headers
 // ----------------------------------------------------------------------------
 
 // headers
 // ----------------------------------------------------------------------------
 
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-    #pragma implementation "font.h"
-#endif
-
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
     #pragma hdrstop
 #endif
 
     #pragma hdrstop
 #endif
 
+#include "wx/font.h"
+
 #ifndef WX_PRECOMP
 #ifndef WX_PRECOMP
-    #include "wx/setup.h"
     #include "wx/list.h"
     #include "wx/utils.h"
     #include "wx/app.h"
     #include "wx/list.h"
     #include "wx/utils.h"
     #include "wx/app.h"
-    #include "wx/font.h"
     #include "wx/log.h"
     #include "wx/encinfo.h"
 #endif // WX_PRECOMP
     #include "wx/log.h"
     #include "wx/encinfo.h"
 #endif // WX_PRECOMP
@@ -111,9 +107,9 @@ public:
     wxFontRefData(int size,
                   const wxSize& pixelSize,
                   bool sizeUsingPixels,
     wxFontRefData(int size,
                   const wxSize& pixelSize,
                   bool sizeUsingPixels,
-                  int family,
-                  int style,
-                  int weight,
+                  wxFontFamily family,
+                  wxFontStyle style,
+                  wxFontWeight weight,
                   bool underlined,
                   const wxString& faceName,
                   wxFontEncoding encoding)
                   bool underlined,
                   const wxString& faceName,
                   wxFontEncoding encoding)
@@ -235,12 +231,12 @@ public:
         }
     }
 
         }
     }
 
-    void SetFamily(int family)
+    void SetFamily(wxFontFamily family)
     {
         m_family = family;
     }
 
     {
         m_family = family;
     }
 
-    void SetStyle(int style)
+    void SetStyle(wxFontStyle style)
     {
         if ( m_nativeFontInfoOk )
             m_nativeFontInfo.SetStyle((wxFontStyle)style);
     {
         if ( m_nativeFontInfoOk )
             m_nativeFontInfo.SetStyle((wxFontStyle)style);
@@ -248,7 +244,7 @@ public:
             m_style = style;
     }
 
             m_style = style;
     }
 
-    void SetWeight(int weight)
+    void SetWeight(wxFontWeight weight)
     {
         if ( m_nativeFontInfoOk )
             m_nativeFontInfo.SetWeight((wxFontWeight)weight);
     {
         if ( m_nativeFontInfoOk )
             m_nativeFontInfo.SetWeight((wxFontWeight)weight);
@@ -256,7 +252,7 @@ public:
             m_weight = weight;
     }
 
             m_weight = weight;
     }
 
-    void SetFaceName(const wxString& faceName)
+    bool SetFaceName(const wxString& faceName)
     {
         if ( m_nativeFontInfoOk )
             m_nativeFontInfo.SetFaceName(faceName);
     {
         if ( m_nativeFontInfoOk )
             m_nativeFontInfo.SetFaceName(faceName);
@@ -291,9 +287,9 @@ protected:
     void Init(int size,
               const wxSize& pixelSize,
               bool sizeUsingPixels,
     void Init(int size,
               const wxSize& pixelSize,
               bool sizeUsingPixels,
-              int family,
-              int style,
-              int weight,
+              wxFontFamily family,
+              wxFontStyle style,
+              wxFontWeight weight,
               bool underlined,
               const wxString& faceName,
               wxFontEncoding encoding);
               bool underlined,
               const wxString& faceName,
               wxFontEncoding encoding);
@@ -304,9 +300,9 @@ protected:
     int           m_pointSize;
     wxSize        m_pixelSize;
     bool          m_sizeUsingPixels;
     int           m_pointSize;
     wxSize        m_pixelSize;
     bool          m_sizeUsingPixels;
-    int           m_family;
-    int           m_style;
-    int           m_weight;
+    wxFontFamily  m_family;
+    wxFontStyle   m_style;
+    wxFontWeight  m_weight;
     bool          m_underlined;
     wxString      m_faceName;
     wxFontEncoding m_encoding;
     bool          m_underlined;
     wxString      m_faceName;
     wxFontEncoding m_encoding;
@@ -319,6 +315,8 @@ protected:
     bool             m_nativeFontInfoOk;
 };
 
     bool             m_nativeFontInfoOk;
 };
 
+#define M_FONTDATA ((wxFontRefData*)m_refData)
+
 // ============================================================================
 // implementation
 // ============================================================================
 // ============================================================================
 // implementation
 // ============================================================================
@@ -330,9 +328,9 @@ protected:
 void wxFontRefData::Init(int pointSize,
                          const wxSize& pixelSize,
                          bool sizeUsingPixels,
 void wxFontRefData::Init(int pointSize,
                          const wxSize& pixelSize,
                          bool sizeUsingPixels,
-                         int family,
-                         int style,
-                         int weight,
+                         wxFontFamily family,
+                         wxFontStyle style,
+                         wxFontWeight weight,
                          bool underlined,
                          const wxString& faceName,
                          wxFontEncoding encoding)
                          bool underlined,
                          const wxString& faceName,
                          wxFontEncoding encoding)
@@ -368,10 +366,6 @@ void wxNativeFontInfo::SetPixelSize(const wxSize& pixelSize)
 // wxFont
 // ----------------------------------------------------------------------------
 
 // wxFont
 // ----------------------------------------------------------------------------
 
-void wxFont::Init()
-{
-}
-
 bool wxFont::Create(const wxNativeFontInfo& info, WXHFONT hFont)
 {
     return false;
 bool wxFont::Create(const wxNativeFontInfo& info, WXHFONT hFont)
 {
     return false;
@@ -387,9 +381,9 @@ wxFont::wxFont(const wxString& fontdesc)
 bool wxFont::DoCreate(int pointSize,
                       const wxSize& pixelSize,
                       bool sizeUsingPixels,
 bool wxFont::DoCreate(int pointSize,
                       const wxSize& pixelSize,
                       bool sizeUsingPixels,
-                      int family,
-                      int style,
-                      int weight,
+                      wxFontFamily family,
+                      wxFontStyle style,
+                      wxFontWeight weight,
                       bool underlined,
                       const wxString& faceName,
                       wxFontEncoding encoding)
                       bool underlined,
                       const wxString& faceName,
                       wxFontEncoding encoding)
@@ -404,6 +398,15 @@ wxFont::~wxFont()
 // ----------------------------------------------------------------------------
 // real implementation
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // real implementation
 // ----------------------------------------------------------------------------
+wxGDIRefData *wxFont::CreateGDIRefData() const
+{
+    return new wxFontRefData();
+}
+
+wxGDIRefData *wxFont::CloneGDIRefData(const wxGDIRefData *data) const
+{
+    return new wxFontRefData(*static_cast<const wxFontRefData *>(data));
+}
 
 bool wxFont::RealizeResource()
 {
 
 bool wxFont::RealizeResource()
 {
@@ -425,10 +428,6 @@ bool wxFont::IsFree() const
     return false;
 }
 
     return false;
 }
 
-void wxFont::Unshare()
-{
-}
-
 // ----------------------------------------------------------------------------
 // change font attribute: we recreate font when doing it
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // change font attribute: we recreate font when doing it
 // ----------------------------------------------------------------------------
@@ -441,20 +440,21 @@ void wxFont::SetPixelSize(const wxSize& pixelSize)
 {
 }
 
 {
 }
 
-void wxFont::SetFamily(int family)
+void wxFont::SetFamily(wxFontFamily family)
 {
 }
 
 {
 }
 
-void wxFont::SetStyle(int style)
+void wxFont::SetStyle(wxFontStyle style)
 {
 }
 
 {
 }
 
-void wxFont::SetWeight(int weight)
+void wxFont::SetWeight(wxFontWeight weight)
 {
 }
 
 {
 }
 
-void wxFont::SetFaceName(const wxString& faceName)
+bool wxFont::SetFaceName(const wxString& faceName)
 {
 {
+    return true;
 }
 
 void wxFont::SetUnderlined(bool underlined)
 }
 
 void wxFont::SetUnderlined(bool underlined)
@@ -488,17 +488,17 @@ bool wxFont::IsUsingSizeInPixels() const
     return false;
 }
 
     return false;
 }
 
-int wxFont::GetFamily() const
+wxFontFamily wxFont::GetFamily() const
 {
     return wxFONTFAMILY_ROMAN;
 }
 
 {
     return wxFONTFAMILY_ROMAN;
 }
 
-int wxFont::GetStyle() const
+wxFontStyle wxFont::GetStyle() const
 {
     return wxFONTSTYLE_NORMAL;
 }
 
 {
     return wxFONTSTYLE_NORMAL;
 }
 
-int wxFont::GetWeight() const
+wxFontWeight wxFont::GetWeight() const
 {
     return wxFONTWEIGHT_NORMAL;
 }
 {
     return wxFONTWEIGHT_NORMAL;
 }
@@ -523,8 +523,25 @@ const wxNativeFontInfo *wxFont::GetNativeFontInfo() const
     return NULL;
 }
 
     return NULL;
 }
 
+wxString wxFont::GetNativeFontInfoDesc() const
+{
+    wxCHECK_MSG( Ok(), wxEmptyString, wxT("invalid font") );
+
+    // be sure we have an HFONT associated...
+    wxConstCast(this, wxFont)->RealizeResource();
+    return wxFontBase::GetNativeFontInfoDesc();
+}
+
+wxString wxFont::GetNativeFontInfoUserDesc() const
+{
+    wxCHECK_MSG( Ok(), wxEmptyString, wxT("invalid font") );
+
+    // be sure we have an HFONT associated...
+    wxConstCast(this, wxFont)->RealizeResource();
+    return wxFontBase::GetNativeFontInfoUserDesc();
+}
+
 bool wxFont::IsFixedWidth() const
 {
     return false;
 }
 bool wxFont::IsFixedWidth() const
 {
     return false;
 }
-