]> git.saurik.com Git - wxWidgets.git/commitdiff
added wxBitmap::CopyFromIcon and wxIcon::CopyFromBitmap to wxMotif
authorVáclav Slavík <vslavik@fastmail.fm>
Fri, 22 Mar 2002 19:14:33 +0000 (19:14 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Fri, 22 Mar 2002 19:14:33 +0000 (19:14 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14726 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/motif/bitmap.h
include/wx/motif/icon.h
src/motif/bitmap.cpp
src/motif/icon.cpp

index 23f8bcd9bef656e04dcd118bcc9cbaddc1f8e76f..943f34cae15a25d150e8a49fa4582d2ce11f76c5 100644 (file)
@@ -171,6 +171,9 @@ public:
     virtual bool SaveFile(const wxString& name, int type, const wxPalette *cmap = NULL);
     
     wxImage ConvertToImage() const;
+
+    // copies the contents and mask of the given (colour) icon to the bitmap
+    virtual bool CopyFromIcon(const wxIcon& icon);
     
     bool Ok() const { return (M_BITMAPDATA && M_BITMAPDATA->m_ok); }
     int GetWidth() const { return (M_BITMAPDATA ? M_BITMAPDATA->m_width : 0); }
index 4ddc46c3363c3a9667700ac7f34e868a303a670b..365e581757ecb7bc7c212368aff1f766b7247784 100644 (file)
@@ -45,6 +45,11 @@ public:
     
     bool LoadFile(const wxString& name, long flags = wxBITMAP_TYPE_XPM,
         int desiredWidth = -1, int desiredHeight = -1);
+
+    // create from bitmap (which should have a mask unless it's monochrome):
+    // there shouldn't be any implicit bitmap -> icon conversion (i.e. no
+    // ctors, assignment operators...), but it's ok to have such function
+    void CopyFromBitmap(const wxBitmap& bmp);
     
     inline wxIcon& operator = (const wxIcon& icon) { if (*this == icon) return (*this); Ref(icon); return *this; }
     inline bool operator == (const wxIcon& icon) const { return m_refData == icon.m_refData; }
index dc6bb3bb82f27278cd23362a1ec684f503ce6310..4747f9ab1d1d4a4946911dd18fbb035714cce0a8 100644 (file)
@@ -167,6 +167,12 @@ bool wxBitmap::CreateFromXpm(const char **bits)
     return Create(bits, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
 }
 
+bool wxBitmap::CopyFromIcon(const wxIcon& icon)
+{
+    *this = icon;
+    return TRUE;
+}
+
 bool wxBitmap::Create(int w, int h, int d)
 {
     UnRef();
index 96905576b3364d0a4eb414ec09ed18a10af92c23..a31a6f0646d3141e832f686536e7d24897d09e31 100644 (file)
@@ -61,6 +61,12 @@ wxIcon::wxIcon(const wxString& icon_file, long flags,
     LoadFile(icon_file, flags, desiredWidth, desiredHeight);
 }
 
+void wxIcon::CopyFromBitmap(const wxBitmap& bmp)
+{
+    wxIcon *icon = (wxIcon*)(&bmp);
+    *this = *icon;
+}
+
 wxIcon::~wxIcon()
 {
 }