+IMPLEMENT_DYNAMIC_CLASS(wxAuiManagerEvent, wxEvent)
+IMPLEMENT_CLASS(wxAuiManager, wxEvtHandler)
+
+
+
+const int auiToolBarLayer = 10;
+
+#ifndef __WXGTK20__
+
+
+class wxPseudoTransparentFrame : public wxFrame
+{
+public:
+ wxPseudoTransparentFrame(wxWindow* parent = NULL,
+ wxWindowID id = wxID_ANY,
+ const wxString& title = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_FRAME_STYLE,
+ const wxString &name = wxT("frame"))
+ : wxFrame(parent, id, title, pos, size, style | wxFRAME_SHAPED, name)
+ {
+ SetBackgroundStyle(wxBG_STYLE_CUSTOM);
+ m_amount=0;
+ m_maxWidth=0;
+ m_maxHeight=0;
+ m_lastWidth=0;
+ m_lastHeight=0;
+#ifdef __WXGTK__
+ m_canSetShape = false; // have to wait for window create event on GTK
+#else
+ m_canSetShape = true;
+#endif
+ m_region = wxRegion(0, 0, 0, 0);
+ SetTransparent(0);
+ }
+
+ virtual bool SetTransparent(wxByte alpha)
+ {
+ if (m_canSetShape)
+ {
+ int w=100; // some defaults
+ int h=100;
+ GetClientSize(&w, &h);
+
+ m_maxWidth = w;
+ m_maxHeight = h;
+ m_amount = alpha;
+ m_region.Clear();
+// m_region.Union(0, 0, 1, m_maxWidth);
+ if (m_amount)
+ {
+ for (int y=0; y<m_maxHeight; y++)
+ {
+ // Reverse the order of the bottom 4 bits
+ int j=((y&8)?1:0)|((y&4)?2:0)|((y&2)?4:0)|((y&1)?8:0);
+ if ((j*16+8)<m_amount)
+ m_region.Union(0, y, m_maxWidth, 1);
+ }
+ }
+ SetShape(m_region);
+ Refresh();
+ }
+ return true;
+ }
+
+ void OnPaint(wxPaintEvent& WXUNUSED(event))
+ {
+ wxPaintDC dc(this);
+
+ if (m_region.IsEmpty())
+ return;
+
+#ifdef __WXMAC__
+ dc.SetBrush(wxColour(128, 192, 255));
+#else
+ dc.SetBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_ACTIVECAPTION));
+#endif
+ dc.SetPen(*wxTRANSPARENT_PEN);
+
+ wxRegionIterator upd(GetUpdateRegion()); // get the update rect list
+
+ while (upd)
+ {
+ wxRect rect(upd.GetRect());
+ dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height);
+
+ ++upd;
+ }
+ }
+
+#ifdef __WXGTK__
+ void OnWindowCreate(wxWindowCreateEvent& WXUNUSED(event))
+ {
+ m_canSetShape=true;
+ SetTransparent(0);
+ }
+#endif
+
+ void OnSize(wxSizeEvent& event)
+ {
+ // We sometimes get surplus size events
+ if ((event.GetSize().GetWidth() == m_lastWidth) &&
+ (event.GetSize().GetHeight() == m_lastHeight))
+ {
+ event.Skip();
+ return;
+ }
+ m_lastWidth = event.GetSize().GetWidth();
+ m_lastHeight = event.GetSize().GetHeight();
+
+ SetTransparent(m_amount);
+ m_region.Intersect(0, 0, event.GetSize().GetWidth(),
+ event.GetSize().GetHeight());
+ SetShape(m_region);
+ Refresh();
+ event.Skip();
+ }
+
+private:
+ wxByte m_amount;
+ int m_maxWidth;
+ int m_maxHeight;
+ bool m_canSetShape;
+ int m_lastWidth,m_lastHeight;
+
+ wxRegion m_region;
+
+ DECLARE_DYNAMIC_CLASS(wxPseudoTransparentFrame)
+ DECLARE_EVENT_TABLE()
+};
+
+
+IMPLEMENT_DYNAMIC_CLASS(wxPseudoTransparentFrame, wxFrame)
+
+BEGIN_EVENT_TABLE(wxPseudoTransparentFrame, wxFrame)
+ EVT_PAINT(wxPseudoTransparentFrame::OnPaint)
+ EVT_SIZE(wxPseudoTransparentFrame::OnSize)
+#ifdef __WXGTK__
+ EVT_WINDOW_CREATE(wxPseudoTransparentFrame::OnWindowCreate)
+#endif
+END_EVENT_TABLE()
+
+
+#else
+ // __WXGTK20__
+
+#include <gtk/gtk.h>
+#include "wx/gtk/private/gtk2-compat.h"
+
+static void
+gtk_pseudo_window_realized_callback( GtkWidget *m_widget, void *WXUNUSED(win) )
+{
+ wxSize disp = wxGetDisplaySize();
+ int amount = 128;
+ wxRegion region;
+ for (int y=0; y<disp.y; y++)
+ {
+ // Reverse the order of the bottom 4 bits
+ int j=((y&8)?1:0)|((y&4)?2:0)|((y&2)?4:0)|((y&1)?8:0);
+ if ((j*16+8)<amount)
+ region.Union(0, y, disp.x, 1);
+ }
+ gdk_window_shape_combine_region(gtk_widget_get_window(m_widget), region.GetRegion(), 0, 0);
+}
+
+
+class wxPseudoTransparentFrame: public wxFrame
+{
+public:
+ wxPseudoTransparentFrame(wxWindow* parent = NULL,
+ wxWindowID id = wxID_ANY,
+ const wxString& title = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_FRAME_STYLE,
+ const wxString &name = wxT("frame"))
+ {
+ if (!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
+ return;
+
+ m_title = title;
+
+ m_widget = gtk_window_new( GTK_WINDOW_POPUP );
+ g_object_ref(m_widget);
+
+ if (parent) parent->AddChild(this);
+
+ g_signal_connect( m_widget, "realize",
+ G_CALLBACK (gtk_pseudo_window_realized_callback), this );
+
+ GdkColor col;
+ col.red = 128 * 256;
+ col.green = 192 * 256;
+ col.blue = 255 * 256;
+ gtk_widget_modify_bg( m_widget, GTK_STATE_NORMAL, &col );
+ }
+
+ bool SetTransparent(wxByte WXUNUSED(alpha))
+ {
+ return true;
+ }
+
+protected:
+ virtual void DoSetSizeHints( int minW, int minH,
+ int maxW, int maxH,
+ int incW, int incH)
+ {
+ // the real wxFrame method doesn't work for us because we're not really
+ // a top level window so skip it
+ wxWindow::DoSetSizeHints(minW, minH, maxW, maxH, incW, incH);
+ }
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxPseudoTransparentFrame)
+};
+
+IMPLEMENT_DYNAMIC_CLASS(wxPseudoTransparentFrame, wxFrame)
+
+#endif
+ // __WXGTK20__
+
+