+ int r = c.Red(), g = c.Green(), b = c.Blue();
+ return wxColour((unsigned char)wxMin((r*percent)/100,255),
+ (unsigned char)wxMin((g*percent)/100,255),
+ (unsigned char)wxMin((b*percent)/100,255));
+}
+
+static wxColor LightContrastColour(const wxColour& c)
+{
+ int amount = 120;
+
+ // if the color is especially dark, then
+ // make the contrast even lighter
+ if (c.Red() < 128 && c.Green() < 128 && c.Blue() < 128)
+ amount = 160;
+
+ return StepColour(c, amount);
+}
+
+extern "C" {
+static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_event, wxMiniFrame *win )
+{
+ // don't need to install idle handler, its done from "event" signal
+
+ if (!win->m_hasVMT) return;
+ if (gdk_event->count > 0) return;
+
+ GtkPizza *pizza = GTK_PIZZA(widget);
+
+ gtk_paint_shadow (widget->style,
+ pizza->bin_window,
+ GTK_STATE_NORMAL,
+ GTK_SHADOW_OUT,
+ NULL, NULL, NULL, // FIXME: No clipping?
+ 0, 0,
+ win->m_width, win->m_height);
+
+ int style = win->GetWindowStyle();
+
+ wxClientDC dc(win);
+ // Hack alert
+ dc.m_window = pizza->bin_window;
+
+ if (style & wxRESIZE_BORDER)
+ {
+ dc.SetBrush( *wxGREY_BRUSH );
+ dc.SetPen( *wxTRANSPARENT_PEN );
+ dc.DrawRectangle( win->m_width - 14, win->m_height-14, 14, 14 );
+ }
+
+ if (!win->GetTitle().empty() &&
+ ((style & wxCAPTION) ||
+ (style & wxTINY_CAPTION_HORIZ) ||
+ (style & wxTINY_CAPTION_VERT)))
+ {
+ dc.SetFont( *wxSMALL_FONT );
+ int height = dc.GetCharHeight();
+
+ wxBrush brush( LightContrastColour( wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT) ) );
+ dc.SetBrush( brush );
+ dc.SetPen( *wxTRANSPARENT_PEN );
+ dc.DrawRectangle( 3, 3, win->m_width - 7, height-2 );
+
+ dc.SetTextForeground( *wxWHITE );
+ dc.DrawText( win->GetTitle(), 6, 3 );
+
+ if (style & wxCLOSE_BOX)
+ dc.DrawBitmap( win->m_closeButton, win->m_width-19, 3, true );
+ }
+}