Gizmos has been moved to wxCode.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45221 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
207
wxPython/contrib/gizmos/wxCode/include/wx/gizmos/dynamicsash.h
Normal file
207
wxPython/contrib/gizmos/wxCode/include/wx/gizmos/dynamicsash.h
Normal file
@@ -0,0 +1,207 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: dynamicsash.h
|
||||
// Purpose: A window which can be dynamically split to an arbitrary depth
|
||||
// and later reunified through the user interface
|
||||
// Author: Matt Kimball
|
||||
// Modified by:
|
||||
// Created: 7/15/2001
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2001 Matt Kimball
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_DYNAMICSASH_H_
|
||||
#define _WX_DYNAMICSASH_H_
|
||||
|
||||
#include "wx/gizmos/gizmos.h"
|
||||
|
||||
#if !wxUSE_MDI
|
||||
# error "wxUSE_MDI must be defined for gizmos to compile."
|
||||
#endif /* !wxUSE_MDI */
|
||||
|
||||
|
||||
/*
|
||||
|
||||
wxDynamicSashWindow
|
||||
|
||||
wxDynamicSashWindow widgets manages the way other widgets are viewed.
|
||||
When a wxDynamicSashWindow is first shown, it will contain one child
|
||||
view, a viewport for that child, and a pair of scrollbars to allow the
|
||||
user to navigate the child view area. Next to each scrollbar is a small
|
||||
tab. By clicking on either tab and dragging to the appropriate spot, a
|
||||
user can split the view area into two smaller views separated by a
|
||||
draggable sash. Later, when the user wishes to reunify the two subviews,
|
||||
the user simply drags the sash to the side of the window.
|
||||
wxDynamicSashWindow will automatically reparent the appropriate child
|
||||
view back up the window hierarchy, and the wxDynamicSashWindow will have
|
||||
only one child view once again.
|
||||
|
||||
As an application developer, you will simply create a wxDynamicSashWindow
|
||||
using either the Create() function or the more complex constructor
|
||||
provided below, and then create a view window whose parent is the
|
||||
wxDynamicSashWindow. The child should respond to
|
||||
wxDynamicSashSplitEvents -- perhaps with an OnSplit() event handler -- by
|
||||
constructing a new view window whose parent is also the
|
||||
wxDynamicSashWindow. That's it! Now your users can dynamically split
|
||||
and reunify the view you provided.
|
||||
|
||||
If you wish to handle the scrollbar events for your view, rather than
|
||||
allowing wxDynamicSashWindow to do it for you, things are a bit more
|
||||
complex. (You might want to handle scrollbar events yourself, if,
|
||||
for instance, you wish to scroll a subwindow of the view you add to
|
||||
your wxDynamicSashWindow object, rather than scrolling the whole view.)
|
||||
In this case, you will need to construct your wxDynamicSashWindow without
|
||||
the wxDS_MANAGE_SCROLLBARS style and you will need to use the
|
||||
GetHScrollBar() and GetVScrollBar() methods to retrieve the scrollbar
|
||||
controls and call SetEventHanler() on them to redirect the scrolling
|
||||
events whenever your window is reparented by wxDyanmicSashWindow.
|
||||
You will need to set the scrollbars' event handler at three times:
|
||||
|
||||
* When your view is created
|
||||
* When your view receives a wxDynamicSashSplitEvent
|
||||
* When your view receives a wxDynamicSashUnifyEvent
|
||||
|
||||
See the dynsash_switch sample application for an example which does this.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "wx/event.h"
|
||||
#include "wx/window.h"
|
||||
|
||||
class WXDLLIMPEXP_CORE wxScrollBar;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// dynamic sash styles
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
wxDS_MANAGE_SCROLLBARS is a default style of wxDynamicSashWindow which
|
||||
will cause it to respond to scrollbar events for your application by
|
||||
automatically scrolling the child view.
|
||||
*/
|
||||
#define wxDS_MANAGE_SCROLLBARS 0x0010
|
||||
|
||||
|
||||
/*
|
||||
wxDS_DRAG_CORNER style indicates that the views can also be resized by
|
||||
dragging the corner piece between the scrollbars, and which is reflected up
|
||||
to the frame if necessary.
|
||||
*/
|
||||
#define wxDS_DRAG_CORNER 0x0020
|
||||
|
||||
/*
|
||||
Default style for wxDynamicSashWindow.
|
||||
*/
|
||||
#define wxDS_DEFAULT wxDS_MANAGE_SCROLLBARS | wxDS_DRAG_CORNER
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// dynamic sash events
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
extern WXDLLIMPEXP_GIZMOS const wxEventType wxEVT_DYNAMIC_SASH_SPLIT;
|
||||
extern WXDLLIMPEXP_GIZMOS const wxEventType wxEVT_DYNAMIC_SASH_UNIFY;
|
||||
|
||||
#define EVT_DYNAMIC_SASH_SPLIT(id, func) \
|
||||
wx__DECLARE_EVT1(wxEVT_DYNAMIC_SASH_SPLIT, id, \
|
||||
wxDynamicSashSplitEventHandler(func))
|
||||
|
||||
#define EVT_DYNAMIC_SASH_UNIFY(id, func) \
|
||||
wx__DECLARE_EVT1(wxEVT_DYNAMIC_SASH_UNIFY, id, \
|
||||
wxDynamicSashUnifyEventHandler(func))
|
||||
|
||||
|
||||
/*
|
||||
wxDynamicSashSplitEvents are sent to your view by wxDynamicSashWindow
|
||||
whenever your view is being split by the user. It is your
|
||||
responsibility to handle this event by creating a new view window as
|
||||
a child of the wxDynamicSashWindow. wxDynamicSashWindow will
|
||||
automatically reparent it to the proper place in its window hierarchy.
|
||||
*/
|
||||
class WXDLLIMPEXP_GIZMOS wxDynamicSashSplitEvent : public wxCommandEvent
|
||||
{
|
||||
public:
|
||||
wxDynamicSashSplitEvent();
|
||||
wxDynamicSashSplitEvent(const wxDynamicSashSplitEvent& event)
|
||||
: wxCommandEvent(event) { }
|
||||
wxDynamicSashSplitEvent(wxObject *target);
|
||||
|
||||
virtual wxEvent* Clone() const { return new wxDynamicSashSplitEvent(*this); }
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxDynamicSashSplitEvent)
|
||||
};
|
||||
|
||||
/*
|
||||
wxDynamicSashUnifyEvents are sent to your view by wxDynamicSashWindow
|
||||
whenever the sash which splits your view and its sibling is being
|
||||
reunified such that your view is expanding to replace its sibling.
|
||||
You needn't do anything with this event if you are allowing
|
||||
wxDynamicSashWindow to manage your view's scrollbars, but it is useful
|
||||
if you are managing the scrollbars yourself so that you can keep
|
||||
the scrollbars' event handlers connected to your view's event handler
|
||||
class.
|
||||
*/
|
||||
class WXDLLIMPEXP_GIZMOS wxDynamicSashUnifyEvent : public wxCommandEvent
|
||||
{
|
||||
public:
|
||||
wxDynamicSashUnifyEvent();
|
||||
wxDynamicSashUnifyEvent(const wxDynamicSashUnifyEvent& event): wxCommandEvent(event) {}
|
||||
wxDynamicSashUnifyEvent(wxObject *target);
|
||||
|
||||
virtual wxEvent* Clone() const { return new wxDynamicSashUnifyEvent(*this); }
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxDynamicSashUnifyEvent)
|
||||
};
|
||||
|
||||
typedef void (wxEvtHandler::*wxDynamicSashSplitEventFunction)(wxDynamicSashSplitEvent&);
|
||||
typedef void (wxEvtHandler::*wxDynamicSashUnifyEventFunction)(wxDynamicSashUnifyEvent&);
|
||||
|
||||
#define wxDynamicSashSplitEventHandler(func) \
|
||||
(wxObjectEventFunction)(wxEventFunction) \
|
||||
wxStaticCastEvent(wxDynamicSashSplitEventFunction, &func)
|
||||
|
||||
#define wxDynamicSashUnifyEventHandler(func) \
|
||||
(wxObjectEventFunction)(wxEventFunction) \
|
||||
wxStaticCastEvent(wxDynamicSashUnifyEventFunction, &func)
|
||||
|
||||
#define wx__DECLARE_TREEEVT(evt, id, fn) \
|
||||
wx__DECLARE_EVT1(wxEVT_COMMAND_TREE_ ## evt, id, wxTreeEventHandler(fn))
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDynamicSashWindow itself
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WXDLLIMPEXP_GIZMOS extern const wxChar* wxDynamicSashWindowNameStr;
|
||||
|
||||
class WXDLLIMPEXP_GIZMOS wxDynamicSashWindow : public wxWindow
|
||||
{
|
||||
public:
|
||||
wxDynamicSashWindow();
|
||||
wxDynamicSashWindow(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
long style = wxDS_DEFAULT,
|
||||
const wxString& name = wxDynamicSashWindowNameStr);
|
||||
virtual ~wxDynamicSashWindow();
|
||||
|
||||
virtual bool Create(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDS_DEFAULT,
|
||||
const wxString& name = wxDynamicSashWindowNameStr);
|
||||
virtual wxScrollBar *GetHScrollBar(const wxWindow *child) const;
|
||||
virtual wxScrollBar *GetVScrollBar(const wxWindow *child) const;
|
||||
|
||||
/* This is overloaded from wxWindowBase. It's not here for you to
|
||||
call directly. */
|
||||
virtual void AddChild(wxWindowBase *child);
|
||||
|
||||
private:
|
||||
class wxDynamicSashWindowImpl *m_impl;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxDynamicSashWindow)
|
||||
};
|
||||
|
||||
#endif // _WX_DYNAMICSASH_H_
|
||||
|
68
wxPython/contrib/gizmos/wxCode/include/wx/gizmos/editlbox.h
Normal file
68
wxPython/contrib/gizmos/wxCode/include/wx/gizmos/editlbox.h
Normal file
@@ -0,0 +1,68 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: editlbox.h
|
||||
// Purpose: ListBox with editable items
|
||||
// Author: Vaclav Slavik
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Vaclav Slavik
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef __WX_EDITLBOX_H__
|
||||
#define __WX_EDITLBOX_H__
|
||||
|
||||
#include "wx/panel.h"
|
||||
#include "wx/gizmos/gizmos.h"
|
||||
|
||||
class WXDLLEXPORT wxBitmapButton;
|
||||
class WXDLLEXPORT wxListCtrl;
|
||||
class WXDLLEXPORT wxListEvent;
|
||||
|
||||
#define wxEL_ALLOW_NEW 0x0100
|
||||
#define wxEL_ALLOW_EDIT 0x0200
|
||||
#define wxEL_ALLOW_DELETE 0x0400
|
||||
#define wxEL_NO_REORDER 0x0800
|
||||
|
||||
// This class provides a composite control that lets the
|
||||
// user easily enter list of strings
|
||||
|
||||
class WXDLLIMPEXP_GIZMOS wxEditableListBox : public wxPanel
|
||||
{
|
||||
DECLARE_CLASS(wxEditableListBox)
|
||||
|
||||
public:
|
||||
wxEditableListBox(wxWindow *parent, wxWindowID id,
|
||||
const wxString& label,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxEL_ALLOW_NEW | wxEL_ALLOW_EDIT | wxEL_ALLOW_DELETE,
|
||||
const wxString& name = wxT("editableListBox"));
|
||||
|
||||
void SetStrings(const wxArrayString& strings);
|
||||
void GetStrings(wxArrayString& strings) const;
|
||||
|
||||
wxListCtrl* GetListCtrl() { return m_listCtrl; }
|
||||
wxBitmapButton* GetDelButton() { return m_bDel; }
|
||||
wxBitmapButton* GetNewButton() { return m_bNew; }
|
||||
wxBitmapButton* GetUpButton() { return m_bUp; }
|
||||
wxBitmapButton* GetDownButton() { return m_bDown; }
|
||||
wxBitmapButton* GetEditButton() { return m_bEdit; }
|
||||
|
||||
protected:
|
||||
wxBitmapButton *m_bDel, *m_bNew, *m_bUp, *m_bDown, *m_bEdit;
|
||||
wxListCtrl *m_listCtrl;
|
||||
int m_selection;
|
||||
long m_style;
|
||||
|
||||
void OnItemSelected(wxListEvent& event);
|
||||
void OnEndLabelEdit(wxListEvent& event);
|
||||
void OnNewItem(wxCommandEvent& event);
|
||||
void OnDelItem(wxCommandEvent& event);
|
||||
void OnEditItem(wxCommandEvent& event);
|
||||
void OnUpItem(wxCommandEvent& event);
|
||||
void OnDownItem(wxCommandEvent& event);
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif
|
23
wxPython/contrib/gizmos/wxCode/include/wx/gizmos/gizmos.h
Normal file
23
wxPython/contrib/gizmos/wxCode/include/wx/gizmos/gizmos.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef _WX_GIZMOS_H_
|
||||
#define _WX_GIZMOS_H_
|
||||
|
||||
// #ifdef WXMAKINGDLL_GIZMOS
|
||||
// #define WXDLLIMPEXP_GIZMOS WXEXPORT
|
||||
// #elif defined(WXUSINGDLL)
|
||||
// #define WXDLLIMPEXP_GIZMOS WXIMPORT
|
||||
// #else // not making nor using DLL
|
||||
// #define WXDLLIMPEXP_GIZMOS
|
||||
// #endif
|
||||
|
||||
// #ifdef WXMAKINGDLL_GIZMOS_XRC
|
||||
// #define WXDLLIMPEXP_GIZMOS_XRC WXEXPORT
|
||||
// #elif defined(WXUSINGDLL)
|
||||
// #define WXDLLIMPEXP_GIZMOS_XRC WXIMPORT
|
||||
// #else // not making nor using DLL
|
||||
// #define WXDLLIMPEXP_GIZMOS_XRC
|
||||
// #endif
|
||||
|
||||
#define WXDLLIMPEXP_GIZMOS
|
||||
#define WXDLLIMPEXP_GIZMOS_XRC
|
||||
|
||||
#endif
|
80
wxPython/contrib/gizmos/wxCode/include/wx/gizmos/ledctrl.h
Normal file
80
wxPython/contrib/gizmos/wxCode/include/wx/gizmos/ledctrl.h
Normal file
@@ -0,0 +1,80 @@
|
||||
#ifndef _WX_LEDNUMBERCTRL_H_
|
||||
#define _WX_LEDNUMBERCTRL_H_
|
||||
|
||||
#include "wx/gizmos/gizmos.h"
|
||||
|
||||
#include <wx/window.h>
|
||||
#include <wx/control.h>
|
||||
|
||||
class wxEraseEvent;
|
||||
class wxPaintEvent;
|
||||
class wxSizeEvent;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// enum and styles
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
enum wxLEDValueAlign
|
||||
{
|
||||
wxLED_ALIGN_LEFT = 0x01,
|
||||
wxLED_ALIGN_RIGHT = 0x02,
|
||||
wxLED_ALIGN_CENTER = 0x04,
|
||||
|
||||
wxLED_ALIGN_MASK = 0x07
|
||||
};
|
||||
|
||||
#define wxLED_DRAW_FADED 0x08
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxLEDNumberCtrl
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_GIZMOS wxLEDNumberCtrl : public wxControl
|
||||
{
|
||||
public:
|
||||
// Constructors.
|
||||
wxLEDNumberCtrl();
|
||||
wxLEDNumberCtrl(wxWindow *parent, wxWindowID id = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxLED_ALIGN_LEFT | wxLED_DRAW_FADED);
|
||||
|
||||
// Create functions.
|
||||
bool Create(wxWindow *parent, wxWindowID id = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0);
|
||||
|
||||
wxLEDValueAlign GetAlignment() const { return m_Alignment; }
|
||||
bool GetDrawFaded() const { return m_DrawFaded; }
|
||||
const wxString &GetValue() const { return m_Value; }
|
||||
|
||||
void SetAlignment(wxLEDValueAlign Alignment, bool Redraw = true);
|
||||
void SetDrawFaded(bool DrawFaded, bool Redraw = true);
|
||||
void SetValue(const wxString &Value, bool Redraw = true);
|
||||
|
||||
private:
|
||||
// Members.
|
||||
wxString m_Value;
|
||||
wxLEDValueAlign m_Alignment;
|
||||
|
||||
int m_LineMargin;
|
||||
int m_DigitMargin;
|
||||
int m_LineLength;
|
||||
int m_LineWidth;
|
||||
bool m_DrawFaded;
|
||||
int m_LeftStartPos;
|
||||
|
||||
// Functions.
|
||||
void DrawDigit(wxDC &Dc, int Digit, int Column);
|
||||
void RecalcInternals(const wxSize &CurrentSize);
|
||||
|
||||
// Events.
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
void OnEraseBackground(wxEraseEvent &Event);
|
||||
void OnPaint(wxPaintEvent &Event);
|
||||
void OnSize(wxSizeEvent &Event);
|
||||
};
|
||||
|
||||
#endif
|
174
wxPython/contrib/gizmos/wxCode/include/wx/gizmos/multicell.h
Normal file
174
wxPython/contrib/gizmos/wxCode/include/wx/gizmos/multicell.h
Normal file
@@ -0,0 +1,174 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: multicell.h
|
||||
// Purpose: provide two new classes for layout, wxMultiCellSizer and wxMultiCellCanvas
|
||||
// Author: Jonathan Bayer
|
||||
// Modified by:
|
||||
// Created:
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Jonathan Bayer
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// This was inspired by the gbsizer class written by Alex Andruschak
|
||||
|
||||
|
||||
#ifndef __WX_MULTICELL_H__
|
||||
#define __WX_MULTICELL_H__
|
||||
|
||||
#include "wx/gizmos/gizmos.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
// The classes are derived from wxSizer
|
||||
#include "wx/sizer.h"
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
enum wxResizable
|
||||
{
|
||||
wxNOT_RESIZABLE = 0x00,
|
||||
wxHORIZONTAL_RESIZABLE = 0x01,
|
||||
wxVERTICAL_RESIZABLE = 0x10,
|
||||
wxRESIZABLE = 0x11
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// classes
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// wxMultiCellItemHandle
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_GIZMOS wxMultiCellItemHandle: public wxObject
|
||||
{
|
||||
DECLARE_CLASS(wxMultiCellItemHandle)
|
||||
protected:
|
||||
int m_column;
|
||||
int m_row;
|
||||
int m_width;
|
||||
int m_height;
|
||||
wxResizable m_style;
|
||||
wxSize m_fixedSize;
|
||||
int m_alignment;
|
||||
wxSize m_weight;
|
||||
|
||||
public:
|
||||
wxMultiCellItemHandle( int row, int column, int height = 1, int width = 1, wxSize size = wxDefaultSize, wxResizable style = wxNOT_RESIZABLE, wxSize weight = wxSize(1,1), int align = wxALIGN_NOT);
|
||||
wxMultiCellItemHandle( int row, int column, wxSize size, wxResizable style = wxNOT_RESIZABLE, wxSize weight = wxSize(1,1), int align = wxALIGN_NOT);
|
||||
wxMultiCellItemHandle( int row, int column, wxResizable style, wxSize weight = wxSize(1,1), int align = wxALIGN_NOT);
|
||||
int GetColumn() const;
|
||||
int GetRow() const;
|
||||
int GetWidth() const;
|
||||
int GetHeight() const;
|
||||
wxResizable GetStyle() const;
|
||||
wxSize GetLocalSize() const;
|
||||
int GetAlignment() const;
|
||||
wxSize GetWeight() const;
|
||||
|
||||
private:
|
||||
void Initialize( int row, int column, int height = 1, int width = 1, wxSize size = wxDefaultSize, wxResizable style = wxNOT_RESIZABLE, wxSize weight = wxSize(1,1), int align = wxALIGN_NOT);
|
||||
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// wxMultiCellSizer
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_GIZMOS wxMultiCellSizer : virtual public wxSizer
|
||||
{
|
||||
DECLARE_CLASS(wxMultiCellSizer)
|
||||
|
||||
protected:
|
||||
wxSize m_cell_count;
|
||||
|
||||
public:
|
||||
wxMultiCellSizer(wxSize & size);
|
||||
wxMultiCellSizer(int rows, int cols);
|
||||
~wxMultiCellSizer();
|
||||
|
||||
virtual void RecalcSizes();
|
||||
virtual wxSize CalcMin();
|
||||
bool SetDefaultCellSize(wxSize size);
|
||||
bool SetColumnWidth(int column, int colSize = 5, bool expandable = false);
|
||||
bool SetRowHeight(int row, int rowSize = 5, bool expandable = false);
|
||||
bool EnableGridLines(wxWindow *win);
|
||||
bool SetGridPen(const wxPen *pen);
|
||||
void OnPaint(wxDC& dc);
|
||||
|
||||
private:
|
||||
void GetMinimums();
|
||||
static int Sum(int *array, int x);
|
||||
|
||||
private:
|
||||
int *m_maxHeight;
|
||||
int *m_maxWidth;
|
||||
int *m_rowStretch;
|
||||
int *m_colStretch;
|
||||
wxSize **m_weights;
|
||||
wxSize **m_minSizes;
|
||||
int m_maxWeights;
|
||||
wxSize m_defaultCellSize;
|
||||
wxWindow *m_win; // usually used for debugging
|
||||
const wxPen *m_pen;
|
||||
|
||||
void DrawGridLines(wxDC& dc);
|
||||
void Initialize(wxSize size);
|
||||
};
|
||||
|
||||
|
||||
// wxCell is used internally, so we don't need to declare it here
|
||||
|
||||
class wxCell;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// wxMultiCellCanvas
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_GIZMOS wxMultiCellCanvas : public wxFlexGridSizer
|
||||
{
|
||||
public:
|
||||
wxMultiCellCanvas(wxWindow *parent, int numRows = 2, int numCols = 2);
|
||||
void Add(wxWindow *win, unsigned int row, unsigned int col);
|
||||
|
||||
void Resize(int numRows, int numCols);
|
||||
int MaxRows() const
|
||||
{
|
||||
return m_maxRows;
|
||||
};
|
||||
int MaxCols() const
|
||||
{
|
||||
return m_maxCols;
|
||||
};
|
||||
void CalculateConstraints();
|
||||
void SetMinCellSize(const wxSize size)
|
||||
{
|
||||
m_minCellSize = size;
|
||||
};
|
||||
|
||||
/* These are to hide Add() method of parents and to avoid Borland warning about hiding virtual functions */
|
||||
void Add( wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL )
|
||||
{ wxFlexGridSizer::Add( window, proportion, flag, border, userData); }
|
||||
void Add( wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL )
|
||||
{ wxFlexGridSizer::Add( sizer, proportion, flag, border, userData); }
|
||||
void Add( int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL )
|
||||
{ wxFlexGridSizer::Add( width, height, proportion, flag, border, userData); }
|
||||
void Add( wxSizerItem *item )
|
||||
{ wxFlexGridSizer::Add( item); }
|
||||
|
||||
private:
|
||||
wxWindow *m_parent;
|
||||
unsigned int m_maxRows, m_maxCols;
|
||||
|
||||
wxSize m_minCellSize;
|
||||
wxCell **m_cells;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*** End of File ***/
|
231
wxPython/contrib/gizmos/wxCode/include/wx/gizmos/splittree.h
Normal file
231
wxPython/contrib/gizmos/wxCode/include/wx/gizmos/splittree.h
Normal file
@@ -0,0 +1,231 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: splittree.h
|
||||
// Purpose: Classes to achieve a remotely-scrolled tree in a splitter
|
||||
// window that can be scrolled by a scrolled window higher in the
|
||||
// hierarchy
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 8/7/2000
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_SPLITTREE_H_
|
||||
#define _WX_SPLITTREE_H_
|
||||
|
||||
#include "wx/gizmos/gizmos.h"
|
||||
|
||||
// Set this to 1 to use generic tree control (doesn't yet work properly)
|
||||
#define USE_GENERIC_TREECTRL 0
|
||||
|
||||
#include "wx/wx.h"
|
||||
#include "wx/treectrl.h"
|
||||
#include "wx/splitter.h"
|
||||
#include "wx/scrolwin.h"
|
||||
|
||||
#if USE_GENERIC_TREECTRL
|
||||
#include "wx/generic/treectlg.h"
|
||||
#ifndef wxTreeCtrl
|
||||
#define wxTreeCtrl wxGenericTreeCtrl
|
||||
#define sm_classwxTreeCtrl sm_classwxGenericTreeCtrl
|
||||
#endif
|
||||
#endif
|
||||
|
||||
class wxRemotelyScrolledTreeCtrl;
|
||||
class wxThinSplitterWindow;
|
||||
class wxSplitterScrolledWindow;
|
||||
|
||||
/*
|
||||
* wxRemotelyScrolledTreeCtrl
|
||||
*
|
||||
* This tree control disables its vertical scrollbar and catches scroll
|
||||
* events passed by a scrolled window higher in the hierarchy.
|
||||
* It also updates the scrolled window vertical scrollbar as appropriate.
|
||||
*/
|
||||
|
||||
class WXDLLIMPEXP_GIZMOS wxRemotelyScrolledTreeCtrl: public wxTreeCtrl
|
||||
{
|
||||
DECLARE_CLASS(wxRemotelyScrolledTreeCtrl)
|
||||
public:
|
||||
wxRemotelyScrolledTreeCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pt = wxDefaultPosition,
|
||||
const wxSize& sz = wxDefaultSize, long style = wxTR_HAS_BUTTONS);
|
||||
~wxRemotelyScrolledTreeCtrl();
|
||||
|
||||
//// Events
|
||||
void OnSize(wxSizeEvent& event);
|
||||
void OnExpand(wxTreeEvent& event);
|
||||
void OnScroll(wxScrollWinEvent& event);
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
|
||||
//// Overrides
|
||||
// Override this in case we're using the generic tree control.
|
||||
// Calls to this should disable the vertical scrollbar.
|
||||
|
||||
// Number of pixels per user unit (0 or -1 for no scrollbar)
|
||||
// Length of virtual canvas in user units
|
||||
// Length of page in user units
|
||||
virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
|
||||
int noUnitsX, int noUnitsY,
|
||||
int xPos = 0, int yPos = 0,
|
||||
bool noRefresh = false );
|
||||
|
||||
// In case we're using the generic tree control.
|
||||
// Get the view start
|
||||
virtual void GetViewStart(int *x, int *y) const;
|
||||
|
||||
// In case we're using the generic tree control.
|
||||
virtual void PrepareDC(wxDC& dc);
|
||||
|
||||
// In case we're using the generic tree control.
|
||||
virtual int GetScrollPos(int orient) const;
|
||||
|
||||
//// Helpers
|
||||
void HideVScrollbar();
|
||||
|
||||
// Calculate the tree overall size so we can set the scrollbar
|
||||
// correctly
|
||||
void CalcTreeSize(wxRect& rect);
|
||||
void CalcTreeSize(const wxTreeItemId& id, wxRect& rect);
|
||||
|
||||
// Adjust the containing wxScrolledWindow's scrollbars appropriately
|
||||
void AdjustRemoteScrollbars();
|
||||
|
||||
// Find the scrolled window that contains this control
|
||||
wxScrolledWindow* GetScrolledWindow() const;
|
||||
|
||||
// Scroll to the given line (in scroll units where each unit is
|
||||
// the height of an item)
|
||||
void ScrollToLine(int posHoriz, int posVert);
|
||||
|
||||
//// Accessors
|
||||
|
||||
// The companion window is one which will get notified when certain
|
||||
// events happen such as node expansion
|
||||
void SetCompanionWindow(wxWindow* companion) { m_companionWindow = companion; }
|
||||
wxWindow* GetCompanionWindow() const { return m_companionWindow; }
|
||||
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
protected:
|
||||
wxWindow* m_companionWindow;
|
||||
bool m_drawRowLines;
|
||||
};
|
||||
|
||||
/*
|
||||
* wxTreeCompanionWindow
|
||||
*
|
||||
* A window displaying values associated with tree control items.
|
||||
*/
|
||||
|
||||
class WXDLLIMPEXP_GIZMOS wxTreeCompanionWindow: public wxWindow
|
||||
{
|
||||
public:
|
||||
DECLARE_CLASS(wxTreeCompanionWindow)
|
||||
|
||||
wxTreeCompanionWindow(wxWindow* parent, wxWindowID id = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& sz = wxDefaultSize,
|
||||
long style = 0);
|
||||
|
||||
//// Overrides
|
||||
virtual void DrawItem(wxDC& dc, wxTreeItemId id, const wxRect& rect);
|
||||
|
||||
//// Events
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
void OnScroll(wxScrollWinEvent& event);
|
||||
void OnExpand(wxTreeEvent& event);
|
||||
|
||||
//// Operations
|
||||
|
||||
//// Accessors
|
||||
wxRemotelyScrolledTreeCtrl* GetTreeCtrl() const { return m_treeCtrl; };
|
||||
void SetTreeCtrl(wxRemotelyScrolledTreeCtrl* treeCtrl) { m_treeCtrl = treeCtrl; }
|
||||
|
||||
//// Data members
|
||||
protected:
|
||||
wxRemotelyScrolledTreeCtrl* m_treeCtrl;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* wxThinSplitterWindow
|
||||
*
|
||||
* Implements a splitter with a less obvious sash
|
||||
* than the usual one.
|
||||
*/
|
||||
|
||||
class WXDLLIMPEXP_GIZMOS wxThinSplitterWindow: public wxSplitterWindow
|
||||
{
|
||||
public:
|
||||
DECLARE_DYNAMIC_CLASS(wxThinSplitterWindow)
|
||||
|
||||
wxThinSplitterWindow(wxWindow* parent, wxWindowID id = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& sz = wxDefaultSize,
|
||||
long style = wxSP_3D | wxCLIP_CHILDREN);
|
||||
~wxThinSplitterWindow();
|
||||
|
||||
//// Overrides
|
||||
|
||||
void SizeWindows();
|
||||
// Tests for x, y over sash. Overriding this allows us to increase
|
||||
// the tolerance.
|
||||
bool SashHitTest(int x, int y, int tolerance = 2);
|
||||
void DrawSash(wxDC& dc);
|
||||
|
||||
//// Events
|
||||
|
||||
void OnSize(wxSizeEvent& event);
|
||||
|
||||
//// Operations
|
||||
|
||||
//// Accessors
|
||||
|
||||
//// Data members
|
||||
protected:
|
||||
wxPen* m_facePen;
|
||||
wxBrush* m_faceBrush;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
/*
|
||||
* wxSplitterScrolledWindow
|
||||
*
|
||||
* This scrolled window is aware of the fact that one of its
|
||||
* children is a splitter window. It passes on its scroll events
|
||||
* (after some processing) to both splitter children for them
|
||||
* scroll appropriately.
|
||||
*/
|
||||
|
||||
class WXDLLIMPEXP_GIZMOS wxSplitterScrolledWindow: public wxScrolledWindow
|
||||
{
|
||||
public:
|
||||
DECLARE_DYNAMIC_CLASS(wxSplitterScrolledWindow)
|
||||
|
||||
wxSplitterScrolledWindow(wxWindow* parent, wxWindowID id = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& sz = wxDefaultSize,
|
||||
long style = 0);
|
||||
|
||||
//// Overrides
|
||||
|
||||
//// Events
|
||||
|
||||
void OnScroll(wxScrollWinEvent& event);
|
||||
void OnSize(wxSizeEvent& event);
|
||||
|
||||
//// Operations
|
||||
|
||||
//// Accessors
|
||||
|
||||
//// Data members
|
||||
public:
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif
|
||||
// _SPLITTREE_H_
|
138
wxPython/contrib/gizmos/wxCode/include/wx/gizmos/statpict.h
Normal file
138
wxPython/contrib/gizmos/wxCode/include/wx/gizmos/statpict.h
Normal file
@@ -0,0 +1,138 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: statpict.h
|
||||
// Purpose: wxStaticPicture class
|
||||
// Author: Wade Brainerd
|
||||
// Modified by:
|
||||
// Created: 2003-05-01
|
||||
// RCS-ID:
|
||||
// Copyright: (c) Wade Brainerd
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_STATPICT_H_
|
||||
#define _WX_STATPICT_H_
|
||||
|
||||
#include "wx/control.h"
|
||||
|
||||
#include "wx/icon.h"
|
||||
#include "wx/bitmap.h"
|
||||
#include "wx/image.h"
|
||||
|
||||
#include "wx/gizmos/gizmos.h"
|
||||
|
||||
enum
|
||||
{
|
||||
wxSCALE_HORIZONTAL = 0x1,
|
||||
wxSCALE_VERTICAL = 0x2,
|
||||
wxSCALE_UNIFORM = 0x4,
|
||||
wxSCALE_CUSTOM = 0x8
|
||||
};
|
||||
|
||||
WXDLLIMPEXP_GIZMOS extern const wxChar* wxStaticPictureNameStr;
|
||||
|
||||
class WXDLLIMPEXP_GIZMOS wxStaticPicture : public wxControl
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxStaticPicture)
|
||||
|
||||
public:
|
||||
wxStaticPicture() {}
|
||||
|
||||
wxStaticPicture( wxWindow* parent, wxWindowID id,
|
||||
const wxBitmap& label,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxStaticPictureNameStr )
|
||||
{
|
||||
Create( parent, id, label, pos, size, style, name );
|
||||
}
|
||||
|
||||
bool Create( wxWindow* parent, wxWindowID id,
|
||||
const wxBitmap& label,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxStaticPictureNameStr );
|
||||
|
||||
virtual void Command(wxCommandEvent& WXUNUSED(event)) {}
|
||||
virtual bool ProcessCommand(wxCommandEvent& WXUNUSED(event)) {return true;}
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
|
||||
void SetBitmap( const wxBitmap& bmp );
|
||||
|
||||
wxBitmap GetBitmap() const
|
||||
{
|
||||
return Bitmap;
|
||||
}
|
||||
|
||||
// Icon interface for compatibility with wxStaticBitmap.
|
||||
void SetIcon( const wxIcon& icon )
|
||||
{
|
||||
wxBitmap bmp;
|
||||
bmp.CopyFromIcon( icon );
|
||||
SetBitmap( bmp );
|
||||
}
|
||||
|
||||
wxIcon GetIcon() const
|
||||
{
|
||||
wxIcon icon;
|
||||
icon.CopyFromBitmap( Bitmap );
|
||||
return icon;
|
||||
}
|
||||
|
||||
void SetAlignment( int align )
|
||||
{
|
||||
Align = align;
|
||||
}
|
||||
|
||||
int GetAlignment() const
|
||||
{
|
||||
return Align;
|
||||
}
|
||||
|
||||
void SetScale( int scale )
|
||||
{
|
||||
Scale = scale;
|
||||
}
|
||||
|
||||
int GetScale() const
|
||||
{
|
||||
return Scale;
|
||||
}
|
||||
|
||||
void SetCustomScale( float sx, float sy )
|
||||
{
|
||||
ScaleX = sx;
|
||||
ScaleY = sy;
|
||||
}
|
||||
|
||||
void GetCustomScale( float* sx, float* sy ) const
|
||||
{
|
||||
*sx = ScaleX;
|
||||
*sy = ScaleY;
|
||||
}
|
||||
|
||||
protected:
|
||||
wxBitmap Bitmap;
|
||||
|
||||
int Align;
|
||||
|
||||
int Scale;
|
||||
float ScaleX;
|
||||
float ScaleY;
|
||||
|
||||
#ifndef __WXMSW__
|
||||
// When scaling is enabled, measures are taken to improve performance on non-Windows platforms.
|
||||
// - The original bitmap is stored as a wxImage, because conversion from wxBitmap to wxImage is slow.
|
||||
// - The latest scaled bitmap is cached, this improves performance when the control is repainted
|
||||
// but the size hasn't changed (overlapping windows, movement, etc).
|
||||
wxImage OriginalImage;
|
||||
float LastScaleX;
|
||||
float LastScaleY;
|
||||
wxBitmap ScaledBitmap;
|
||||
#endif
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif // #ifndef _WX_STATPICT_H_
|
@@ -0,0 +1,39 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: xh_statpict.h
|
||||
// Purpose: XRC resource handler for wxStaticPicture
|
||||
// Author: David A. Norris
|
||||
// Created: 2005/03/13
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: David A. Norris
|
||||
// Licence: wxWindows Licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_XH_STATPICT_H
|
||||
#define _WX_XH_STATPICT_H
|
||||
|
||||
#include "wx/xrc/xmlres.h"
|
||||
#include "wx/gizmos/gizmos.h"
|
||||
|
||||
//
|
||||
// XML resource handler for the wxStaticPicture class in wxContrib.
|
||||
//
|
||||
|
||||
class WXDLLIMPEXP_GIZMOS_XRC wxStaticPictureXmlHandler
|
||||
: public wxXmlResourceHandler
|
||||
{
|
||||
public:
|
||||
|
||||
// Constructor.
|
||||
wxStaticPictureXmlHandler();
|
||||
|
||||
// Creates the control and returns a pointer to it.
|
||||
virtual wxObject *DoCreateResource();
|
||||
|
||||
// Returns true if we know how to create a control for the given node.
|
||||
virtual bool CanHandle(wxXmlNode *node);
|
||||
|
||||
// Register with wxWindows' dynamic class subsystem.
|
||||
DECLARE_DYNAMIC_CLASS(wxStaticPictureXmlHandler)
|
||||
};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user