added wxRendererNative to be used by the generic controls for rendering platfomr-specific parts
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22151 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -417,9 +417,6 @@ protected:
|
|||||||
|
|
||||||
wxTimer *m_renameTimer;
|
wxTimer *m_renameTimer;
|
||||||
|
|
||||||
wxBitmap *m_arrowRight,
|
|
||||||
*m_arrowDown;
|
|
||||||
|
|
||||||
// incremental search data
|
// incremental search data
|
||||||
wxString m_findPrefix;
|
wxString m_findPrefix;
|
||||||
wxTimer *m_findTimer;
|
wxTimer *m_findTimer;
|
||||||
|
116
include/wx/renderer.h
Normal file
116
include/wx/renderer.h
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: wx/renderer.h
|
||||||
|
// Purpose: wxRendererNative class declaration
|
||||||
|
// Author: Vadim Zeitlin
|
||||||
|
// Modified by:
|
||||||
|
// Created: 20.07.2003
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwindows.org>
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/*
|
||||||
|
Renderers are used in wxWindows for two similar but different things:
|
||||||
|
(a) wxUniversal uses them to draw everything, i.e. all the control
|
||||||
|
(b) all the native ports use them to draw generic controls only
|
||||||
|
|
||||||
|
wxUniversal needs more functionality than what is included in the base class
|
||||||
|
as it needs to draw stuff like scrollbars which are never going to be
|
||||||
|
generic. So we put the bare minimum needed by the native ports here and the
|
||||||
|
full wxRenderer class is declared in wx/univ/renderer.h and is only used by
|
||||||
|
wxUniveral (although note that native ports can load wxRenderer objects from
|
||||||
|
theme DLLs and use them as wxRendererNative ones, of course).
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _WX_RENDERER_H_
|
||||||
|
#define _WX_RENDERER_H_
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// constants
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// control state flags used in wxRenderer and wxColourScheme
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
wxCONTROL_DISABLED = 0x00000001, // control is disabled
|
||||||
|
wxCONTROL_FOCUSED = 0x00000002, // currently has keyboard focus
|
||||||
|
wxCONTROL_PRESSED = 0x00000004, // (button) is pressed
|
||||||
|
wxCONTROL_ISDEFAULT = 0x00000008, // only applies to the buttons
|
||||||
|
wxCONTROL_ISSUBMENU = wxCONTROL_ISDEFAULT, // only for menu items
|
||||||
|
wxCONTROL_EXPANDED = wxCONTROL_ISDEFAULT, // only for the tree items
|
||||||
|
wxCONTROL_CURRENT = 0x00000010, // mouse is currently over the control
|
||||||
|
wxCONTROL_SELECTED = 0x00000020, // selected item in e.g. listbox
|
||||||
|
wxCONTROL_CHECKED = 0x00000040, // (check/radio button) is checked
|
||||||
|
wxCONTROL_CHECKABLE = 0x00000080, // (menu) item can be checked
|
||||||
|
|
||||||
|
wxCONTROL_FLAGS_MASK = 0x000000ff,
|
||||||
|
|
||||||
|
// this is a pseudo flag not used directly by wxRenderer but rather by some
|
||||||
|
// controls internally
|
||||||
|
wxCONTROL_DIRTY = 0x80000000
|
||||||
|
};
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxRendererNative: abstracts drawing methods needed by the native controls
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class WXDLLEXPORT wxRendererNative
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// drawing functions
|
||||||
|
// -----------------
|
||||||
|
|
||||||
|
// draw the header control button (used by wxListCtrl)
|
||||||
|
virtual void DrawHeaderButton(wxWindow *win,
|
||||||
|
wxDC& dc,
|
||||||
|
const wxRect& rect,
|
||||||
|
int flags = 0) = 0;
|
||||||
|
|
||||||
|
// draw the expanded/collapsed icon for a tree control item
|
||||||
|
virtual void DrawTreeItemButton(wxWindow *win,
|
||||||
|
wxDC& dc,
|
||||||
|
const wxRect& rect,
|
||||||
|
int flags = 0) = 0;
|
||||||
|
|
||||||
|
|
||||||
|
// pseudo constructors
|
||||||
|
// -------------------
|
||||||
|
|
||||||
|
// return the currently used renderer
|
||||||
|
static wxRendererNative& Get();
|
||||||
|
|
||||||
|
// return the generic implementation of the renderer
|
||||||
|
static wxRendererNative& GetGeneric();
|
||||||
|
};
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxDelegateRendererNative: allows reuse of renderers code
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class WXDLLEXPORT wxDelegateRendererNative : public wxRendererNative
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxDelegateRendererNative()
|
||||||
|
: m_rendererNative(GetGeneric()) { }
|
||||||
|
|
||||||
|
wxDelegateRendererNative(wxRendererNative& rendererNative)
|
||||||
|
: m_rendererNative(rendererNative) { }
|
||||||
|
|
||||||
|
|
||||||
|
virtual void DrawHeaderButton(wxWindow *win,
|
||||||
|
wxDC& dc,
|
||||||
|
const wxRect& rect,
|
||||||
|
int flags = 0)
|
||||||
|
{ m_rendererNative.DrawHeaderButton(win, dc, rect, flags); }
|
||||||
|
virtual void DrawTreeItemButton(wxWindow *win,
|
||||||
|
wxDC& dc,
|
||||||
|
const wxRect& rect,
|
||||||
|
int flags = 0)
|
||||||
|
{ m_rendererNative.DrawTreeItemButton(win, dc, rect, flags); }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
wxRendererNative& m_rendererNative;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _WX_RENDERER_H_
|
||||||
|
|
@@ -122,34 +122,33 @@ enum wxTreeItemIcon
|
|||||||
wxTreeItemIcon_Max
|
wxTreeItemIcon_Max
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
// ----------------------------------------------------------------------------
|
||||||
* wxTreeCtrl flags
|
// wxTreeCtrl flags
|
||||||
*/
|
// ----------------------------------------------------------------------------
|
||||||
// TODO: maybe renumber these?
|
|
||||||
#define wxTR_NO_BUTTONS 0x0000 // for convenience
|
#define wxTR_NO_BUTTONS 0x0000 // for convenience
|
||||||
#define wxTR_HAS_BUTTONS 0x0001 // generates a +/- button
|
#define wxTR_HAS_BUTTONS 0x0001 // draw collapsed/expanded btns
|
||||||
#define wxTR_TWIST_BUTTONS 0x0002 // generates a twister button
|
#define wxTR_NO_LINES 0x0004 // don't draw lines at all
|
||||||
#define wxTR_NO_LINES 0x0004 // don't generate level connectors
|
|
||||||
#define wxTR_LINES_AT_ROOT 0x0008 // connect top-level nodes
|
#define wxTR_LINES_AT_ROOT 0x0008 // connect top-level nodes
|
||||||
#define wxTR_MAC_BUTTONS wxTR_TWIST_BUTTONS // backward compatibility
|
|
||||||
#define wxTR_AQUA_BUTTONS 0x0010 // used internally
|
|
||||||
|
|
||||||
#define wxTR_SINGLE 0x0000 // for convenience
|
#define wxTR_SINGLE 0x0000 // for convenience
|
||||||
#define wxTR_MULTIPLE 0x0020 // can select multiple items
|
#define wxTR_MULTIPLE 0x0020 // can select multiple items
|
||||||
#define wxTR_EXTENDED 0x0040 // TODO: allow extended selection
|
#define wxTR_EXTENDED 0x0040 // TODO: allow extended selection
|
||||||
#define wxTR_FULL_ROW_HIGHLIGHT 0x2000 // highlight full horizontal space
|
#define wxTR_HAS_VARIABLE_ROW_HEIGHT 0x0080 // what it says
|
||||||
|
|
||||||
#define wxTR_EDIT_LABELS 0x0200 // can edit item labels
|
#define wxTR_EDIT_LABELS 0x0200 // can edit item labels
|
||||||
#define wxTR_ROW_LINES 0x0400 // put border around items
|
#define wxTR_ROW_LINES 0x0400 // put border around items
|
||||||
#define wxTR_HIDE_ROOT 0x0800 // don't display root node
|
#define wxTR_HIDE_ROOT 0x0800 // don't display root node
|
||||||
#define wxTR_HAS_VARIABLE_ROW_HEIGHT 0x0080 // what it says
|
|
||||||
|
|
||||||
// TODO: different default styles for wxGTK, wxMotif, whatever?
|
#define wxTR_FULL_ROW_HIGHLIGHT 0x2000 // highlight full horz space
|
||||||
#ifdef __WXMAC__
|
|
||||||
#define wxTR_DEFAULT_STYLE (wxTR_TWIST_BUTTONS|wxTR_NO_LINES|wxTR_ROW_LINES)
|
#define wxTR_DEFAULT_STYLE (wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT)
|
||||||
#else
|
|
||||||
#define wxTR_DEFAULT_STYLE (wxTR_HAS_BUTTONS|wxTR_LINES_AT_ROOT)
|
// deprecated, don't use
|
||||||
#endif
|
#define wxTR_TWIST_BUTTONS 0
|
||||||
|
#define wxTR_MAC_BUTTONS 0
|
||||||
|
#define wxTR_AQUA_BUTTONS 0
|
||||||
|
|
||||||
|
|
||||||
// values for the `flags' parameter of wxTreeCtrl::HitTest() which determine
|
// values for the `flags' parameter of wxTreeCtrl::HitTest() which determine
|
||||||
// where exactly the specified point is situated:
|
// where exactly the specified point is situated:
|
||||||
|
@@ -18,7 +18,11 @@
|
|||||||
renderers and provide the functionality which is often similar or identical
|
renderers and provide the functionality which is often similar or identical
|
||||||
in all renderers (using inheritance here would be more restrictive as the
|
in all renderers (using inheritance here would be more restrictive as the
|
||||||
given concrete renderer may need an arbitrary subset of the base class
|
given concrete renderer may need an arbitrary subset of the base class
|
||||||
methods)
|
methods).
|
||||||
|
|
||||||
|
Finally note that wxRenderer supersedes wxRendererNative in wxUniv build and
|
||||||
|
includes the latters functionality (which it may delegate to the generic
|
||||||
|
implementation of the latter or reimplement itself).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -28,6 +32,8 @@
|
|||||||
#ifndef _WX_UNIV_RENDERER_H_
|
#ifndef _WX_UNIV_RENDERER_H_
|
||||||
#define _WX_UNIV_RENDERER_H_
|
#define _WX_UNIV_RENDERER_H_
|
||||||
|
|
||||||
|
#include "wx/renderer.h"
|
||||||
|
|
||||||
class WXDLLEXPORT wxDC;
|
class WXDLLEXPORT wxDC;
|
||||||
class WXDLLEXPORT wxCheckListBox;
|
class WXDLLEXPORT wxCheckListBox;
|
||||||
class WXDLLEXPORT wxListBox;
|
class WXDLLEXPORT wxListBox;
|
||||||
@@ -59,7 +65,7 @@ public:
|
|||||||
// wxRenderer: abstract renderers interface
|
// wxRenderer: abstract renderers interface
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLEXPORT wxRenderer
|
class WXDLLEXPORT wxRenderer : public wxDelegateRendererNative
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// drawing functions
|
// drawing functions
|
||||||
@@ -458,6 +464,7 @@ public:
|
|||||||
// virtual dtor for any base class
|
// virtual dtor for any base class
|
||||||
virtual ~wxRenderer();
|
virtual ~wxRenderer();
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// draw a frame around rectFrame rectangle but not touching the rectLabel
|
// draw a frame around rectFrame rectangle but not touching the rectLabel
|
||||||
// one: this is used by DrawFrame()
|
// one: this is used by DrawFrame()
|
||||||
@@ -821,6 +828,17 @@ public:
|
|||||||
int flags) const
|
int flags) const
|
||||||
{ return m_renderer->HitTestFrame(rect, pt, flags); }
|
{ return m_renderer->HitTestFrame(rect, pt, flags); }
|
||||||
|
|
||||||
|
virtual void DrawHeaderButton(wxWindow *win,
|
||||||
|
wxDC& dc,
|
||||||
|
const wxRect& rect,
|
||||||
|
int flags = 0)
|
||||||
|
{ m_renderer->DrawHeaderButton(win, dc, rect, flags); }
|
||||||
|
virtual void DrawTreeItemButton(wxWindow *win,
|
||||||
|
wxDC& dc,
|
||||||
|
const wxRect& rect,
|
||||||
|
int flags = 0)
|
||||||
|
{ m_renderer->DrawTreeItemButton(win, dc, rect, flags); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxRenderer *m_renderer;
|
wxRenderer *m_renderer;
|
||||||
};
|
};
|
||||||
|
@@ -27,30 +27,6 @@ class WXDLLEXPORT wxMenuBar;
|
|||||||
class WXDLLEXPORT wxRenderer;
|
class WXDLLEXPORT wxRenderer;
|
||||||
class WXDLLEXPORT wxScrollBar;
|
class WXDLLEXPORT wxScrollBar;
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// constants
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// control state flags used in wxRenderer and wxColourScheme
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
wxCONTROL_DISABLED = 0x00000001, // control is disabled
|
|
||||||
wxCONTROL_FOCUSED = 0x00000002, // currently has keyboard focus
|
|
||||||
wxCONTROL_PRESSED = 0x00000004, // (button) is pressed
|
|
||||||
wxCONTROL_ISDEFAULT = 0x00000008, // only applies to the buttons
|
|
||||||
wxCONTROL_ISSUBMENU = wxCONTROL_ISDEFAULT, // only for menu items
|
|
||||||
wxCONTROL_CURRENT = 0x00000010, // mouse is currently over the control
|
|
||||||
wxCONTROL_SELECTED = 0x00000020, // selected item in e.g. listbox
|
|
||||||
wxCONTROL_CHECKED = 0x00000040, // (check/radio button) is checked
|
|
||||||
wxCONTROL_CHECKABLE = 0x00000080, // (menu) item can be checked
|
|
||||||
|
|
||||||
wxCONTROL_FLAGS_MASK = 0x000000ff,
|
|
||||||
|
|
||||||
// this is a pseudo flag not used directly by wxRenderer but rather by some
|
|
||||||
// controls internally
|
|
||||||
wxCONTROL_DIRTY = 0x80000000
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef __WXX11__
|
#ifdef __WXX11__
|
||||||
#define wxUSE_TWO_WINDOWS 1
|
#define wxUSE_TWO_WINDOWS 1
|
||||||
#else
|
#else
|
||||||
|
@@ -68,13 +68,10 @@
|
|||||||
IMPLEMENT_DYNAMIC_CLASS(wxListCtrl, wxGenericListCtrl)
|
IMPLEMENT_DYNAMIC_CLASS(wxListCtrl, wxGenericListCtrl)
|
||||||
#endif // HAVE_NATIVE_LISTCTRL/!HAVE_NATIVE_LISTCTRL
|
#endif // HAVE_NATIVE_LISTCTRL/!HAVE_NATIVE_LISTCTRL
|
||||||
|
|
||||||
#if defined(__WXGTK__)
|
|
||||||
#include <gtk/gtk.h>
|
|
||||||
#include "wx/gtk/win_gtk.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "wx/selstore.h"
|
#include "wx/selstore.h"
|
||||||
|
|
||||||
|
#include "wx/renderer.h"
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// events
|
// events
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -409,7 +406,6 @@ public:
|
|||||||
|
|
||||||
virtual ~wxListHeaderWindow();
|
virtual ~wxListHeaderWindow();
|
||||||
|
|
||||||
void DoDrawRect( wxDC *dc, int x, int y, int w, int h );
|
|
||||||
void DrawCurrent();
|
void DrawCurrent();
|
||||||
void AdjustDC(wxDC& dc);
|
void AdjustDC(wxDC& dc);
|
||||||
|
|
||||||
@@ -1657,66 +1653,6 @@ wxListHeaderWindow::~wxListHeaderWindow()
|
|||||||
#include "wx/univ/theme.h"
|
#include "wx/univ/theme.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void wxListHeaderWindow::DoDrawRect( wxDC *dc, int x, int y, int w, int h )
|
|
||||||
{
|
|
||||||
#if defined(__WXGTK__) && !defined(__WXUNIVERSAL__)
|
|
||||||
GtkStateType state = m_parent->IsEnabled() ? GTK_STATE_NORMAL
|
|
||||||
: GTK_STATE_INSENSITIVE;
|
|
||||||
|
|
||||||
x = dc->XLOG2DEV( x );
|
|
||||||
|
|
||||||
gtk_paint_box (m_wxwindow->style, GTK_PIZZA(m_wxwindow)->bin_window,
|
|
||||||
state, GTK_SHADOW_OUT,
|
|
||||||
(GdkRectangle*) NULL, m_wxwindow,
|
|
||||||
(char *)"button", // const_cast
|
|
||||||
x-1, y-1, w+2, h+2);
|
|
||||||
#elif defined(__WXUNIVERSAL__)
|
|
||||||
wxTheme *theme = wxTheme::Get();
|
|
||||||
wxRenderer *renderer = theme->GetRenderer();
|
|
||||||
renderer->DrawBorder( *dc, wxBORDER_RAISED, wxRect(x,y,w,h), 0 );
|
|
||||||
#elif defined(__WXMAC__)
|
|
||||||
const int m_corner = 1;
|
|
||||||
|
|
||||||
dc->SetBrush( *wxTRANSPARENT_BRUSH );
|
|
||||||
|
|
||||||
dc->SetPen( wxPen( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNSHADOW ) , 1 , wxSOLID ) );
|
|
||||||
dc->DrawLine( x+w-m_corner+1, y, x+w, y+h ); // right (outer)
|
|
||||||
dc->DrawRectangle( x, y+h, w+1, 1 ); // bottom (outer)
|
|
||||||
|
|
||||||
wxPen pen( wxColour( 0x88 , 0x88 , 0x88 ), 1, wxSOLID );
|
|
||||||
|
|
||||||
dc->SetPen( pen );
|
|
||||||
dc->DrawLine( x+w-m_corner, y, x+w-1, y+h ); // right (inner)
|
|
||||||
dc->DrawRectangle( x+1, y+h-1, w-2, 1 ); // bottom (inner)
|
|
||||||
|
|
||||||
dc->SetPen( *wxWHITE_PEN );
|
|
||||||
dc->DrawRectangle( x, y, w-m_corner+1, 1 ); // top (outer)
|
|
||||||
dc->DrawRectangle( x, y, 1, h ); // left (outer)
|
|
||||||
dc->DrawLine( x, y+h-1, x+1, y+h-1 );
|
|
||||||
dc->DrawLine( x+w-1, y, x+w-1, y+1 );
|
|
||||||
#else // !GTK, !Mac
|
|
||||||
const int m_corner = 1;
|
|
||||||
|
|
||||||
dc->SetBrush( *wxTRANSPARENT_BRUSH );
|
|
||||||
|
|
||||||
dc->SetPen( *wxBLACK_PEN );
|
|
||||||
dc->DrawLine( x+w-m_corner+1, y, x+w, y+h ); // right (outer)
|
|
||||||
dc->DrawRectangle( x, y+h, w+1, 1 ); // bottom (outer)
|
|
||||||
|
|
||||||
wxPen pen( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNSHADOW ), 1, wxSOLID );
|
|
||||||
|
|
||||||
dc->SetPen( pen );
|
|
||||||
dc->DrawLine( x+w-m_corner, y, x+w-1, y+h ); // right (inner)
|
|
||||||
dc->DrawRectangle( x+1, y+h-1, w-2, 1 ); // bottom (inner)
|
|
||||||
|
|
||||||
dc->SetPen( *wxWHITE_PEN );
|
|
||||||
dc->DrawRectangle( x, y, w-m_corner+1, 1 ); // top (outer)
|
|
||||||
dc->DrawRectangle( x, y, 1, h ); // left (outer)
|
|
||||||
dc->DrawLine( x, y+h-1, x+1, y+h-1 );
|
|
||||||
dc->DrawLine( x+w-1, y, x+w-1, y+1 );
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// shift the DC origin to match the position of the main window horz
|
// shift the DC origin to match the position of the main window horz
|
||||||
// scrollbar: this allows us to always use logical coords
|
// scrollbar: this allows us to always use logical coords
|
||||||
void wxListHeaderWindow::AdjustDC(wxDC& dc)
|
void wxListHeaderWindow::AdjustDC(wxDC& dc)
|
||||||
@@ -1733,11 +1669,7 @@ void wxListHeaderWindow::AdjustDC(wxDC& dc)
|
|||||||
|
|
||||||
void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
#if defined(__WXGTK__)
|
|
||||||
wxClientDC dc( this );
|
|
||||||
#else
|
|
||||||
wxPaintDC dc( this );
|
wxPaintDC dc( this );
|
||||||
#endif
|
|
||||||
|
|
||||||
PrepareDC( dc );
|
PrepareDC( dc );
|
||||||
AdjustDC( dc );
|
AdjustDC( dc );
|
||||||
@@ -1772,9 +1704,14 @@ void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
// inside the column rect
|
// inside the column rect
|
||||||
int cw = wCol - 2;
|
int cw = wCol - 2;
|
||||||
|
|
||||||
dc.SetPen( *wxWHITE_PEN );
|
wxRendererNative::Get().DrawHeaderButton
|
||||||
|
(
|
||||||
DoDrawRect( &dc, x, HEADER_OFFSET_Y, cw, h-2 );
|
this,
|
||||||
|
dc,
|
||||||
|
wxRect(x, HEADER_OFFSET_Y, cw, h - 2),
|
||||||
|
m_parent->IsEnabled() ? 0
|
||||||
|
: wxCONTROL_DISABLED
|
||||||
|
);
|
||||||
|
|
||||||
// see if we have enough space for the column label
|
// see if we have enough space for the column label
|
||||||
|
|
||||||
|
136
src/generic/renderg.cpp
Normal file
136
src/generic/renderg.cpp
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: generic/renderg.cpp
|
||||||
|
// Purpose: generic implementation of wxRendererBase (for any platform)
|
||||||
|
// Author: Vadim Zeitlin
|
||||||
|
// Modified by:
|
||||||
|
// Created: 20.07.2003
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwindows.org>
|
||||||
|
// License: wxWindows license
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// declarations
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// headers
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// for compilers that support precompilation, includes "wx.h".
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include "wx/string.h"
|
||||||
|
#endif //WX_PRECOMP
|
||||||
|
|
||||||
|
#include "wx/renderer.h"
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxRendererGeneric: our wxRendererBase implementation
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class WXDLLEXPORT wxRendererGeneric : public wxRendererBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// draw the header control button (used by wxListCtrl)
|
||||||
|
virtual void DrawHeaderButton(wxWindow *win,
|
||||||
|
wxDC& dc,
|
||||||
|
const wxRect& rect,
|
||||||
|
int flags = 0);
|
||||||
|
|
||||||
|
// draw the expanded/collapsed icon for a tree control item
|
||||||
|
virtual void DrawTreeItemButton(wxWindow *win,
|
||||||
|
wxDC& dc,
|
||||||
|
const wxRect& rect,
|
||||||
|
int flags = 0);
|
||||||
|
};
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// implementation
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxRendererGeneric creation
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/* static */
|
||||||
|
wxRendererNative *wxRendererGeneric::GetGeneric()
|
||||||
|
{
|
||||||
|
static wxRendererGeneric s_rendererGeneric;
|
||||||
|
|
||||||
|
return s_rendererGeneric;
|
||||||
|
}
|
||||||
|
|
||||||
|
// some platforms have their own renderers
|
||||||
|
#if !defined(__WXMSW__) && !defined(__WXMAC__) && !defined(__WXGTK__)
|
||||||
|
|
||||||
|
/* static */
|
||||||
|
wxRendererNative& wxRendererGeneric::Get()
|
||||||
|
{
|
||||||
|
return GetGeneric();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // platforms using their own renderers
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxRendererGeneric drawing functions
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void
|
||||||
|
wxRendererGeneric::DrawHeaderButton(wxWindow *win,
|
||||||
|
wxDC& dc,
|
||||||
|
const wxRect& rect,
|
||||||
|
int flags)
|
||||||
|
{
|
||||||
|
const int m_corner = 1;
|
||||||
|
|
||||||
|
dc->SetBrush( *wxTRANSPARENT_BRUSH );
|
||||||
|
|
||||||
|
dc->SetPen( *wxBLACK_PEN );
|
||||||
|
dc->DrawLine( x+w-m_corner+1, y, x+w, y+h ); // right (outer)
|
||||||
|
dc->DrawRectangle( x, y+h, w+1, 1 ); // bottom (outer)
|
||||||
|
|
||||||
|
wxPen pen( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNSHADOW ), 1, wxSOLID );
|
||||||
|
|
||||||
|
dc->SetPen( pen );
|
||||||
|
dc->DrawLine( x+w-m_corner, y, x+w-1, y+h ); // right (inner)
|
||||||
|
dc->DrawRectangle( x+1, y+h-1, w-2, 1 ); // bottom (inner)
|
||||||
|
|
||||||
|
dc->SetPen( *wxWHITE_PEN );
|
||||||
|
dc->DrawRectangle( x, y, w-m_corner+1, 1 ); // top (outer)
|
||||||
|
dc->DrawRectangle( x, y, 1, h ); // left (outer)
|
||||||
|
dc->DrawLine( x, y+h-1, x+1, y+h-1 );
|
||||||
|
dc->DrawLine( x+w-1, y, x+w-1, y+1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
// draw the plus or minus sign
|
||||||
|
void
|
||||||
|
wxRendererGeneric::DrawTreeItemButton(wxWindow *win,
|
||||||
|
wxDC& dc,
|
||||||
|
const wxRect& rect,
|
||||||
|
int flags)
|
||||||
|
{
|
||||||
|
// white background
|
||||||
|
dc.SetPen(*wxGREY_PEN);
|
||||||
|
dc.SetBrush(*wxWHITE_BRUSH);
|
||||||
|
dc.DrawRectangle(rect.Deflate(1, 2));
|
||||||
|
|
||||||
|
// black lines
|
||||||
|
const wxCoord xMiddle = rect.x + rect.width/2;
|
||||||
|
const wxCoord yMiddle = rect.y + rect.height/2;
|
||||||
|
|
||||||
|
dc.SetPen(*wxBLACK_PEN);
|
||||||
|
dc.DrawLine(xMiddle - 2, yMiddle, xMiddle + 3, yMiddle);
|
||||||
|
if ( !item->IsExpanded() )
|
||||||
|
{
|
||||||
|
// turn "-" into "+"
|
||||||
|
dc.DrawLine(xMiddle, yMiddle - 2, xMiddle, yMiddle + 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@@ -38,9 +38,7 @@
|
|||||||
#include "wx/settings.h"
|
#include "wx/settings.h"
|
||||||
#include "wx/dcclient.h"
|
#include "wx/dcclient.h"
|
||||||
|
|
||||||
#ifdef __WXMAC__
|
#include "wx/renderer.h"
|
||||||
#include "wx/mac/private.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// array types
|
// array types
|
||||||
@@ -58,54 +56,6 @@ static const int NO_IMAGE = -1;
|
|||||||
|
|
||||||
static const int PIXELS_PER_UNIT = 10;
|
static const int PIXELS_PER_UNIT = 10;
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// Aqua arrows
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/* XPM */
|
|
||||||
static const char *aqua_arrow_right[] = {
|
|
||||||
/* columns rows colors chars-per-pixel */
|
|
||||||
"13 11 4 1",
|
|
||||||
" c None",
|
|
||||||
"b c #C0C0C0",
|
|
||||||
"c c #707070",
|
|
||||||
"d c #A0A0A0",
|
|
||||||
/* pixels */
|
|
||||||
" b ",
|
|
||||||
" ddb ",
|
|
||||||
" cccdb ",
|
|
||||||
" cccccd ",
|
|
||||||
" ccccccdb ",
|
|
||||||
" ccccccccd",
|
|
||||||
" ccccccdb ",
|
|
||||||
" cccccb ",
|
|
||||||
" cccdb ",
|
|
||||||
" ddb ",
|
|
||||||
" b "
|
|
||||||
};
|
|
||||||
|
|
||||||
/* XPM */
|
|
||||||
static const char *aqua_arrow_down[] = {
|
|
||||||
/* columns rows colors chars-per-pixel */
|
|
||||||
"13 11 4 1",
|
|
||||||
" c None",
|
|
||||||
"b c #C0C0C0",
|
|
||||||
"c c #707070",
|
|
||||||
"d c #A0A0A0",
|
|
||||||
/* pixels */
|
|
||||||
" ",
|
|
||||||
" ",
|
|
||||||
" bdcccccccdb ",
|
|
||||||
" dcccccccd ",
|
|
||||||
" bcccccccb ",
|
|
||||||
" dcccccd ",
|
|
||||||
" bcccccb ",
|
|
||||||
" bcccd ",
|
|
||||||
" dcd ",
|
|
||||||
" bcb ",
|
|
||||||
" d "
|
|
||||||
};
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// private classes
|
// private classes
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
@@ -796,26 +746,11 @@ bool wxGenericTreeCtrl::Create(wxWindow *parent,
|
|||||||
int major,minor;
|
int major,minor;
|
||||||
wxGetOsVersion( &major, &minor );
|
wxGetOsVersion( &major, &minor );
|
||||||
|
|
||||||
if (style & wxTR_HAS_BUTTONS) style |= wxTR_MAC_BUTTONS;
|
|
||||||
if (style & wxTR_HAS_BUTTONS) style &= ~wxTR_HAS_BUTTONS;
|
|
||||||
style &= ~wxTR_LINES_AT_ROOT;
|
style &= ~wxTR_LINES_AT_ROOT;
|
||||||
style |= wxTR_NO_LINES;
|
style |= wxTR_NO_LINES;
|
||||||
if (major < 10)
|
if (major < 10)
|
||||||
style |= wxTR_ROW_LINES;
|
style |= wxTR_ROW_LINES;
|
||||||
if (major >= 10)
|
#endif // __WXMAC__
|
||||||
style |= wxTR_AQUA_BUTTONS;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (style & wxTR_AQUA_BUTTONS)
|
|
||||||
{
|
|
||||||
m_arrowRight = new wxBitmap( aqua_arrow_right );
|
|
||||||
m_arrowDown = new wxBitmap( aqua_arrow_down );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_arrowRight = NULL;
|
|
||||||
m_arrowDown = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxScrolledWindow::Create( parent, id, pos, size,
|
wxScrolledWindow::Create( parent, id, pos, size,
|
||||||
style|wxHSCROLL|wxVSCROLL, name );
|
style|wxHSCROLL|wxVSCROLL, name );
|
||||||
@@ -847,9 +782,6 @@ wxGenericTreeCtrl::~wxGenericTreeCtrl()
|
|||||||
delete m_hilightBrush;
|
delete m_hilightBrush;
|
||||||
delete m_hilightUnfocusedBrush;
|
delete m_hilightUnfocusedBrush;
|
||||||
|
|
||||||
delete m_arrowRight;
|
|
||||||
delete m_arrowDown;
|
|
||||||
|
|
||||||
DeleteAllItems();
|
DeleteAllItems();
|
||||||
|
|
||||||
delete m_renameTimer;
|
delete m_renameTimer;
|
||||||
@@ -2351,101 +2283,7 @@ void wxGenericTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level
|
|||||||
dc.SetPen(m_dottedPen);
|
dc.SetPen(m_dottedPen);
|
||||||
dc.SetTextForeground(*wxBLACK);
|
dc.SetTextForeground(*wxBLACK);
|
||||||
|
|
||||||
if (item->HasPlus() && HasButtons()) // should the item show a button?
|
if ( !HasFlag(wxTR_NO_LINES) )
|
||||||
{
|
|
||||||
if (!HasFlag(wxTR_NO_LINES))
|
|
||||||
{
|
|
||||||
if (x > (signed)m_indent)
|
|
||||||
dc.DrawLine(x - m_indent, y_mid, x - 5, y_mid);
|
|
||||||
else if (HasFlag(wxTR_LINES_AT_ROOT))
|
|
||||||
dc.DrawLine(3, y_mid, x - 5, y_mid);
|
|
||||||
dc.DrawLine(x + 5, y_mid, x + m_spacing, y_mid);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_imageListButtons != NULL)
|
|
||||||
{
|
|
||||||
// draw the image button here
|
|
||||||
int image_h = 0, image_w = 0, image = wxTreeItemIcon_Normal;
|
|
||||||
if (item->IsExpanded()) image = wxTreeItemIcon_Expanded;
|
|
||||||
if (item->IsSelected())
|
|
||||||
image += wxTreeItemIcon_Selected - wxTreeItemIcon_Normal;
|
|
||||||
m_imageListButtons->GetSize(image, image_w, image_h);
|
|
||||||
int xx = x - (image_w>>1);
|
|
||||||
int yy = y_mid - (image_h>>1);
|
|
||||||
dc.SetClippingRegion(xx, yy, image_w, image_h);
|
|
||||||
m_imageListButtons->Draw(image, dc, xx, yy,
|
|
||||||
wxIMAGELIST_DRAW_TRANSPARENT);
|
|
||||||
dc.DestroyClippingRegion();
|
|
||||||
}
|
|
||||||
else if (HasFlag(wxTR_TWIST_BUTTONS))
|
|
||||||
{
|
|
||||||
// draw the twisty button here
|
|
||||||
|
|
||||||
if (HasFlag(wxTR_AQUA_BUTTONS))
|
|
||||||
{
|
|
||||||
// This causes update problems, so disabling for now.
|
|
||||||
#if 0 // def __WXMAC__
|
|
||||||
wxMacPortSetter helper(&dc) ;
|
|
||||||
wxMacWindowClipper clipper(this) ;
|
|
||||||
wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
|
|
||||||
|
|
||||||
int loc_x = x - 5 ;
|
|
||||||
int loc_y = y_mid - 6 ;
|
|
||||||
MacWindowToRootWindow( & loc_x , & loc_y ) ;
|
|
||||||
Rect bounds = { loc_y , loc_x , loc_y + 18 , loc_x + 12 } ;
|
|
||||||
ThemeButtonDrawInfo info = { kThemeStateActive , item->IsExpanded() ? kThemeDisclosureDown : kThemeDisclosureRight ,
|
|
||||||
kThemeAdornmentNone };
|
|
||||||
DrawThemeButton( &bounds, kThemeDisclosureButton ,
|
|
||||||
&info , NULL , NULL , NULL , NULL ) ;
|
|
||||||
#else
|
|
||||||
if (item->IsExpanded())
|
|
||||||
dc.DrawBitmap( *m_arrowDown, x-5, y_mid-6, TRUE );
|
|
||||||
else
|
|
||||||
dc.DrawBitmap( *m_arrowRight, x-5, y_mid-6, TRUE );
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dc.SetBrush(*m_hilightBrush);
|
|
||||||
dc.SetPen(*wxBLACK_PEN);
|
|
||||||
wxPoint button[3];
|
|
||||||
|
|
||||||
if (item->IsExpanded())
|
|
||||||
{
|
|
||||||
button[0].x = x-5;
|
|
||||||
button[0].y = y_mid-2;
|
|
||||||
button[1].x = x+5;
|
|
||||||
button[1].y = y_mid-2;
|
|
||||||
button[2].x = x;
|
|
||||||
button[2].y = y_mid+3;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
button[0].y = y_mid-5;
|
|
||||||
button[0].x = x-2;
|
|
||||||
button[1].y = y_mid+5;
|
|
||||||
button[1].x = x-2;
|
|
||||||
button[2].y = y_mid;
|
|
||||||
button[2].x = x+3;
|
|
||||||
}
|
|
||||||
dc.DrawPolygon(3, button);
|
|
||||||
dc.SetPen(m_dottedPen);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else // if (HasFlag(wxTR_HAS_BUTTONS))
|
|
||||||
{
|
|
||||||
// draw the plus sign here
|
|
||||||
dc.SetPen(*wxGREY_PEN);
|
|
||||||
dc.SetBrush(*wxWHITE_BRUSH);
|
|
||||||
dc.DrawRectangle(x-5, y_mid-4, 11, 9);
|
|
||||||
dc.SetPen(*wxBLACK_PEN);
|
|
||||||
dc.DrawLine(x-2, y_mid, x+3, y_mid);
|
|
||||||
if (!item->IsExpanded())
|
|
||||||
dc.DrawLine(x, y_mid-2, x, y_mid+3);
|
|
||||||
dc.SetPen(m_dottedPen);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!HasFlag(wxTR_NO_LINES)) // no button; maybe a line?
|
|
||||||
{
|
{
|
||||||
// draw the horizontal line here
|
// draw the horizontal line here
|
||||||
int x_start = x;
|
int x_start = x;
|
||||||
@@ -2455,6 +2293,46 @@ void wxGenericTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level
|
|||||||
x_start = 3;
|
x_start = 3;
|
||||||
dc.DrawLine(x_start, y_mid, x + m_spacing, y_mid);
|
dc.DrawLine(x_start, y_mid, x + m_spacing, y_mid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// should the item show a button?
|
||||||
|
if ( item->HasPlus() && HasButtons() )
|
||||||
|
{
|
||||||
|
if ( m_imageListButtons )
|
||||||
|
{
|
||||||
|
// draw the image button here
|
||||||
|
int image_h = 0,
|
||||||
|
image_w = 0;
|
||||||
|
int image = item->IsExpanded() ? wxTreeItemIcon_Expanded
|
||||||
|
: wxTreeItemIcon_Normal;
|
||||||
|
if ( item->IsSelected() )
|
||||||
|
image += wxTreeItemIcon_Selected - wxTreeItemIcon_Normal;
|
||||||
|
|
||||||
|
m_imageListButtons->GetSize(image, image_w, image_h);
|
||||||
|
int xx = x - image_w/2;
|
||||||
|
int yy = y_mid - image_h/2;
|
||||||
|
|
||||||
|
wxDCClipper clip(dc, xx, yy, image_w, image_h);
|
||||||
|
m_imageListButtons->Draw(image, dc, xx, yy,
|
||||||
|
wxIMAGELIST_DRAW_TRANSPARENT);
|
||||||
|
}
|
||||||
|
else // no custom buttons
|
||||||
|
{
|
||||||
|
static const int wImage = 10;
|
||||||
|
static const int hImage = 12;
|
||||||
|
|
||||||
|
wxRendererNative::Get().DrawTreeItemButton
|
||||||
|
(
|
||||||
|
this,
|
||||||
|
dc,
|
||||||
|
wxRect(x - wImage/2,
|
||||||
|
y_mid - hImage/2,
|
||||||
|
wImage, hImage),
|
||||||
|
item->IsExpanded()
|
||||||
|
? wxCONTROL_EXPANDED
|
||||||
|
: 0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item->IsExpanded())
|
if (item->IsExpanded())
|
||||||
|
127
src/gtk/renderer.cpp
Normal file
127
src/gtk/renderer.cpp
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: gtk/renderer.cpp
|
||||||
|
// Purpose: implementation of wxRendererBase for wxGTK
|
||||||
|
// Author: Vadim Zeitlin
|
||||||
|
// Modified by:
|
||||||
|
// Created: 20.07.2003
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwindows.org>
|
||||||
|
// License: wxWindows license
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// declarations
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// headers
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// for compilers that support precompilation, includes "wx.h".
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#endif // WX_PRECOMP
|
||||||
|
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
#include "wx/gtk/win_gtk.h"
|
||||||
|
|
||||||
|
#include "wx/renderer.h"
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxRendererGTK: our wxRendererBase implementation
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class WXDLLEXPORT wxRendererGTK : public wxDelegateRendererBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// draw the header control button (used by wxListCtrl)
|
||||||
|
virtual void DrawHeaderButton(wxWindow *win,
|
||||||
|
wxDC& dc,
|
||||||
|
const wxRect& rect,
|
||||||
|
int flags = 0);
|
||||||
|
|
||||||
|
#ifdef __WXGTK20__
|
||||||
|
// draw the expanded/collapsed icon for a tree control item
|
||||||
|
virtual void DrawTreeItemButton(wxWindow *win,
|
||||||
|
wxDC& dc,
|
||||||
|
const wxRect& rect,
|
||||||
|
int flags = 0);
|
||||||
|
#endif // GTK 2.0
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// implementation
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
/* static */
|
||||||
|
wxRendererNative& wxRendererGTK::Get()
|
||||||
|
{
|
||||||
|
static wxRendererGTK s_rendererGTK;
|
||||||
|
|
||||||
|
return s_rendererGTK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
wxRendererGTK::DrawHeaderButton(wxWindow *win,
|
||||||
|
wxDC& dc,
|
||||||
|
const wxRect& rect,
|
||||||
|
int flags)
|
||||||
|
{
|
||||||
|
gtk_paint_box
|
||||||
|
(
|
||||||
|
win->m_wxwindow->style,
|
||||||
|
GTK_PIZZA(win->m_wxwindow)->bin_window,
|
||||||
|
flags & wxCONTROL_DISABLED ? GTK_STATE_INSENSITIVE : GTK_STATE_NORMAL,
|
||||||
|
GTK_SHADOW_OUT,
|
||||||
|
(GdkRectangle*) NULL, m_wxwindow,
|
||||||
|
(char *)"button", // const_cast
|
||||||
|
dc.XLOG2DEV(rect.x) - 1, rect.y - 1, rect.width + 2, rect.h + 2
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __WXGTK20__
|
||||||
|
|
||||||
|
// draw a ">" or "v" button
|
||||||
|
//
|
||||||
|
// TODO: isn't there a GTK function to draw it?
|
||||||
|
void
|
||||||
|
wxRendererGTK::DrawTreeItemButton(wxDC& dc, const wxRect& rect, int flags)
|
||||||
|
{
|
||||||
|
dc.SetBrush(*m_hilightBrush);
|
||||||
|
dc.SetPen(*wxBLACK_PEN);
|
||||||
|
wxPoint button[3];
|
||||||
|
|
||||||
|
const wxCoord xMiddle = rect.x + rect.width/2;
|
||||||
|
const wxCoord yMiddle = rect.y + rect.height/2;
|
||||||
|
|
||||||
|
if ( flags & wxCONTROL_EXPANDED )
|
||||||
|
{
|
||||||
|
button[0].x = rect.GetLeft();
|
||||||
|
button[0].y = yMiddle - 2;
|
||||||
|
button[1].x = rect.GetRight();
|
||||||
|
button[1].y = yMiddle - 2;
|
||||||
|
button[2].x = xMiddle;
|
||||||
|
button[2].y = yMiddle + 3;
|
||||||
|
}
|
||||||
|
else // collapsed
|
||||||
|
{
|
||||||
|
button[0].y = rect.GetBottom();
|
||||||
|
button[0].x = xMiddle - 2;
|
||||||
|
button[1].y = rect.GetTop();
|
||||||
|
button[1].x = xMiddle - 2;
|
||||||
|
button[2].y = yMiddle;
|
||||||
|
button[2].x = xMiddle + 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
dc.DrawPolygon(3, button);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // GTK 2.0
|
||||||
|
|
||||||
|
|
127
src/gtk1/renderer.cpp
Normal file
127
src/gtk1/renderer.cpp
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: gtk/renderer.cpp
|
||||||
|
// Purpose: implementation of wxRendererBase for wxGTK
|
||||||
|
// Author: Vadim Zeitlin
|
||||||
|
// Modified by:
|
||||||
|
// Created: 20.07.2003
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwindows.org>
|
||||||
|
// License: wxWindows license
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// declarations
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// headers
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// for compilers that support precompilation, includes "wx.h".
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#endif // WX_PRECOMP
|
||||||
|
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
#include "wx/gtk/win_gtk.h"
|
||||||
|
|
||||||
|
#include "wx/renderer.h"
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxRendererGTK: our wxRendererBase implementation
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class WXDLLEXPORT wxRendererGTK : public wxDelegateRendererBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// draw the header control button (used by wxListCtrl)
|
||||||
|
virtual void DrawHeaderButton(wxWindow *win,
|
||||||
|
wxDC& dc,
|
||||||
|
const wxRect& rect,
|
||||||
|
int flags = 0);
|
||||||
|
|
||||||
|
#ifdef __WXGTK20__
|
||||||
|
// draw the expanded/collapsed icon for a tree control item
|
||||||
|
virtual void DrawTreeItemButton(wxWindow *win,
|
||||||
|
wxDC& dc,
|
||||||
|
const wxRect& rect,
|
||||||
|
int flags = 0);
|
||||||
|
#endif // GTK 2.0
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// implementation
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
/* static */
|
||||||
|
wxRendererNative& wxRendererGTK::Get()
|
||||||
|
{
|
||||||
|
static wxRendererGTK s_rendererGTK;
|
||||||
|
|
||||||
|
return s_rendererGTK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
wxRendererGTK::DrawHeaderButton(wxWindow *win,
|
||||||
|
wxDC& dc,
|
||||||
|
const wxRect& rect,
|
||||||
|
int flags)
|
||||||
|
{
|
||||||
|
gtk_paint_box
|
||||||
|
(
|
||||||
|
win->m_wxwindow->style,
|
||||||
|
GTK_PIZZA(win->m_wxwindow)->bin_window,
|
||||||
|
flags & wxCONTROL_DISABLED ? GTK_STATE_INSENSITIVE : GTK_STATE_NORMAL,
|
||||||
|
GTK_SHADOW_OUT,
|
||||||
|
(GdkRectangle*) NULL, m_wxwindow,
|
||||||
|
(char *)"button", // const_cast
|
||||||
|
dc.XLOG2DEV(rect.x) - 1, rect.y - 1, rect.width + 2, rect.h + 2
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __WXGTK20__
|
||||||
|
|
||||||
|
// draw a ">" or "v" button
|
||||||
|
//
|
||||||
|
// TODO: isn't there a GTK function to draw it?
|
||||||
|
void
|
||||||
|
wxRendererGTK::DrawTreeItemButton(wxDC& dc, const wxRect& rect, int flags)
|
||||||
|
{
|
||||||
|
dc.SetBrush(*m_hilightBrush);
|
||||||
|
dc.SetPen(*wxBLACK_PEN);
|
||||||
|
wxPoint button[3];
|
||||||
|
|
||||||
|
const wxCoord xMiddle = rect.x + rect.width/2;
|
||||||
|
const wxCoord yMiddle = rect.y + rect.height/2;
|
||||||
|
|
||||||
|
if ( flags & wxCONTROL_EXPANDED )
|
||||||
|
{
|
||||||
|
button[0].x = rect.GetLeft();
|
||||||
|
button[0].y = yMiddle - 2;
|
||||||
|
button[1].x = rect.GetRight();
|
||||||
|
button[1].y = yMiddle - 2;
|
||||||
|
button[2].x = xMiddle;
|
||||||
|
button[2].y = yMiddle + 3;
|
||||||
|
}
|
||||||
|
else // collapsed
|
||||||
|
{
|
||||||
|
button[0].y = rect.GetBottom();
|
||||||
|
button[0].x = xMiddle - 2;
|
||||||
|
button[1].y = rect.GetTop();
|
||||||
|
button[1].x = xMiddle - 2;
|
||||||
|
button[2].y = yMiddle;
|
||||||
|
button[2].x = xMiddle + 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
dc.DrawPolygon(3, button);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // GTK 2.0
|
||||||
|
|
||||||
|
|
187
src/mac/carbon/renderer.cpp
Normal file
187
src/mac/carbon/renderer.cpp
Normal file
@@ -0,0 +1,187 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: mac/renderer.cpp
|
||||||
|
// Purpose: implementation of wxRendererBase for Mac
|
||||||
|
// Author: Vadim Zeitlin
|
||||||
|
// Modified by:
|
||||||
|
// Created: 20.07.2003
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwindows.org>
|
||||||
|
// License: wxWindows license
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// declarations
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// headers
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// for compilers that support precompilation, includes "wx.h".
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include "wx/string.h"
|
||||||
|
#endif //WX_PRECOMP
|
||||||
|
|
||||||
|
#include "wx/renderer.h"
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxRendererMac: our wxRendererBase implementation
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class WXDLLEXPORT wxRendererMac : public wxRendererBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// draw the header control button (used by wxListCtrl)
|
||||||
|
virtual void DrawHeaderButton(wxWindow *win,
|
||||||
|
wxDC& dc,
|
||||||
|
const wxRect& rect,
|
||||||
|
int flags = 0);
|
||||||
|
|
||||||
|
// draw the expanded/collapsed icon for a tree control item
|
||||||
|
virtual void DrawTreeItemButton(wxWindow *win,
|
||||||
|
wxDC& dc,
|
||||||
|
const wxRect& rect,
|
||||||
|
int flags = 0);
|
||||||
|
|
||||||
|
private:
|
||||||
|
// the tree buttons
|
||||||
|
wxBitmap m_bmpTreeExpanded,
|
||||||
|
m_bmpTreeCollapsed;
|
||||||
|
};
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// Aqua arrows
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/* XPM */
|
||||||
|
static const char *aqua_arrow_right_xpm[] = {
|
||||||
|
/* columns rows colors chars-per-pixel */
|
||||||
|
"13 11 4 1",
|
||||||
|
" c None",
|
||||||
|
"b c #C0C0C0",
|
||||||
|
"c c #707070",
|
||||||
|
"d c #A0A0A0",
|
||||||
|
/* pixels */
|
||||||
|
" b ",
|
||||||
|
" ddb ",
|
||||||
|
" cccdb ",
|
||||||
|
" cccccd ",
|
||||||
|
" ccccccdb ",
|
||||||
|
" ccccccccd",
|
||||||
|
" ccccccdb ",
|
||||||
|
" cccccb ",
|
||||||
|
" cccdb ",
|
||||||
|
" ddb ",
|
||||||
|
" b "
|
||||||
|
};
|
||||||
|
|
||||||
|
/* XPM */
|
||||||
|
static const char *aqua_arrow_down_xpm[] = {
|
||||||
|
/* columns rows colors chars-per-pixel */
|
||||||
|
"13 11 4 1",
|
||||||
|
" c None",
|
||||||
|
"b c #C0C0C0",
|
||||||
|
"c c #707070",
|
||||||
|
"d c #A0A0A0",
|
||||||
|
/* pixels */
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" bdcccccccdb ",
|
||||||
|
" dcccccccd ",
|
||||||
|
" bcccccccb ",
|
||||||
|
" dcccccd ",
|
||||||
|
" bcccccb ",
|
||||||
|
" bcccd ",
|
||||||
|
" dcd ",
|
||||||
|
" bcb ",
|
||||||
|
" d "
|
||||||
|
};
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// implementation
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
/* static */
|
||||||
|
wxRendererNative& wxRendererMac::Get()
|
||||||
|
{
|
||||||
|
static wxRendererMac s_rendererMac;
|
||||||
|
|
||||||
|
return s_rendererMac;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
wxRendererMac::DrawHeaderButton(wxWindow *win,
|
||||||
|
wxDC& dc,
|
||||||
|
const wxRect& rect,
|
||||||
|
int WXUNUSED(flags))
|
||||||
|
{
|
||||||
|
const int CORNER = 1;
|
||||||
|
|
||||||
|
const wxCoord x = rect.x,
|
||||||
|
y = rect.y,
|
||||||
|
w = rect.width,
|
||||||
|
h = rect.height;
|
||||||
|
|
||||||
|
dc.SetBrush( *wxTRANSPARENT_BRUSH );
|
||||||
|
|
||||||
|
dc.SetPen( wxPen( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNSHADOW ) , 1 , wxSOLID ) );
|
||||||
|
dc.DrawLine( x+w-CORNER+1, y, x+w, y+h ); // right (outer)
|
||||||
|
dc.DrawRectangle( x, y+h, w+1, 1 ); // bottom (outer)
|
||||||
|
|
||||||
|
wxPen pen( wxColour( 0x88 , 0x88 , 0x88 ), 1, wxSOLID );
|
||||||
|
|
||||||
|
dc.SetPen( pen );
|
||||||
|
dc.DrawLine( x+w-CORNER, y, x+w-1, y+h ); // right (inner)
|
||||||
|
dc.DrawRectangle( x+1, y+h-1, w-2, 1 ); // bottom (inner)
|
||||||
|
|
||||||
|
dc.SetPen( *wxWHITE_PEN );
|
||||||
|
dc.DrawRectangle( x, y, w-CORNER+1, 1 ); // top (outer)
|
||||||
|
dc.DrawRectangle( x, y, 1, h ); // left (outer)
|
||||||
|
dc.DrawLine( x, y+h-1, x+1, y+h-1 );
|
||||||
|
dc.DrawLine( x+w-1, y, x+w-1, y+1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
wxRendererMac::DrawTreeItemButton(wxWindow *win,
|
||||||
|
wxDC& dc,
|
||||||
|
const wxRect& rect,
|
||||||
|
int flags)
|
||||||
|
{
|
||||||
|
// init the buttons on demand
|
||||||
|
if ( !m_bmpTreeExpanded.Ok() )
|
||||||
|
{
|
||||||
|
m_bmpTreeExpanded = wxBitmap(aqua_arrow_down_xpm);
|
||||||
|
m_bmpTreeCollapsed = wxBitmap(aqua_arrow_right_xpm);
|
||||||
|
}
|
||||||
|
|
||||||
|
// draw them
|
||||||
|
|
||||||
|
// VZ: this is the old code from treectlg.cpp which apparently doesn't work
|
||||||
|
// but I kept it here just in case it is needed -- if not, please
|
||||||
|
// remove it
|
||||||
|
#if 0 // def __WXMAC__
|
||||||
|
wxMacPortSetter helper(&dc) ;
|
||||||
|
wxMacWindowClipper clipper(this) ;
|
||||||
|
wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
|
||||||
|
|
||||||
|
int loc_x = x - 5 ;
|
||||||
|
int loc_y = y_mid - 6 ;
|
||||||
|
MacWindowToRootWindow( & loc_x , & loc_y ) ;
|
||||||
|
Rect bounds = { loc_y , loc_x , loc_y + 18 , loc_x + 12 } ;
|
||||||
|
ThemeButtonDrawInfo info = { kThemeStateActive , item->IsExpanded() ? kThemeDisclosureDown : kThemeDisclosureRight ,
|
||||||
|
kThemeAdornmentNone };
|
||||||
|
DrawThemeButton( &bounds, kThemeDisclosureButton ,
|
||||||
|
&info , NULL , NULL , NULL , NULL ) ;
|
||||||
|
#else // 1
|
||||||
|
dc.DrawBitmap(flags & wxCONTROL_EXPANDED ? m_bmpTreeExpanded
|
||||||
|
: m_bmpTreeCollapsed,
|
||||||
|
rect.x, rect.y, true /* use mask */);
|
||||||
|
#endif // 0/1
|
||||||
|
}
|
||||||
|
|
187
src/mac/renderer.cpp
Normal file
187
src/mac/renderer.cpp
Normal file
@@ -0,0 +1,187 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: mac/renderer.cpp
|
||||||
|
// Purpose: implementation of wxRendererBase for Mac
|
||||||
|
// Author: Vadim Zeitlin
|
||||||
|
// Modified by:
|
||||||
|
// Created: 20.07.2003
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwindows.org>
|
||||||
|
// License: wxWindows license
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// declarations
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// headers
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// for compilers that support precompilation, includes "wx.h".
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include "wx/string.h"
|
||||||
|
#endif //WX_PRECOMP
|
||||||
|
|
||||||
|
#include "wx/renderer.h"
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxRendererMac: our wxRendererBase implementation
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class WXDLLEXPORT wxRendererMac : public wxRendererBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// draw the header control button (used by wxListCtrl)
|
||||||
|
virtual void DrawHeaderButton(wxWindow *win,
|
||||||
|
wxDC& dc,
|
||||||
|
const wxRect& rect,
|
||||||
|
int flags = 0);
|
||||||
|
|
||||||
|
// draw the expanded/collapsed icon for a tree control item
|
||||||
|
virtual void DrawTreeItemButton(wxWindow *win,
|
||||||
|
wxDC& dc,
|
||||||
|
const wxRect& rect,
|
||||||
|
int flags = 0);
|
||||||
|
|
||||||
|
private:
|
||||||
|
// the tree buttons
|
||||||
|
wxBitmap m_bmpTreeExpanded,
|
||||||
|
m_bmpTreeCollapsed;
|
||||||
|
};
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// Aqua arrows
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/* XPM */
|
||||||
|
static const char *aqua_arrow_right_xpm[] = {
|
||||||
|
/* columns rows colors chars-per-pixel */
|
||||||
|
"13 11 4 1",
|
||||||
|
" c None",
|
||||||
|
"b c #C0C0C0",
|
||||||
|
"c c #707070",
|
||||||
|
"d c #A0A0A0",
|
||||||
|
/* pixels */
|
||||||
|
" b ",
|
||||||
|
" ddb ",
|
||||||
|
" cccdb ",
|
||||||
|
" cccccd ",
|
||||||
|
" ccccccdb ",
|
||||||
|
" ccccccccd",
|
||||||
|
" ccccccdb ",
|
||||||
|
" cccccb ",
|
||||||
|
" cccdb ",
|
||||||
|
" ddb ",
|
||||||
|
" b "
|
||||||
|
};
|
||||||
|
|
||||||
|
/* XPM */
|
||||||
|
static const char *aqua_arrow_down_xpm[] = {
|
||||||
|
/* columns rows colors chars-per-pixel */
|
||||||
|
"13 11 4 1",
|
||||||
|
" c None",
|
||||||
|
"b c #C0C0C0",
|
||||||
|
"c c #707070",
|
||||||
|
"d c #A0A0A0",
|
||||||
|
/* pixels */
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" bdcccccccdb ",
|
||||||
|
" dcccccccd ",
|
||||||
|
" bcccccccb ",
|
||||||
|
" dcccccd ",
|
||||||
|
" bcccccb ",
|
||||||
|
" bcccd ",
|
||||||
|
" dcd ",
|
||||||
|
" bcb ",
|
||||||
|
" d "
|
||||||
|
};
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// implementation
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
/* static */
|
||||||
|
wxRendererNative& wxRendererMac::Get()
|
||||||
|
{
|
||||||
|
static wxRendererMac s_rendererMac;
|
||||||
|
|
||||||
|
return s_rendererMac;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
wxRendererMac::DrawHeaderButton(wxWindow *win,
|
||||||
|
wxDC& dc,
|
||||||
|
const wxRect& rect,
|
||||||
|
int WXUNUSED(flags))
|
||||||
|
{
|
||||||
|
const int CORNER = 1;
|
||||||
|
|
||||||
|
const wxCoord x = rect.x,
|
||||||
|
y = rect.y,
|
||||||
|
w = rect.width,
|
||||||
|
h = rect.height;
|
||||||
|
|
||||||
|
dc.SetBrush( *wxTRANSPARENT_BRUSH );
|
||||||
|
|
||||||
|
dc.SetPen( wxPen( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNSHADOW ) , 1 , wxSOLID ) );
|
||||||
|
dc.DrawLine( x+w-CORNER+1, y, x+w, y+h ); // right (outer)
|
||||||
|
dc.DrawRectangle( x, y+h, w+1, 1 ); // bottom (outer)
|
||||||
|
|
||||||
|
wxPen pen( wxColour( 0x88 , 0x88 , 0x88 ), 1, wxSOLID );
|
||||||
|
|
||||||
|
dc.SetPen( pen );
|
||||||
|
dc.DrawLine( x+w-CORNER, y, x+w-1, y+h ); // right (inner)
|
||||||
|
dc.DrawRectangle( x+1, y+h-1, w-2, 1 ); // bottom (inner)
|
||||||
|
|
||||||
|
dc.SetPen( *wxWHITE_PEN );
|
||||||
|
dc.DrawRectangle( x, y, w-CORNER+1, 1 ); // top (outer)
|
||||||
|
dc.DrawRectangle( x, y, 1, h ); // left (outer)
|
||||||
|
dc.DrawLine( x, y+h-1, x+1, y+h-1 );
|
||||||
|
dc.DrawLine( x+w-1, y, x+w-1, y+1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
wxRendererMac::DrawTreeItemButton(wxWindow *win,
|
||||||
|
wxDC& dc,
|
||||||
|
const wxRect& rect,
|
||||||
|
int flags)
|
||||||
|
{
|
||||||
|
// init the buttons on demand
|
||||||
|
if ( !m_bmpTreeExpanded.Ok() )
|
||||||
|
{
|
||||||
|
m_bmpTreeExpanded = wxBitmap(aqua_arrow_down_xpm);
|
||||||
|
m_bmpTreeCollapsed = wxBitmap(aqua_arrow_right_xpm);
|
||||||
|
}
|
||||||
|
|
||||||
|
// draw them
|
||||||
|
|
||||||
|
// VZ: this is the old code from treectlg.cpp which apparently doesn't work
|
||||||
|
// but I kept it here just in case it is needed -- if not, please
|
||||||
|
// remove it
|
||||||
|
#if 0 // def __WXMAC__
|
||||||
|
wxMacPortSetter helper(&dc) ;
|
||||||
|
wxMacWindowClipper clipper(this) ;
|
||||||
|
wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
|
||||||
|
|
||||||
|
int loc_x = x - 5 ;
|
||||||
|
int loc_y = y_mid - 6 ;
|
||||||
|
MacWindowToRootWindow( & loc_x , & loc_y ) ;
|
||||||
|
Rect bounds = { loc_y , loc_x , loc_y + 18 , loc_x + 12 } ;
|
||||||
|
ThemeButtonDrawInfo info = { kThemeStateActive , item->IsExpanded() ? kThemeDisclosureDown : kThemeDisclosureRight ,
|
||||||
|
kThemeAdornmentNone };
|
||||||
|
DrawThemeButton( &bounds, kThemeDisclosureButton ,
|
||||||
|
&info , NULL , NULL , NULL , NULL ) ;
|
||||||
|
#else // 1
|
||||||
|
dc.DrawBitmap(flags & wxCONTROL_EXPANDED ? m_bmpTreeExpanded
|
||||||
|
: m_bmpTreeCollapsed,
|
||||||
|
rect.x, rect.y, true /* use mask */);
|
||||||
|
#endif // 0/1
|
||||||
|
}
|
||||||
|
|
52
src/msw/renderer.cpp
Normal file
52
src/msw/renderer.cpp
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: msw/renderer.cpp
|
||||||
|
// Purpose: implementation of wxRendererBase for Windows
|
||||||
|
// Author: Vadim Zeitlin
|
||||||
|
// Modified by:
|
||||||
|
// Created: 20.07.2003
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwindows.org>
|
||||||
|
// License: wxWindows license
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// declarations
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// headers
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// for compilers that support precompilation, includes "wx.h".
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include "wx/string.h"
|
||||||
|
#endif //WX_PRECOMP
|
||||||
|
|
||||||
|
#include "wx/renderer.h"
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxRendererMSW: our wxRendererBase implementation
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class WXDLLEXPORT wxRendererMSW : public wxDelegateRendererBase
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// implementation
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
/* static */
|
||||||
|
wxRendererNative& wxRendererMSW::Get()
|
||||||
|
{
|
||||||
|
static wxRendererMSW s_rendererMSW;
|
||||||
|
|
||||||
|
return s_rendererMSW;
|
||||||
|
}
|
||||||
|
|
Reference in New Issue
Block a user