Revision: 7424
          http://mahogany.svn.sourceforge.net/mahogany/?rev=7424&view=rev
Author:   vadz
Date:     2008-04-22 15:34:54 -0700 (Tue, 22 Apr 2008)

Log Message:
-----------
implement support for faces in the text viewer

Modified Paths:
--------------
    trunk/M/src/modules/TextViewer.cpp

Modified: trunk/M/src/modules/TextViewer.cpp
===================================================================
--- trunk/M/src/modules/TextViewer.cpp  2008-04-22 22:03:54 UTC (rev 7423)
+++ trunk/M/src/modules/TextViewer.cpp  2008-04-22 22:34:54 UTC (rev 7424)
@@ -169,6 +169,59 @@
 };
 
 // ----------------------------------------------------------------------------
+// ClickableFace: a clickable object representing a face picture
+// ----------------------------------------------------------------------------
+
+class ClickableFace : public ClickableInfo
+{
+public:
+   ClickableFace(MessageView *msgView, wxBitmap face)
+      : ClickableInfo(msgView),
+        m_face(face)
+   {
+   }
+
+   virtual String GetLabel() const { return "Face picture"; }
+
+   virtual void OnLeftClick(const wxPoint& pt) const { DoShow(pt); }
+   virtual void OnRightClick(const wxPoint& /* pt */) const { }
+   virtual void OnDoubleClick(const wxPoint& /* pt */) const { }
+
+private:
+   class FaceWindow : public wxDialog
+   {
+   public:
+      FaceWindow(wxWindow *parent, const wxPoint& position, wxBitmap bmp)
+         : wxDialog(parent, wxID_ANY, _("Face picture"),
+                    position, wxDefaultSize,
+                    wxCAPTION | wxCLOSE_BOX),
+           m_bmp(bmp)
+      {
+         Connect(wxEVT_PAINT, wxPaintEventHandler(FaceWindow::OnPaint));
+
+         SetClientSize(bmp.GetWidth(), bmp.GetHeight());
+      }
+
+   private:
+      void OnPaint(wxPaintEvent& /* event */)
+      {
+         wxPaintDC dc(this);
+         dc.DrawBitmap(m_bmp, 0, 0);
+      }
+
+      wxBitmap m_bmp;
+   };
+
+   void DoShow(const wxPoint& pt) const
+   {
+      FaceWindow dlg(GetMessageView()->GetWindow(), pt, m_face);
+      dlg.ShowModal();
+   }
+
+   wxBitmap m_face;
+};
+
+// ----------------------------------------------------------------------------
 // TextViewerClickable: an object we can click on in the text control
 // ----------------------------------------------------------------------------
 
@@ -744,9 +797,16 @@
    InsertText(_T("\n"), MTextStyle());
 }
 
-void TextViewer::ShowXFace(const wxBitmap& /* bitmap */)
+void TextViewer::ShowXFace(const wxBitmap& bitmap)
 {
-   // we don't show XFaces
+   FlushText();
+
+   // we can't show faces in the control itself so insert a clickable object
+   // which shows it
+   m_window->InsertClickable(_("[Click here to see the face picture]"),
+                             new ClickableFace(m_msgView, bitmap),
+                             GetOptions().HeaderValueCol);
+   EndHeader();
 }
 
 void TextViewer::EndHeaders()


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Mahogany-cvsupdates mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to