Use the same colour for miniframe title bar and
wxAUI title bars. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40781 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -13,6 +13,7 @@
|
|||||||
#if wxUSE_MINIFRAME
|
#if wxUSE_MINIFRAME
|
||||||
|
|
||||||
#include "wx/minifram.h"
|
#include "wx/minifram.h"
|
||||||
|
#include "wx/settings.h"
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/dcscreen.h"
|
#include "wx/dcscreen.h"
|
||||||
@@ -38,6 +39,28 @@ extern GtkWidget *wxGetRootWindow();
|
|||||||
// "expose_event" of m_mainWidget
|
// "expose_event" of m_mainWidget
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// StepColour() it a utility function that simply darkens
|
||||||
|
// or lightens a color, based on the specified percentage
|
||||||
|
static wxColor StepColour(const wxColor& c, int percent)
|
||||||
|
{
|
||||||
|
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" {
|
extern "C" {
|
||||||
static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_event, wxMiniFrame *win )
|
static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_event, wxMiniFrame *win )
|
||||||
{
|
{
|
||||||
@@ -64,20 +87,17 @@ static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *g
|
|||||||
(style & wxTINY_CAPTION_VERT)))
|
(style & wxTINY_CAPTION_VERT)))
|
||||||
{
|
{
|
||||||
wxClientDC dc(win);
|
wxClientDC dc(win);
|
||||||
|
// Hack alert
|
||||||
|
dc.m_window = pizza->bin_window;
|
||||||
|
|
||||||
dc.SetFont( *wxSMALL_FONT );
|
dc.SetFont( *wxSMALL_FONT );
|
||||||
int height = dc.GetCharHeight();
|
int height = dc.GetCharHeight();
|
||||||
|
|
||||||
GdkGC *gc = gdk_gc_new( pizza->bin_window );
|
wxBrush brush( LightContrastColour( wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT) ) );
|
||||||
gdk_gc_set_foreground( gc, &widget->style->bg[GTK_STATE_SELECTED] );
|
dc.SetBrush( brush );
|
||||||
gdk_draw_rectangle( pizza->bin_window, gc, TRUE,
|
dc.SetPen( *wxTRANSPARENT_PEN );
|
||||||
3,
|
dc.DrawRectangle( 3, 3, win->m_width - 7, height-2 );
|
||||||
3,
|
|
||||||
win->m_width - 7,
|
|
||||||
height+1 );
|
|
||||||
g_object_unref (gc);
|
|
||||||
|
|
||||||
// Hack alert
|
|
||||||
dc.m_window = pizza->bin_window;
|
|
||||||
dc.SetTextForeground( *wxWHITE );
|
dc.SetTextForeground( *wxWHITE );
|
||||||
dc.DrawText( win->GetTitle(), 6, 3 );
|
dc.DrawText( win->GetTitle(), 6, 3 );
|
||||||
|
|
||||||
@@ -252,7 +272,10 @@ bool wxMiniFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title
|
|||||||
if ((style & wxCAPTION) || (style & wxTINY_CAPTION_HORIZ) || (style & wxTINY_CAPTION_VERT))
|
if ((style & wxCAPTION) || (style & wxTINY_CAPTION_HORIZ) || (style & wxTINY_CAPTION_VERT))
|
||||||
m_miniTitle = 16;
|
m_miniTitle = 16;
|
||||||
|
|
||||||
m_miniEdge = 3;
|
if (style & wxRESIZE_BORDER)
|
||||||
|
m_miniEdge = 5;
|
||||||
|
else
|
||||||
|
m_miniEdge = 3;
|
||||||
m_isDragging = false;
|
m_isDragging = false;
|
||||||
m_oldX = -1;
|
m_oldX = -1;
|
||||||
m_oldY = -1;
|
m_oldY = -1;
|
||||||
|
Reference in New Issue
Block a user