mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-16 03:38:38 +12:00
This commit is contained in:
parent
de070bf485
commit
a90b5cf37a
1998 changed files with 1034301 additions and 0 deletions
21
wxWidgets/include/wx/univ/app.h
Normal file
21
wxWidgets/include/wx/univ/app.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/app.h
|
||||
// Purpose: wxUniversalApp class extends wxApp for wxUniv port
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 06.08.00
|
||||
// RCS-ID: $Id: app.h 27408 2004-05-23 20:53:33Z JS $
|
||||
// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIX_APP_H_
|
||||
#define _WX_UNIX_APP_H_
|
||||
|
||||
class WXDLLEXPORT wxUniversalApp : public wxApp
|
||||
{
|
||||
public:
|
||||
};
|
||||
|
||||
#endif // _WX_UNIX_APP_H_
|
||||
|
72
wxWidgets/include/wx/univ/bmpbuttn.h
Normal file
72
wxWidgets/include/wx/univ/bmpbuttn.h
Normal file
|
@ -0,0 +1,72 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/bmpbuttn.h
|
||||
// Purpose: wxBitmapButton class for wxUniversal
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 25.08.00
|
||||
// RCS-ID: $Id: bmpbuttn.h 35650 2005-09-23 12:56:45Z MR $
|
||||
// Copyright: (c) Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_BMPBUTTN_H_
|
||||
#define _WX_UNIV_BMPBUTTN_H_
|
||||
|
||||
class WXDLLEXPORT wxBitmapButton : public wxBitmapButtonBase
|
||||
{
|
||||
public:
|
||||
wxBitmapButton() { }
|
||||
|
||||
wxBitmapButton(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxBitmap& bitmap,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxButtonNameStr)
|
||||
{
|
||||
Create(parent, id, bitmap, pos, size, style, validator, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxBitmap& bitmap,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxButtonNameStr);
|
||||
|
||||
virtual void SetMargins(int x, int y)
|
||||
{
|
||||
SetImageMargins(x, y);
|
||||
|
||||
wxBitmapButtonBase::SetMargins(x, y);
|
||||
}
|
||||
|
||||
virtual bool Enable(bool enable = true);
|
||||
|
||||
virtual bool SetCurrent(bool doit = true);
|
||||
|
||||
virtual void Press();
|
||||
virtual void Release();
|
||||
|
||||
protected:
|
||||
void OnSetFocus(wxFocusEvent& event);
|
||||
void OnKillFocus(wxFocusEvent& event);
|
||||
|
||||
// called when one of the bitmap is changed by user
|
||||
virtual void OnSetBitmap();
|
||||
|
||||
// set bitmap to the given one if it's ok or to m_bmpNormal and return
|
||||
// true if the bitmap really changed
|
||||
bool ChangeBitmap(const wxBitmap& bmp);
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxBitmapButton)
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_BMPBUTTN_H_
|
||||
|
139
wxWidgets/include/wx/univ/button.h
Normal file
139
wxWidgets/include/wx/univ/button.h
Normal file
|
@ -0,0 +1,139 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/button.h
|
||||
// Purpose: wxButton for wxUniversal
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 15.08.00
|
||||
// RCS-ID: $Id: button.h 61872 2009-09-09 22:37:05Z VZ $
|
||||
// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_BUTTON_H_
|
||||
#define _WX_UNIV_BUTTON_H_
|
||||
|
||||
class WXDLLEXPORT wxInputHandler;
|
||||
|
||||
#include "wx/bitmap.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// the actions supported by this control
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#define wxACTION_BUTTON_TOGGLE wxT("toggle") // press/release the button
|
||||
#define wxACTION_BUTTON_PRESS wxT("press") // press the button
|
||||
#define wxACTION_BUTTON_RELEASE wxT("release") // release the button
|
||||
#define wxACTION_BUTTON_CLICK wxT("click") // generate button click event
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxButton: a push button
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxButton : public wxButtonBase
|
||||
{
|
||||
public:
|
||||
wxButton() { Init(); }
|
||||
wxButton(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxBitmap& bitmap,
|
||||
const wxString& label = wxEmptyString,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxButtonNameStr)
|
||||
{
|
||||
Init();
|
||||
|
||||
Create(parent, id, bitmap, label, pos, size, style, validator, name);
|
||||
}
|
||||
|
||||
wxButton(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& label = wxEmptyString,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxButtonNameStr)
|
||||
{
|
||||
Init();
|
||||
|
||||
Create(parent, id, label, pos, size, style, validator, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& label = wxEmptyString,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxButtonNameStr)
|
||||
{
|
||||
return Create(parent, id, wxNullBitmap, label,
|
||||
pos, size, style, validator, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxBitmap& bitmap,
|
||||
const wxString& label = wxEmptyString,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxButtonNameStr);
|
||||
|
||||
virtual ~wxButton();
|
||||
|
||||
virtual void SetImageLabel(const wxBitmap& bitmap);
|
||||
virtual void SetImageMargins(wxCoord x, wxCoord y);
|
||||
virtual void SetDefault();
|
||||
|
||||
virtual bool IsPressed() const { return m_isPressed; }
|
||||
virtual bool IsDefault() const { return m_isDefault; }
|
||||
|
||||
// wxButton actions
|
||||
virtual void Toggle();
|
||||
virtual void Press();
|
||||
virtual void Release();
|
||||
virtual void Click();
|
||||
|
||||
virtual bool PerformAction(const wxControlAction& action,
|
||||
long numArg = -1,
|
||||
const wxString& strArg = wxEmptyString);
|
||||
|
||||
virtual bool CanBeHighlighted() const { return true; }
|
||||
|
||||
static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef);
|
||||
virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef)
|
||||
{
|
||||
return GetStdInputHandler(handlerDef);
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
virtual wxSize DoGetBestClientSize() const;
|
||||
|
||||
virtual bool DoDrawBackground(wxDC& dc);
|
||||
virtual void DoDraw(wxControlRenderer *renderer);
|
||||
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
// current state
|
||||
bool m_isPressed,
|
||||
m_isDefault;
|
||||
|
||||
// the (optional) image to show and the margins around it
|
||||
wxBitmap m_bitmap;
|
||||
wxCoord m_marginBmpX,
|
||||
m_marginBmpY;
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxButton)
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_BUTTON_H_
|
||||
|
150
wxWidgets/include/wx/univ/checkbox.h
Normal file
150
wxWidgets/include/wx/univ/checkbox.h
Normal file
|
@ -0,0 +1,150 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/checkbox.h
|
||||
// Purpose: wxCheckBox declaration
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 07.09.00
|
||||
// RCS-ID: $Id: checkbox.h 61872 2009-09-09 22:37:05Z VZ $
|
||||
// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_CHECKBOX_H_
|
||||
#define _WX_UNIV_CHECKBOX_H_
|
||||
|
||||
#include "wx/button.h" // for wxStdButtonInputHandler
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// the actions supported by wxCheckBox
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#define wxACTION_CHECKBOX_CHECK wxT("check") // SetValue(true)
|
||||
#define wxACTION_CHECKBOX_CLEAR wxT("clear") // SetValue(false)
|
||||
#define wxACTION_CHECKBOX_TOGGLE wxT("toggle") // toggle the check state
|
||||
|
||||
// additionally it accepts wxACTION_BUTTON_PRESS and RELEASE
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxCheckBox
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxCheckBox : public wxCheckBoxBase
|
||||
{
|
||||
public:
|
||||
// checkbox constants
|
||||
enum State
|
||||
{
|
||||
State_Normal,
|
||||
State_Pressed,
|
||||
State_Disabled,
|
||||
State_Current,
|
||||
State_Max
|
||||
};
|
||||
|
||||
enum Status
|
||||
{
|
||||
Status_Checked,
|
||||
Status_Unchecked,
|
||||
Status_3rdState,
|
||||
Status_Max
|
||||
};
|
||||
|
||||
// constructors
|
||||
wxCheckBox() { Init(); }
|
||||
|
||||
wxCheckBox(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& label,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxCheckBoxNameStr)
|
||||
{
|
||||
Init();
|
||||
|
||||
Create(parent, id, label, pos, size, style, validator, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& label,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxCheckBoxNameStr);
|
||||
|
||||
// implement the checkbox interface
|
||||
virtual void SetValue(bool value);
|
||||
virtual bool GetValue() const;
|
||||
|
||||
// set/get the bitmaps to use for the checkbox indicator
|
||||
void SetBitmap(const wxBitmap& bmp, State state, Status status);
|
||||
virtual wxBitmap GetBitmap(State state, Status status) const;
|
||||
|
||||
// wxCheckBox actions
|
||||
void Toggle();
|
||||
virtual void Press();
|
||||
virtual void Release();
|
||||
virtual void ChangeValue(bool value);
|
||||
|
||||
// overridden base class virtuals
|
||||
virtual bool IsPressed() const { return m_isPressed; }
|
||||
|
||||
virtual bool PerformAction(const wxControlAction& action,
|
||||
long numArg = -1,
|
||||
const wxString& strArg = wxEmptyString);
|
||||
|
||||
virtual bool CanBeHighlighted() const { return true; }
|
||||
virtual wxInputHandler *CreateStdInputHandler(wxInputHandler *handlerDef);
|
||||
virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef)
|
||||
{
|
||||
return CreateStdInputHandler(handlerDef);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void DoSet3StateValue(wxCheckBoxState WXUNUSED(state));
|
||||
virtual wxCheckBoxState DoGet3StateValue() const;
|
||||
|
||||
virtual void DoDraw(wxControlRenderer *renderer);
|
||||
virtual wxSize DoGetBestClientSize() const;
|
||||
|
||||
// get the size of the bitmap using either the current one or the default
|
||||
// one (query renderer then)
|
||||
virtual wxSize GetBitmapSize() const;
|
||||
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
// send command event notifying about the checkbox state change
|
||||
virtual void SendEvent();
|
||||
|
||||
// called when the checkbox becomes checked - radio button hook
|
||||
virtual void OnCheck();
|
||||
|
||||
// get the state corresponding to the flags (combination of wxCONTROL_XXX)
|
||||
wxCheckBox::State GetState(int flags) const;
|
||||
|
||||
// directly access the bitmaps array without trying to find a valid bitmap
|
||||
// to use as GetBitmap() does
|
||||
wxBitmap DoGetBitmap(State state, Status status) const
|
||||
{ return m_bitmaps[state][status]; }
|
||||
|
||||
// get the current status
|
||||
Status GetStatus() const { return m_status; }
|
||||
|
||||
private:
|
||||
// the current check status
|
||||
Status m_status;
|
||||
|
||||
// the bitmaps to use for the different states
|
||||
wxBitmap m_bitmaps[State_Max][Status_Max];
|
||||
|
||||
// is the checkbox currently pressed?
|
||||
bool m_isPressed;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxCheckBox)
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_CHECKBOX_H_
|
114
wxWidgets/include/wx/univ/checklst.h
Normal file
114
wxWidgets/include/wx/univ/checklst.h
Normal file
|
@ -0,0 +1,114 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/checklst.h
|
||||
// Purpose: wxCheckListBox class for wxUniversal
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 12.09.00
|
||||
// RCS-ID: $Id: checklst.h 61872 2009-09-09 22:37:05Z VZ $
|
||||
// Copyright: (c) Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_CHECKLST_H_
|
||||
#define _WX_UNIV_CHECKLST_H_
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// actions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#define wxACTION_CHECKLISTBOX_TOGGLE wxT("toggle")
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxCheckListBox
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxCheckListBox : public wxCheckListBoxBase
|
||||
{
|
||||
public:
|
||||
// ctors
|
||||
wxCheckListBox() { Init(); }
|
||||
|
||||
wxCheckListBox(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
int nStrings = 0,
|
||||
const wxString choices[] = NULL,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxListBoxNameStr)
|
||||
{
|
||||
Init();
|
||||
|
||||
Create(parent, id, pos, size, nStrings, choices, style, validator, name);
|
||||
}
|
||||
wxCheckListBox(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
const wxArrayString& choices,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxListBoxNameStr);
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
int nStrings = 0,
|
||||
const wxString choices[] = (const wxString *) NULL,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxListBoxNameStr);
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
const wxArrayString& choices,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxListBoxNameStr);
|
||||
|
||||
// implement check list box methods
|
||||
virtual bool IsChecked(unsigned int item) const;
|
||||
virtual void Check(unsigned int item, bool check = true);
|
||||
|
||||
// and input handling
|
||||
virtual bool PerformAction(const wxControlAction& action,
|
||||
long numArg = -1l,
|
||||
const wxString& strArg = wxEmptyString);
|
||||
|
||||
static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef);
|
||||
virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef)
|
||||
{
|
||||
return GetStdInputHandler(handlerDef);
|
||||
}
|
||||
|
||||
// override all methods which add/delete items to update m_checks array as
|
||||
// well
|
||||
virtual void Delete(unsigned int n);
|
||||
|
||||
protected:
|
||||
virtual int DoAppend(const wxString& item);
|
||||
virtual void DoInsertItems(const wxArrayString& items, unsigned int pos);
|
||||
virtual void DoSetItems(const wxArrayString& items, void **clientData);
|
||||
virtual void DoClear();
|
||||
|
||||
// draw the check items instead of the usual ones
|
||||
virtual void DoDrawRange(wxControlRenderer *renderer,
|
||||
int itemFirst, int itemLast);
|
||||
|
||||
// take them also into account for size calculation
|
||||
virtual wxSize DoGetBestClientSize() const;
|
||||
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
private:
|
||||
// the array containing the checked status of the items
|
||||
wxArrayInt m_checks;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxCheckListBox)
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_CHECKLST_H_
|
117
wxWidgets/include/wx/univ/chkconf.h
Normal file
117
wxWidgets/include/wx/univ/chkconf.h
Normal file
|
@ -0,0 +1,117 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/chkconf.h
|
||||
// Purpose: wxUniversal-specific configuration options checks
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 2006-09-28 (extracted from wx/chkconf.h)
|
||||
// RCS-ID: $Id: chkconf.h 41494 2006-09-28 22:55:28Z VZ $
|
||||
// Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_CHKCONF_H_
|
||||
#define _WX_UNIV_CHKCONF_H_
|
||||
|
||||
#if (wxUSE_COMBOBOX || wxUSE_MENUS) && !wxUSE_POPUPWIN
|
||||
# ifdef wxABORT_ON_CONFIG_ERROR
|
||||
# error "wxUSE_POPUPWIN must be defined to use comboboxes/menus"
|
||||
# else
|
||||
# undef wxUSE_POPUPWIN
|
||||
# define wxUSE_POPUPWIN 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if wxUSE_COMBOBOX
|
||||
# if !wxUSE_LISTBOX
|
||||
# ifdef wxABORT_ON_CONFIG_ERROR
|
||||
# error "wxComboBox requires wxListBox in wxUniversal"
|
||||
# else
|
||||
# undef wxUSE_LISTBOX
|
||||
# define wxUSE_LISTBOX 1
|
||||
# endif
|
||||
# endif
|
||||
#endif /* wxUSE_COMBOBOX */
|
||||
|
||||
#if wxUSE_RADIOBTN
|
||||
# if !wxUSE_CHECKBOX
|
||||
# ifdef wxABORT_ON_CONFIG_ERROR
|
||||
# error "wxUSE_RADIOBTN requires wxUSE_CHECKBOX in wxUniversal"
|
||||
# else
|
||||
# undef wxUSE_CHECKBOX
|
||||
# define wxUSE_CHECKBOX 1
|
||||
# endif
|
||||
# endif
|
||||
#endif /* wxUSE_RADIOBTN */
|
||||
|
||||
#if wxUSE_TEXTCTRL
|
||||
# if !wxUSE_CARET
|
||||
# ifdef wxABORT_ON_CONFIG_ERROR
|
||||
# error "wxTextCtrl requires wxCaret in wxUniversal"
|
||||
# else
|
||||
# undef wxUSE_CARET
|
||||
# define wxUSE_CARET 1
|
||||
# endif
|
||||
# endif /* wxUSE_CARET */
|
||||
|
||||
# if !wxUSE_SCROLLBAR
|
||||
# ifdef wxABORT_ON_CONFIG_ERROR
|
||||
# error "wxTextCtrl requires wxScrollBar in wxUniversal"
|
||||
# else
|
||||
# undef wxUSE_SCROLLBAR
|
||||
# define wxUSE_SCROLLBAR 1
|
||||
# endif
|
||||
# endif /* wxUSE_SCROLLBAR */
|
||||
#endif /* wxUSE_TEXTCTRL */
|
||||
|
||||
|
||||
/* Themes checks */
|
||||
#ifndef wxUSE_ALL_THEMES
|
||||
# ifdef wxABORT_ON_CONFIG_ERROR
|
||||
# error "wxUSE_ALL_THEMES must be defined"
|
||||
# else
|
||||
# define wxUSE_ALL_THEMES 1
|
||||
# endif
|
||||
#endif /* wxUSE_ALL_THEMES */
|
||||
|
||||
#ifndef wxUSE_THEME_GTK
|
||||
# ifdef wxABORT_ON_CONFIG_ERROR
|
||||
# error "wxUSE_THEME_GTK must be defined"
|
||||
# else
|
||||
# define wxUSE_THEME_GTK 1
|
||||
# endif
|
||||
#endif /* wxUSE_THEME_GTK */
|
||||
|
||||
#ifndef wxUSE_THEME_METAL
|
||||
# ifdef wxABORT_ON_CONFIG_ERROR
|
||||
# error "wxUSE_THEME_METAL must be defined"
|
||||
# else
|
||||
# define wxUSE_THEME_METAL 1
|
||||
# endif
|
||||
#endif /* wxUSE_THEME_METAL */
|
||||
|
||||
#ifndef wxUSE_THEME_MONO
|
||||
# ifdef wxABORT_ON_CONFIG_ERROR
|
||||
# error "wxUSE_THEME_MONO must be defined"
|
||||
# else
|
||||
# define wxUSE_THEME_MONO 1
|
||||
# endif
|
||||
#endif /* wxUSE_THEME_MONO */
|
||||
|
||||
#ifndef wxUSE_THEME_WIN32
|
||||
# ifdef wxABORT_ON_CONFIG_ERROR
|
||||
# error "wxUSE_THEME_WIN32 must be defined"
|
||||
# else
|
||||
# define wxUSE_THEME_WIN32 1
|
||||
# endif
|
||||
#endif /* wxUSE_THEME_WIN32 */
|
||||
|
||||
#if !wxUSE_ALL_THEMES && wxUSE_THEME_METAL && !wxUSE_THEME_WIN32
|
||||
# ifdef wxABORT_ON_CONFIG_ERROR
|
||||
# error "Metal theme requires Win32 one"
|
||||
# else
|
||||
# undef wxUSE_THEME_WIN32
|
||||
# define wxUSE_THEME_WIN32 1
|
||||
# endif
|
||||
#endif /* wxUSE_THEME_METAL && !wxUSE_THEME_WIN32 */
|
||||
|
||||
#endif /* _WX_UNIV_CHKCONF_H_ */
|
||||
|
64
wxWidgets/include/wx/univ/choice.h
Normal file
64
wxWidgets/include/wx/univ/choice.h
Normal file
|
@ -0,0 +1,64 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/choice.h
|
||||
// Purpose: the universal choice
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 30.08.00
|
||||
// RCS-ID: $Id: choice.h 35650 2005-09-23 12:56:45Z MR $
|
||||
// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_CHOICE_H_
|
||||
#define _WX_UNIV_CHOICE_H_
|
||||
|
||||
#include "wx/combobox.h"
|
||||
|
||||
// VS: This is only a *temporary* implementation, real wxChoice should not
|
||||
// derive from wxComboBox and may have different l&f
|
||||
class WXDLLEXPORT wxChoice : public wxComboBox
|
||||
{
|
||||
public:
|
||||
wxChoice() {}
|
||||
wxChoice(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
int n = 0, const wxString choices[] = (const wxString *) NULL,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxChoiceNameStr)
|
||||
{
|
||||
Create(parent, id, pos, size, n, choices, style, validator, name);
|
||||
}
|
||||
wxChoice(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
const wxArrayString& choices,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxChoiceNameStr);
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
int n = 0, const wxString choices[] = (wxString *) NULL,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxChoiceNameStr);
|
||||
bool Create(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
const wxArrayString& choices,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxChoiceNameStr);
|
||||
|
||||
private:
|
||||
void OnComboBox(wxCommandEvent &event);
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxChoice)
|
||||
};
|
||||
|
||||
|
||||
#endif // _WX_UNIV_CHOICE_H_
|
103
wxWidgets/include/wx/univ/colschem.h
Normal file
103
wxWidgets/include/wx/univ/colschem.h
Normal file
|
@ -0,0 +1,103 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/colschem.h
|
||||
// Purpose: wxColourScheme class provides the colours to use for drawing
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 19.08.00
|
||||
// RCS-ID: $Id: colschem.h 44058 2006-12-24 19:06:39Z VS $
|
||||
// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_COLSCHEM_H_
|
||||
#define _WX_UNIV_COLSCHEM_H_
|
||||
|
||||
class WXDLLEXPORT wxWindow;
|
||||
|
||||
#include "wx/colour.h"
|
||||
#include "wx/checkbox.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxColourScheme
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxColourScheme
|
||||
{
|
||||
public:
|
||||
// the standard colours
|
||||
enum StdColour
|
||||
{
|
||||
// the background colour for a window
|
||||
WINDOW,
|
||||
|
||||
// the different background and text colours for the control
|
||||
CONTROL,
|
||||
CONTROL_PRESSED,
|
||||
CONTROL_CURRENT,
|
||||
|
||||
// the label text for the normal and the disabled state
|
||||
CONTROL_TEXT,
|
||||
CONTROL_TEXT_DISABLED,
|
||||
CONTROL_TEXT_DISABLED_SHADOW,
|
||||
|
||||
// the scrollbar background colour for the normal and pressed states
|
||||
SCROLLBAR,
|
||||
SCROLLBAR_PRESSED,
|
||||
|
||||
// the background and text colour for the highlighted item
|
||||
HIGHLIGHT,
|
||||
HIGHLIGHT_TEXT,
|
||||
|
||||
// these colours are used for drawing the shadows of 3D objects
|
||||
SHADOW_DARK,
|
||||
SHADOW_HIGHLIGHT,
|
||||
SHADOW_IN,
|
||||
SHADOW_OUT,
|
||||
|
||||
// the titlebar background colours for the normal and focused states
|
||||
TITLEBAR,
|
||||
TITLEBAR_ACTIVE,
|
||||
|
||||
// the titlebar text colours
|
||||
TITLEBAR_TEXT,
|
||||
TITLEBAR_ACTIVE_TEXT,
|
||||
|
||||
// the default gauge fill colour
|
||||
GAUGE,
|
||||
|
||||
// desktop background colour (only used by framebuffer ports)
|
||||
DESKTOP,
|
||||
|
||||
// wxFrame's background colour
|
||||
FRAME,
|
||||
|
||||
MAX
|
||||
};
|
||||
|
||||
// get a standard colour
|
||||
virtual wxColour Get(StdColour col) const = 0;
|
||||
|
||||
// get the background colour for the given window
|
||||
virtual wxColour GetBackground(wxWindow *win) const = 0;
|
||||
|
||||
// virtual dtor for any base class
|
||||
virtual ~wxColourScheme();
|
||||
};
|
||||
|
||||
// some people just can't spell it correctly :-)
|
||||
typedef wxColourScheme wxColorScheme;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// macros
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// retrieve the default colour from the theme or the given scheme
|
||||
#define wxSCHEME_COLOUR(scheme, what) scheme->Get(wxColorScheme::what)
|
||||
#define wxTHEME_COLOUR(what) \
|
||||
wxSCHEME_COLOUR(wxTheme::Get()->GetColourScheme(), what)
|
||||
|
||||
// get the background colour for the window in the current theme
|
||||
#define wxTHEME_BG_COLOUR(win) \
|
||||
wxTheme::Get()->GetColourScheme()->GetBackground(win)
|
||||
|
||||
#endif // _WX_UNIV_COLSCHEM_H_
|
167
wxWidgets/include/wx/univ/combobox.h
Normal file
167
wxWidgets/include/wx/univ/combobox.h
Normal file
|
@ -0,0 +1,167 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/combobox.h
|
||||
// Purpose: the universal combobox
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 30.08.00
|
||||
// RCS-ID: $Id: combobox.h 61872 2009-09-09 22:37:05Z VZ $
|
||||
// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef _WX_UNIV_COMBOBOX_H_
|
||||
#define _WX_UNIV_COMBOBOX_H_
|
||||
|
||||
#include "wx/combo.h"
|
||||
|
||||
class WXDLLEXPORT wxListBox;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// NB: some actions supported by this control are in wx/generic/combo.h
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// choose the next/prev/specified (by numArg) item
|
||||
#define wxACTION_COMBOBOX_SELECT_NEXT wxT("next")
|
||||
#define wxACTION_COMBOBOX_SELECT_PREV wxT("prev")
|
||||
#define wxACTION_COMBOBOX_SELECT wxT("select")
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxComboBox: a combination of text control and a listbox
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxComboBox : public wxComboCtrl, public wxComboBoxBase
|
||||
{
|
||||
public:
|
||||
// ctors and such
|
||||
wxComboBox() { Init(); }
|
||||
|
||||
wxComboBox(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& value = wxEmptyString,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
int n = 0,
|
||||
const wxString choices[] = (const wxString *) NULL,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxComboBoxNameStr)
|
||||
{
|
||||
Init();
|
||||
|
||||
(void)Create(parent, id, value, pos, size, n, choices,
|
||||
style, validator, name);
|
||||
}
|
||||
wxComboBox(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& value,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
const wxArrayString& choices,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxComboBoxNameStr);
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& value = wxEmptyString,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
int n = 0,
|
||||
const wxString choices[] = (const wxString *) NULL,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxComboBoxNameStr);
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& value,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
const wxArrayString& choices,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxComboBoxNameStr);
|
||||
|
||||
virtual ~wxComboBox();
|
||||
|
||||
// the wxUniversal-specific methods
|
||||
// --------------------------------
|
||||
|
||||
// implement the combobox interface
|
||||
|
||||
// wxTextCtrl methods
|
||||
virtual wxString GetValue() const;
|
||||
virtual void SetValue(const wxString& value);
|
||||
virtual void Copy();
|
||||
virtual void Cut();
|
||||
virtual void Paste();
|
||||
virtual void SetInsertionPoint(long pos);
|
||||
virtual void SetInsertionPointEnd();
|
||||
virtual long GetInsertionPoint() const;
|
||||
virtual wxTextPos GetLastPosition() const;
|
||||
virtual void Replace(long from, long to, const wxString& value);
|
||||
virtual void Remove(long from, long to);
|
||||
virtual void SetSelection(long from, long to);
|
||||
virtual void SetEditable(bool editable);
|
||||
virtual bool IsEditable() const;
|
||||
|
||||
virtual void Undo();
|
||||
virtual void Redo();
|
||||
virtual void SelectAll();
|
||||
|
||||
virtual bool CanCopy() const;
|
||||
virtual bool CanCut() const;
|
||||
virtual bool CanPaste() const;
|
||||
virtual bool CanUndo() const;
|
||||
virtual bool CanRedo() const;
|
||||
|
||||
// wxControlWithItems methods
|
||||
virtual void Clear();
|
||||
virtual void Delete(unsigned int n);
|
||||
virtual unsigned int GetCount() const;
|
||||
virtual wxString GetString(unsigned int n) const;
|
||||
virtual void SetString(unsigned int n, const wxString& s);
|
||||
virtual int FindString(const wxString& s, bool bCase = false) const;
|
||||
virtual void SetSelection(int n);
|
||||
virtual int GetSelection() const;
|
||||
|
||||
wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
|
||||
|
||||
// we have our own input handler and our own actions
|
||||
// (but wxComboCtrl already handled Popup/Dismiss)
|
||||
/*
|
||||
virtual bool PerformAction(const wxControlAction& action,
|
||||
long numArg = 0l,
|
||||
const wxString& strArg = wxEmptyString);
|
||||
*/
|
||||
|
||||
static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef);
|
||||
virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef)
|
||||
{
|
||||
return GetStdInputHandler(handlerDef);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual int DoAppend(const wxString& item);
|
||||
virtual int DoInsert(const wxString& item, unsigned int pos);
|
||||
virtual void DoSetItemClientData(unsigned int n, void* clientData);
|
||||
virtual void* DoGetItemClientData(unsigned int n) const;
|
||||
virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData);
|
||||
virtual wxClientData* DoGetItemClientObject(unsigned int n) const;
|
||||
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
// get the associated listbox
|
||||
wxListBox *GetLBox() const { return m_lbox; }
|
||||
|
||||
private:
|
||||
// the popup listbox
|
||||
wxListBox *m_lbox;
|
||||
|
||||
//DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxComboBox)
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_COMBOBOX_H_
|
102
wxWidgets/include/wx/univ/control.h
Normal file
102
wxWidgets/include/wx/univ/control.h
Normal file
|
@ -0,0 +1,102 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/control.h
|
||||
// Purpose: universal wxControl: adds handling of mnemonics
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 14.08.00
|
||||
// RCS-ID: $Id: control.h 61872 2009-09-09 22:37:05Z VZ $
|
||||
// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_CONTROL_H_
|
||||
#define _WX_UNIV_CONTROL_H_
|
||||
|
||||
class WXDLLEXPORT wxControlRenderer;
|
||||
class WXDLLEXPORT wxInputHandler;
|
||||
class WXDLLEXPORT wxRenderer;
|
||||
|
||||
// we must include it as most/all control classes derive their handlers from
|
||||
// it
|
||||
#include "wx/univ/inphand.h"
|
||||
|
||||
#include "wx/univ/inpcons.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxControlAction: the action is currently just a string which identifies it,
|
||||
// later it might become an atom (i.e. an opaque handler to string).
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
typedef wxString wxControlAction;
|
||||
|
||||
// the list of actions which apply to all controls (other actions are defined
|
||||
// in the controls headers)
|
||||
|
||||
#define wxACTION_NONE wxT("") // no action to perform
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxControl: the base class for all GUI controls
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxControl : public wxControlBase, public wxInputConsumer
|
||||
{
|
||||
public:
|
||||
wxControl() { Init(); }
|
||||
|
||||
wxControl(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxControlNameStr)
|
||||
{
|
||||
Init();
|
||||
|
||||
Create(parent, id, pos, size, style, validator, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxControlNameStr);
|
||||
|
||||
// this function will filter out '&' characters and will put the
|
||||
// accelerator char (the one immediately after '&') into m_chAccel
|
||||
virtual void SetLabel(const wxString &label);
|
||||
virtual wxString GetLabel() const;
|
||||
|
||||
// wxUniversal-specific methods
|
||||
|
||||
// return the accel index in the string or -1 if none and puts the modified
|
||||
// string intosecond parameter if non NULL
|
||||
static int FindAccelIndex(const wxString& label,
|
||||
wxString *labelOnly = NULL);
|
||||
|
||||
// return the index of the accel char in the label or -1 if none
|
||||
int GetAccelIndex() const { return m_indexAccel; }
|
||||
|
||||
// return the accel char itself or 0 if none
|
||||
wxChar GetAccelChar() const
|
||||
{
|
||||
return m_indexAccel == -1 ? wxT('\0') : m_label[m_indexAccel];
|
||||
}
|
||||
|
||||
virtual wxWindow *GetInputWindow() const { return (wxWindow*)this; }
|
||||
|
||||
protected:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
private:
|
||||
// label and accel info
|
||||
wxString m_label;
|
||||
int m_indexAccel;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxControl)
|
||||
DECLARE_EVENT_TABLE()
|
||||
WX_DECLARE_INPUT_CONSUMER()
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_CONTROL_H_
|
88
wxWidgets/include/wx/univ/dialog.h
Normal file
88
wxWidgets/include/wx/univ/dialog.h
Normal file
|
@ -0,0 +1,88 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: dialog.h
|
||||
// Purpose: wxDialog class
|
||||
// Author: Vaclav Slavik
|
||||
// Created: 2001/09/16
|
||||
// RCS-ID: $Id: dialog.h 36891 2006-01-16 14:59:55Z MR $
|
||||
// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_DIALOG_H_
|
||||
#define _WX_UNIV_DIALOG_H_
|
||||
|
||||
extern WXDLLEXPORT_DATA(const wxChar) wxDialogNameStr[];
|
||||
class WXDLLEXPORT wxWindowDisabler;
|
||||
class WXDLLEXPORT wxEventLoop;
|
||||
|
||||
// Dialog boxes
|
||||
class WXDLLEXPORT wxDialog : public wxDialogBase
|
||||
{
|
||||
public:
|
||||
wxDialog() { Init(); }
|
||||
|
||||
// Constructor with no modal flag - the new convention.
|
||||
wxDialog(wxWindow *parent, wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_DIALOG_STYLE,
|
||||
const wxString& name = wxDialogNameStr)
|
||||
{
|
||||
Init();
|
||||
Create(parent, id, title, pos, size, style, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_DIALOG_STYLE,
|
||||
const wxString& name = wxDialogNameStr);
|
||||
|
||||
virtual ~wxDialog();
|
||||
|
||||
// is the dialog in modal state right now?
|
||||
virtual bool IsModal() const;
|
||||
|
||||
// For now, same as Show(true) but returns return code
|
||||
virtual int ShowModal();
|
||||
|
||||
// may be called to terminate the dialog with the given return code
|
||||
virtual void EndModal(int retCode);
|
||||
|
||||
// returns true if we're in a modal loop
|
||||
bool IsModalShowing() const;
|
||||
|
||||
virtual bool Show(bool show = true);
|
||||
|
||||
// implementation only from now on
|
||||
// -------------------------------
|
||||
|
||||
// event handlers
|
||||
void OnCloseWindow(wxCloseEvent& event);
|
||||
void OnOK(wxCommandEvent& event);
|
||||
void OnApply(wxCommandEvent& event);
|
||||
void OnCancel(wxCommandEvent& event);
|
||||
|
||||
protected:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
private:
|
||||
// while we are showing a modal dialog we disable the other windows using
|
||||
// this object
|
||||
wxWindowDisabler *m_windowDisabler;
|
||||
|
||||
// modal dialog runs its own event loop
|
||||
wxEventLoop *m_eventLoop;
|
||||
|
||||
// is modal right now?
|
||||
bool m_isShowingModal;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxDialog)
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif
|
||||
// _WX_UNIV_DIALOG_H_
|
92
wxWidgets/include/wx/univ/frame.h
Normal file
92
wxWidgets/include/wx/univ/frame.h
Normal file
|
@ -0,0 +1,92 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/frame.h
|
||||
// Purpose: wxFrame class for wxUniversal
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 19.05.01
|
||||
// RCS-ID: $Id: frame.h 42664 2006-10-29 20:39:31Z VZ $
|
||||
// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_FRAME_H_
|
||||
#define _WX_UNIV_FRAME_H_
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxFrame
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxFrame : public wxFrameBase
|
||||
{
|
||||
public:
|
||||
wxFrame() {}
|
||||
wxFrame(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr)
|
||||
{
|
||||
Create(parent, id, title, pos, size, style, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr);
|
||||
|
||||
virtual wxPoint GetClientAreaOrigin() const;
|
||||
virtual bool Enable(bool enable = true);
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
virtual wxStatusBar* CreateStatusBar(int number = 1,
|
||||
long style = wxST_SIZEGRIP,
|
||||
wxWindowID id = 0,
|
||||
const wxString& name = wxStatusLineNameStr);
|
||||
#endif // wxUSE_STATUSBAR
|
||||
|
||||
#if wxUSE_TOOLBAR
|
||||
// create main toolbar bycalling OnCreateToolBar()
|
||||
virtual wxToolBar* CreateToolBar(long style = -1,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxString& name = wxToolBarNameStr);
|
||||
#endif // wxUSE_TOOLBAR
|
||||
|
||||
virtual wxSize GetMinSize() const;
|
||||
|
||||
// sends wxSizeEvent to itself (used after attaching xxxBar)
|
||||
virtual void SendSizeEvent();
|
||||
|
||||
protected:
|
||||
void OnSize(wxSizeEvent& event);
|
||||
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
||||
|
||||
virtual void DoGetClientSize(int *width, int *height) const;
|
||||
virtual void DoSetClientSize(int width, int height);
|
||||
|
||||
#if wxUSE_MENUS
|
||||
// override to update menu bar position when the frame size changes
|
||||
virtual void PositionMenuBar();
|
||||
virtual void DetachMenuBar();
|
||||
virtual void AttachMenuBar(wxMenuBar *menubar);
|
||||
#endif // wxUSE_MENUS
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
// override to update statusbar position when the frame size changes
|
||||
virtual void PositionStatusBar();
|
||||
#endif // wxUSE_MENUS
|
||||
|
||||
protected:
|
||||
#if wxUSE_TOOLBAR
|
||||
virtual void PositionToolBar();
|
||||
#endif // wxUSE_TOOLBAR
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxFrame)
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_FRAME_H_
|
75
wxWidgets/include/wx/univ/gauge.h
Normal file
75
wxWidgets/include/wx/univ/gauge.h
Normal file
|
@ -0,0 +1,75 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/gauge.h
|
||||
// Purpose: wxUniversal wxGauge declaration
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 20.02.01
|
||||
// RCS-ID: $Id: gauge.h 35698 2005-09-25 20:49:40Z MW $
|
||||
// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_GAUGE_H_
|
||||
#define _WX_UNIV_GAUGE_H_
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxGauge: a progress bar
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxGauge : public wxGaugeBase
|
||||
{
|
||||
public:
|
||||
wxGauge() { Init(); }
|
||||
|
||||
wxGauge(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
int range,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxGA_HORIZONTAL,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxGaugeNameStr)
|
||||
{
|
||||
Init();
|
||||
|
||||
(void)Create(parent, id, range, pos, size, style, validator, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
int range,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxGA_HORIZONTAL,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxGaugeNameStr);
|
||||
|
||||
// implement base class virtuals
|
||||
virtual void SetRange(int range);
|
||||
virtual void SetValue(int pos);
|
||||
|
||||
// wxUniv-specific methods
|
||||
|
||||
// is it a smooth progress bar or a discrete one?
|
||||
bool IsSmooth() const { return (GetWindowStyle() & wxGA_SMOOTH) != 0; }
|
||||
|
||||
// is it a vertica; progress bar or a horizontal one?
|
||||
bool IsVertical() const { return (GetWindowStyle() & wxGA_VERTICAL) != 0; }
|
||||
|
||||
protected:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
// return the def border for a progress bar
|
||||
virtual wxBorder GetDefaultBorder() const;
|
||||
|
||||
// return the default size
|
||||
virtual wxSize DoGetBestClientSize() const;
|
||||
|
||||
// draw the control
|
||||
virtual void DoDraw(wxControlRenderer *renderer);
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxGauge)
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_GAUGE_H_
|
153
wxWidgets/include/wx/univ/inpcons.h
Normal file
153
wxWidgets/include/wx/univ/inpcons.h
Normal file
|
@ -0,0 +1,153 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/inpcons.h
|
||||
// Purpose: wxInputConsumer: mix-in class for input handling
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 14.08.00
|
||||
// RCS-ID: $Id: inpcons.h 61872 2009-09-09 22:37:05Z VZ $
|
||||
// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_INPCONS_H_
|
||||
#define _WX_UNIV_INPCONS_H_
|
||||
|
||||
class WXDLLEXPORT wxInputHandler;
|
||||
class WXDLLEXPORT wxWindow;
|
||||
|
||||
#include "wx/object.h"
|
||||
#include "wx/event.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxControlAction: the action is currently just a string which identifies it,
|
||||
// later it might become an atom (i.e. an opaque handler to string).
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
typedef wxString wxControlAction;
|
||||
|
||||
// the list of actions which apply to all controls (other actions are defined
|
||||
// in the controls headers)
|
||||
|
||||
#define wxACTION_NONE wxT("") // no action to perform
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxInputConsumer: mix-in class for handling wxControlActions (used by
|
||||
// wxControl and wxTopLevelWindow).
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxInputConsumer
|
||||
{
|
||||
public:
|
||||
wxInputConsumer() { m_inputHandler = NULL; }
|
||||
virtual ~wxInputConsumer() { }
|
||||
|
||||
// get the input handler
|
||||
wxInputHandler *GetInputHandler() const { return m_inputHandler; }
|
||||
|
||||
// perform a control-dependent action: an action may have an optional
|
||||
// numeric and another (also optional) string argument whose interpretation
|
||||
// depends on the action
|
||||
//
|
||||
// NB: we might use ellipsis in PerformAction() declaration but this
|
||||
// wouldn't be more efficient than always passing 2 unused parameters
|
||||
// but would be more difficult. Another solution would be to have
|
||||
// several overloaded versions but this will expose the problem of
|
||||
// virtual function hiding we don't have here.
|
||||
virtual bool PerformAction(const wxControlAction& action,
|
||||
long numArg = -1l,
|
||||
const wxString& strArg = wxEmptyString);
|
||||
|
||||
// get the window to work with (usually the class wxInputConsumer was mixed into)
|
||||
virtual wxWindow *GetInputWindow() const = 0;
|
||||
|
||||
// this function must be implemented in any classes process input (i.e. not
|
||||
// static controls) to create the standard input handler for the concrete
|
||||
// class deriving from this mix-in
|
||||
//
|
||||
// the parameter is the default input handler which should receive all
|
||||
// unprocessed input (i.e. typically handlerDef is passed to
|
||||
// wxStdInputHandler ctor) or it may be NULL
|
||||
//
|
||||
// the returned pointer will not be deleted by caller so it must either
|
||||
// point to a static object or be deleted on program termination
|
||||
virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef);
|
||||
|
||||
|
||||
protected:
|
||||
// event handlers
|
||||
void OnMouse(wxMouseEvent& event);
|
||||
void OnKeyDown(wxKeyEvent& event);
|
||||
void OnKeyUp(wxKeyEvent& event);
|
||||
void OnFocus(wxFocusEvent& event);
|
||||
void OnActivate(wxActivateEvent& event);
|
||||
|
||||
// create input handler by name, fall back to GetStdInputHandler() if
|
||||
// the current theme doesn't define any specific handler of this type
|
||||
void CreateInputHandler(const wxString& inphandler);
|
||||
|
||||
private:
|
||||
// the input processor (we never delete it)
|
||||
wxInputHandler *m_inputHandler;
|
||||
};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// macros which must be used by the classes derived from wxInputConsumer mix-in
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// declare the methods to be forwarded
|
||||
#define WX_DECLARE_INPUT_CONSUMER() \
|
||||
private: \
|
||||
void OnMouse(wxMouseEvent& event); \
|
||||
void OnKeyDown(wxKeyEvent& event); \
|
||||
void OnKeyUp(wxKeyEvent& event); \
|
||||
void OnFocus(wxFocusEvent& event); \
|
||||
public: /* because of docview :-( */ \
|
||||
void OnActivate(wxActivateEvent& event); \
|
||||
private:
|
||||
|
||||
// implement the event table entries for wxControlContainer
|
||||
#define WX_EVENT_TABLE_INPUT_CONSUMER(classname) \
|
||||
EVT_KEY_DOWN(classname::OnKeyDown) \
|
||||
EVT_KEY_UP(classname::OnKeyUp) \
|
||||
EVT_MOUSE_EVENTS(classname::OnMouse) \
|
||||
EVT_SET_FOCUS(classname::OnFocus) \
|
||||
EVT_KILL_FOCUS(classname::OnFocus) \
|
||||
EVT_ACTIVATE(classname::OnActivate)
|
||||
|
||||
// Forward event handlers to wxInputConsumer
|
||||
//
|
||||
// (We can't use them directly, because wxIC has virtual methods, which forces
|
||||
// the compiler to include (at least) two vtables into wxControl, one for the
|
||||
// wxWindow-wxControlBase-wxControl branch and one for the wxIC mix-in.
|
||||
// Consequently, the "this" pointer has different value when in wxControl's
|
||||
// and wxIC's method, even though the instance stays same. This doesn't matter
|
||||
// so far as member pointers aren't used, but that's not wxControl's case.
|
||||
// When we add an event table entry (= use a member pointer) pointing to
|
||||
// wxIC's OnXXX method, GCC compiles code that executes wxIC::OnXXX with the
|
||||
// version of "this" that belongs to wxControl, not wxIC! In our particular
|
||||
// case, the effect is that m_handler is NULL (probably same memory
|
||||
// area as the_other_vtable's_this->m_refObj) and input handling doesn't work.)
|
||||
#define WX_FORWARD_TO_INPUT_CONSUMER(classname) \
|
||||
void classname::OnMouse(wxMouseEvent& event) \
|
||||
{ \
|
||||
wxInputConsumer::OnMouse(event); \
|
||||
} \
|
||||
void classname::OnKeyDown(wxKeyEvent& event) \
|
||||
{ \
|
||||
wxInputConsumer::OnKeyDown(event); \
|
||||
} \
|
||||
void classname::OnKeyUp(wxKeyEvent& event) \
|
||||
{ \
|
||||
wxInputConsumer::OnKeyUp(event); \
|
||||
} \
|
||||
void classname::OnFocus(wxFocusEvent& event) \
|
||||
{ \
|
||||
wxInputConsumer::OnFocus(event); \
|
||||
} \
|
||||
void classname::OnActivate(wxActivateEvent& event) \
|
||||
{ \
|
||||
wxInputConsumer::OnActivate(event); \
|
||||
}
|
||||
|
||||
#endif // _WX_UNIV_INPCONS_H_
|
116
wxWidgets/include/wx/univ/inphand.h
Normal file
116
wxWidgets/include/wx/univ/inphand.h
Normal file
|
@ -0,0 +1,116 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/inphand.h
|
||||
// Purpose: wxInputHandler class maps the keyboard and mouse events to the
|
||||
// actions which then are performed by the control
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 18.08.00
|
||||
// RCS-ID: $Id: inphand.h 61872 2009-09-09 22:37:05Z VZ $
|
||||
// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_INPHAND_H_
|
||||
#define _WX_UNIV_INPHAND_H_
|
||||
|
||||
#include "wx/univ/inpcons.h" // for wxControlAction(s)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// types of the standard input handlers which can be passed to
|
||||
// wxTheme::GetInputHandler()
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#define wxINP_HANDLER_DEFAULT wxT("")
|
||||
#define wxINP_HANDLER_BUTTON wxT("button")
|
||||
#define wxINP_HANDLER_CHECKBOX wxT("checkbox")
|
||||
#define wxINP_HANDLER_CHECKLISTBOX wxT("checklistbox")
|
||||
#define wxINP_HANDLER_COMBOBOX wxT("combobox")
|
||||
#define wxINP_HANDLER_LISTBOX wxT("listbox")
|
||||
#define wxINP_HANDLER_NOTEBOOK wxT("notebook")
|
||||
#define wxINP_HANDLER_RADIOBTN wxT("radiobtn")
|
||||
#define wxINP_HANDLER_SCROLLBAR wxT("scrollbar")
|
||||
#define wxINP_HANDLER_SLIDER wxT("slider")
|
||||
#define wxINP_HANDLER_SPINBTN wxT("spinbtn")
|
||||
#define wxINP_HANDLER_STATUSBAR wxT("statusbar")
|
||||
#define wxINP_HANDLER_TEXTCTRL wxT("textctrl")
|
||||
#define wxINP_HANDLER_TOOLBAR wxT("toolbar")
|
||||
#define wxINP_HANDLER_TOPLEVEL wxT("toplevel")
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxInputHandler: maps the events to the actions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxInputHandler : public wxObject
|
||||
{
|
||||
public:
|
||||
// map a keyboard event to one or more actions (pressed == true if the key
|
||||
// was pressed, false if released), returns true if something was done
|
||||
virtual bool HandleKey(wxInputConsumer *consumer,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed) = 0;
|
||||
|
||||
// map a mouse (click) event to one or more actions
|
||||
virtual bool HandleMouse(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event) = 0;
|
||||
|
||||
// handle mouse movement (or enter/leave) event: it is separated from
|
||||
// HandleMouse() for convenience as many controls don't care about mouse
|
||||
// movements at all
|
||||
virtual bool HandleMouseMove(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event);
|
||||
|
||||
// do something with focus set/kill event: this is different from
|
||||
// HandleMouseMove() as the mouse maybe over the control without it having
|
||||
// focus
|
||||
//
|
||||
// return true to refresh the control, false otherwise
|
||||
virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event);
|
||||
|
||||
// react to the app getting/losing activation
|
||||
//
|
||||
// return true to refresh the control, false otherwise
|
||||
virtual bool HandleActivation(wxInputConsumer *consumer, bool activated);
|
||||
|
||||
// virtual dtor for any base class
|
||||
virtual ~wxInputHandler();
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxStdInputHandler is just a base class for all other "standard" handlers
|
||||
// and also provides the way to chain input handlers together
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxStdInputHandler : public wxInputHandler
|
||||
{
|
||||
public:
|
||||
wxStdInputHandler(wxInputHandler *handler) : m_handler(handler) { }
|
||||
|
||||
virtual bool HandleKey(wxInputConsumer *consumer,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed)
|
||||
{
|
||||
return m_handler ? m_handler->HandleKey(consumer, event, pressed)
|
||||
: false;
|
||||
}
|
||||
|
||||
virtual bool HandleMouse(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event)
|
||||
{
|
||||
return m_handler ? m_handler->HandleMouse(consumer, event) : false;
|
||||
}
|
||||
|
||||
virtual bool HandleMouseMove(wxInputConsumer *consumer, const wxMouseEvent& event)
|
||||
{
|
||||
return m_handler ? m_handler->HandleMouseMove(consumer, event) : false;
|
||||
}
|
||||
|
||||
virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event)
|
||||
{
|
||||
return m_handler ? m_handler->HandleFocus(consumer, event) : false;
|
||||
}
|
||||
|
||||
private:
|
||||
wxInputHandler *m_handler;
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_INPHAND_H_
|
300
wxWidgets/include/wx/univ/listbox.h
Normal file
300
wxWidgets/include/wx/univ/listbox.h
Normal file
|
@ -0,0 +1,300 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/listbox.h
|
||||
// Purpose: the universal listbox
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 30.08.00
|
||||
// RCS-ID: $Id: listbox.h 61872 2009-09-09 22:37:05Z VZ $
|
||||
// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_LISTBOX_H_
|
||||
#define _WX_UNIV_LISTBOX_H_
|
||||
|
||||
#include "wx/scrolwin.h" // for wxScrollHelper
|
||||
#include "wx/dynarray.h"
|
||||
#include "wx/arrstr.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// the actions supported by this control
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// change the current item
|
||||
#define wxACTION_LISTBOX_SETFOCUS wxT("setfocus") // select the item
|
||||
#define wxACTION_LISTBOX_MOVEDOWN wxT("down") // select item below
|
||||
#define wxACTION_LISTBOX_MOVEUP wxT("up") // select item above
|
||||
#define wxACTION_LISTBOX_PAGEDOWN wxT("pagedown") // go page down
|
||||
#define wxACTION_LISTBOX_PAGEUP wxT("pageup") // go page up
|
||||
#define wxACTION_LISTBOX_START wxT("start") // go to first item
|
||||
#define wxACTION_LISTBOX_END wxT("end") // go to last item
|
||||
#define wxACTION_LISTBOX_FIND wxT("find") // find item by 1st letter
|
||||
|
||||
// do something with the current item
|
||||
#define wxACTION_LISTBOX_ACTIVATE wxT("activate") // activate (choose)
|
||||
#define wxACTION_LISTBOX_TOGGLE wxT("toggle") // togglee selected state
|
||||
#define wxACTION_LISTBOX_SELECT wxT("select") // sel this, unsel others
|
||||
#define wxACTION_LISTBOX_SELECTADD wxT("selectadd") // add to selection
|
||||
#define wxACTION_LISTBOX_UNSELECT wxT("unselect") // unselect
|
||||
#define wxACTION_LISTBOX_ANCHOR wxT("selanchor") // anchor selection
|
||||
|
||||
// do something with the selection globally (not for single selection ones)
|
||||
#define wxACTION_LISTBOX_SELECTALL wxT("selectall") // select all items
|
||||
#define wxACTION_LISTBOX_UNSELECTALL wxT("unselectall") // unselect all items
|
||||
#define wxACTION_LISTBOX_SELTOGGLE wxT("togglesel") // invert the selection
|
||||
#define wxACTION_LISTBOX_EXTENDSEL wxT("extend") // extend to item
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxListBox: a list of selectable items
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxListBox : public wxListBoxBase, public wxScrollHelper
|
||||
{
|
||||
public:
|
||||
// ctors and such
|
||||
wxListBox() : wxScrollHelper(this) { Init(); }
|
||||
wxListBox(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
int n = 0, const wxString choices[] = (const wxString *) NULL,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxListBoxNameStr )
|
||||
: wxScrollHelper(this)
|
||||
{
|
||||
Init();
|
||||
|
||||
Create(parent, id, pos, size, n, choices, style, validator, name);
|
||||
}
|
||||
wxListBox(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
const wxArrayString& choices,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxListBoxNameStr );
|
||||
|
||||
virtual ~wxListBox();
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
int n = 0, const wxString choices[] = (const wxString *) NULL,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxListBoxNameStr);
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
const wxArrayString& choices,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxListBoxNameStr);
|
||||
|
||||
// implement the listbox interface defined by wxListBoxBase
|
||||
virtual void Clear();
|
||||
virtual void Delete(unsigned int n);
|
||||
|
||||
virtual unsigned int GetCount() const
|
||||
{ return (unsigned int)m_strings->GetCount(); }
|
||||
virtual wxString GetString(unsigned int n) const
|
||||
{ return m_strings->Item(n); }
|
||||
virtual void SetString(unsigned int n, const wxString& s);
|
||||
virtual int FindString(const wxString& s, bool bCase = false) const
|
||||
{ return m_strings->Index(s, bCase); }
|
||||
|
||||
virtual bool IsSelected(int n) const
|
||||
{ return m_selections.Index(n) != wxNOT_FOUND; }
|
||||
virtual int GetSelection() const;
|
||||
virtual int GetSelections(wxArrayInt& aSelections) const;
|
||||
|
||||
protected:
|
||||
virtual void DoSetSelection(int n, bool select);
|
||||
virtual int DoAppendOnly(const wxString& item);
|
||||
virtual int DoAppend(const wxString& item);
|
||||
virtual void DoInsertItems(const wxArrayString& items, unsigned int pos);
|
||||
virtual void DoSetItems(const wxArrayString& items, void **clientData);
|
||||
|
||||
virtual void DoSetFirstItem(int n);
|
||||
|
||||
virtual void DoSetItemClientData(unsigned int n, void* clientData);
|
||||
virtual void* DoGetItemClientData(unsigned int n) const;
|
||||
virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData);
|
||||
virtual wxClientData* DoGetItemClientObject(unsigned int n) const;
|
||||
|
||||
public:
|
||||
// override some more base class methods
|
||||
virtual bool SetFont(const wxFont& font);
|
||||
|
||||
// the wxUniversal-specific methods
|
||||
// --------------------------------
|
||||
|
||||
// the current item is the same as the selected one for wxLB_SINGLE
|
||||
// listboxes but for the other ones it is just the focused item which may
|
||||
// be selected or not
|
||||
int GetCurrentItem() const { return m_current; }
|
||||
void SetCurrentItem(int n);
|
||||
|
||||
// select the item which is diff items below the current one
|
||||
void ChangeCurrent(int diff);
|
||||
|
||||
// activate (i.e. send a LISTBOX_DOUBLECLICKED message) the specified or
|
||||
// current (if -1) item
|
||||
void Activate(int item = -1);
|
||||
|
||||
// select or unselect the specified or current (if -1) item
|
||||
void DoSelect(int item = -1, bool sel = true);
|
||||
|
||||
// more readable wrapper
|
||||
void DoUnselect(int item) { DoSelect(item, false); }
|
||||
|
||||
// select an item and send a notification about it
|
||||
void SelectAndNotify(int item);
|
||||
|
||||
// ensure that the given item is visible by scrolling it into view
|
||||
virtual void EnsureVisible(int n);
|
||||
|
||||
// find the first item [strictly] after the current one which starts with
|
||||
// the given string and make it the current one, return true if the current
|
||||
// item changed
|
||||
bool FindItem(const wxString& prefix, bool strictlyAfter = false);
|
||||
bool FindNextItem(const wxString& prefix) { return FindItem(prefix, true); }
|
||||
|
||||
// extend the selection to span the range from the anchor (see below) to
|
||||
// the specified or current item
|
||||
void ExtendSelection(int itemTo = -1);
|
||||
|
||||
// make this item the new selection anchor: extending selection with
|
||||
// ExtendSelection() will work with it
|
||||
void AnchorSelection(int itemFrom) { m_selAnchor = itemFrom; }
|
||||
|
||||
// get, calculating it if necessary, the number of items per page, the
|
||||
// height of each line and the max width of an item
|
||||
int GetItemsPerPage() const;
|
||||
wxCoord GetLineHeight() const;
|
||||
wxCoord GetMaxWidth() const;
|
||||
|
||||
// override the wxControl virtual methods
|
||||
virtual bool PerformAction(const wxControlAction& action,
|
||||
long numArg = 0l,
|
||||
const wxString& strArg = wxEmptyString);
|
||||
|
||||
static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef);
|
||||
virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef)
|
||||
{
|
||||
return GetStdInputHandler(handlerDef);
|
||||
}
|
||||
|
||||
// idle processing
|
||||
virtual void OnInternalIdle();
|
||||
|
||||
protected:
|
||||
// geometry
|
||||
virtual wxSize DoGetBestClientSize() const;
|
||||
virtual void DoSetSize(int x, int y,
|
||||
int width, int height,
|
||||
int sizeFlags = wxSIZE_AUTO);
|
||||
|
||||
virtual void DoDraw(wxControlRenderer *renderer);
|
||||
virtual wxBorder GetDefaultBorder() const;
|
||||
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
// event handlers
|
||||
void OnSize(wxSizeEvent& event);
|
||||
|
||||
// common part of Clear() and DoSetItems(): clears everything
|
||||
virtual void DoClear();
|
||||
|
||||
// refresh the given item(s) or everything
|
||||
void RefreshItems(int from, int count);
|
||||
void RefreshItem(int n);
|
||||
void RefreshFromItemToEnd(int n);
|
||||
void RefreshAll();
|
||||
|
||||
// send an event of the given type (using m_current by default)
|
||||
bool SendEvent(wxEventType type, int item = -1);
|
||||
|
||||
// calculate the number of items per page using our current size
|
||||
void CalcItemsPerPage();
|
||||
|
||||
// can/should we have a horz scrollbar?
|
||||
bool HasHorzScrollbar() const
|
||||
{ return (m_windowStyle & wxLB_HSCROLL) != 0; }
|
||||
|
||||
// redraw the items in the given range only: called from DoDraw()
|
||||
virtual void DoDrawRange(wxControlRenderer *renderer,
|
||||
int itemFirst, int itemLast);
|
||||
|
||||
// update the scrollbars and then ensure that the item is visible
|
||||
void DoEnsureVisible(int n);
|
||||
|
||||
// mark horz scrollbar for updating
|
||||
void RefreshHorzScrollbar();
|
||||
|
||||
// update (show/hide/adjust) the scrollbars
|
||||
void UpdateScrollbars();
|
||||
|
||||
// refresh the items specified by m_updateCount and m_updateFrom
|
||||
void UpdateItems();
|
||||
|
||||
// the array containing all items (it is sorted if the listbox has
|
||||
// wxLB_SORT style)
|
||||
wxArrayString* m_strings;
|
||||
|
||||
// this array contains the indices of the selected items (for the single
|
||||
// selection listboxes only the first element of it is used and contains
|
||||
// the current selection)
|
||||
wxArrayInt m_selections;
|
||||
|
||||
// and this one the client data (either void or wxClientData)
|
||||
wxArrayPtrVoid m_itemsClientData;
|
||||
|
||||
// the current item
|
||||
int m_current;
|
||||
|
||||
private:
|
||||
// the range of elements which must be updated: if m_updateCount is 0 no
|
||||
// update is needed, if it is -1 everything must be updated, otherwise
|
||||
// m_updateCount items starting from m_updateFrom have to be redrawn
|
||||
int m_updateFrom,
|
||||
m_updateCount;
|
||||
|
||||
// the height of one line in the listbox (all lines have the same height)
|
||||
wxCoord m_lineHeight;
|
||||
|
||||
// the maximal width of a listbox item and the item which has it
|
||||
wxCoord m_maxWidth;
|
||||
int m_maxWidthItem;
|
||||
|
||||
// the extents of horz and vert scrollbars
|
||||
int m_scrollRangeX,
|
||||
m_scrollRangeY;
|
||||
|
||||
// the number of items per page
|
||||
size_t m_itemsPerPage;
|
||||
|
||||
// if the number of items has changed we may need to show/hide the
|
||||
// scrollbar
|
||||
bool m_updateScrollbarX, m_updateScrollbarY,
|
||||
m_showScrollbarX, m_showScrollbarY;
|
||||
|
||||
// if the current item has changed, we might need to scroll if it went out
|
||||
// of the window
|
||||
bool m_currentChanged;
|
||||
|
||||
// the anchor from which the selection is extended for the listboxes with
|
||||
// wxLB_EXTENDED style - this is set to the last item which was selected
|
||||
// by not extending the selection but by choosing it directly
|
||||
int m_selAnchor;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxListBox)
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_LISTBOX_H_
|
282
wxWidgets/include/wx/univ/menu.h
Normal file
282
wxWidgets/include/wx/univ/menu.h
Normal file
|
@ -0,0 +1,282 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/menu.h
|
||||
// Purpose: wxMenu and wxMenuBar classes for wxUniversal
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 05.05.01
|
||||
// RCS-ID: $Id: menu.h 48053 2007-08-13 17:07:01Z JS $
|
||||
// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_MENU_H_
|
||||
#define _WX_UNIV_MENU_H_
|
||||
|
||||
#if wxUSE_ACCEL
|
||||
#include "wx/accel.h"
|
||||
#endif // wxUSE_ACCEL
|
||||
|
||||
#include "wx/dynarray.h"
|
||||
|
||||
// fwd declarations
|
||||
class WXDLLEXPORT wxMenuInfo;
|
||||
WX_DECLARE_EXPORTED_OBJARRAY(wxMenuInfo, wxMenuInfoArray);
|
||||
|
||||
class WXDLLEXPORT wxMenuGeometryInfo;
|
||||
class WXDLLEXPORT wxPopupMenuWindow;
|
||||
class WXDLLEXPORT wxRenderer;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxMenu
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxMenu : public wxMenuBase
|
||||
{
|
||||
public:
|
||||
// ctors and dtor
|
||||
wxMenu(const wxString& title, long style = 0)
|
||||
: wxMenuBase(title, style) { Init(); }
|
||||
|
||||
wxMenu(long style = 0) : wxMenuBase(style) { Init(); }
|
||||
|
||||
virtual ~wxMenu();
|
||||
|
||||
// called by wxMenuItem when an item of this menu changes
|
||||
void RefreshItem(wxMenuItem *item);
|
||||
|
||||
// does the menu have any items?
|
||||
bool IsEmpty() const { return !GetMenuItems().GetFirst(); }
|
||||
|
||||
// show this menu at the given position (in screen coords) and optionally
|
||||
// select its first item
|
||||
void Popup(const wxPoint& pos, const wxSize& size,
|
||||
bool selectFirst = true);
|
||||
|
||||
// dismiss the menu
|
||||
void Dismiss();
|
||||
|
||||
// override the base class methods to connect/disconnect event handlers
|
||||
virtual void Attach(wxMenuBarBase *menubar);
|
||||
virtual void Detach();
|
||||
|
||||
// implementation only from here
|
||||
|
||||
// do as if this item were clicked, return true if the resulting event was
|
||||
// processed, false otherwise
|
||||
bool ClickItem(wxMenuItem *item);
|
||||
|
||||
// process the key event, return true if done
|
||||
bool ProcessKeyDown(int key);
|
||||
|
||||
#if wxUSE_ACCEL
|
||||
// find the item for the given accel and generate an event if found
|
||||
bool ProcessAccelEvent(const wxKeyEvent& event);
|
||||
#endif // wxUSE_ACCEL
|
||||
|
||||
protected:
|
||||
// implement base class virtuals
|
||||
virtual wxMenuItem* DoAppend(wxMenuItem *item);
|
||||
virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item);
|
||||
virtual wxMenuItem* DoRemove(wxMenuItem *item);
|
||||
|
||||
// common part of DoAppend and DoInsert
|
||||
void OnItemAdded(wxMenuItem *item);
|
||||
|
||||
// called by wxPopupMenuWindow when the window is hidden
|
||||
void OnDismiss(bool dismissParent);
|
||||
|
||||
// return true if the menu is currently shown on screen
|
||||
bool IsShown() const;
|
||||
|
||||
// get the menu geometry info
|
||||
const wxMenuGeometryInfo& GetGeometryInfo() const;
|
||||
|
||||
// forget old menu geometry info
|
||||
void InvalidateGeometryInfo();
|
||||
|
||||
// return either the menubar or the invoking window, normally never NULL
|
||||
wxWindow *GetRootWindow() const;
|
||||
|
||||
// get the renderer we use for drawing: either the one of the menu bar or
|
||||
// the one of the window if we're a popup menu
|
||||
wxRenderer *GetRenderer() const;
|
||||
|
||||
#if wxUSE_ACCEL
|
||||
// add/remove accel for the given menu item
|
||||
void AddAccelFor(wxMenuItem *item);
|
||||
void RemoveAccelFor(wxMenuItem *item);
|
||||
#endif // wxUSE_ACCEL
|
||||
|
||||
private:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
// terminate the current radio group, if any
|
||||
void EndRadioGroup();
|
||||
|
||||
// the exact menu geometry is defined by a struct derived from this one
|
||||
// which is opaque and defined by the renderer
|
||||
wxMenuGeometryInfo *m_geometry;
|
||||
|
||||
// the menu shown on screen or NULL if not currently shown
|
||||
wxPopupMenuWindow *m_popupMenu;
|
||||
|
||||
#if wxUSE_ACCEL
|
||||
// the accel table for this menu
|
||||
wxAcceleratorTable m_accelTable;
|
||||
#endif // wxUSE_ACCEL
|
||||
|
||||
// the position of the first item in the current radio group or -1
|
||||
int m_startRadioGroup;
|
||||
|
||||
// it calls out OnDismiss()
|
||||
friend class wxPopupMenuWindow;
|
||||
DECLARE_DYNAMIC_CLASS(wxMenu)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxMenuBar
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxMenuBar : public wxMenuBarBase
|
||||
{
|
||||
public:
|
||||
// ctors and dtor
|
||||
wxMenuBar(long WXUNUSED(style) = 0) { Init(); }
|
||||
wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long style = 0);
|
||||
virtual ~wxMenuBar();
|
||||
|
||||
// implement base class virtuals
|
||||
virtual bool Append( wxMenu *menu, const wxString &title );
|
||||
virtual bool Insert(size_t pos, wxMenu *menu, const wxString& title);
|
||||
virtual wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title);
|
||||
virtual wxMenu *Remove(size_t pos);
|
||||
|
||||
virtual void EnableTop(size_t pos, bool enable);
|
||||
virtual bool IsEnabledTop(size_t pos) const;
|
||||
|
||||
virtual void SetLabelTop(size_t pos, const wxString& label);
|
||||
virtual wxString GetLabelTop(size_t pos) const;
|
||||
|
||||
virtual void Attach(wxFrame *frame);
|
||||
virtual void Detach();
|
||||
|
||||
// get the next item for the givan accel letter (used by wxFrame), return
|
||||
// -1 if none
|
||||
//
|
||||
// if unique is not NULL, filled with true if there is only one item with
|
||||
// this accel, false if two or more
|
||||
int FindNextItemForAccel(int idxStart,
|
||||
int keycode,
|
||||
bool *unique = NULL) const;
|
||||
|
||||
// called by wxFrame to set focus to or open the given menu
|
||||
void SelectMenu(size_t pos);
|
||||
void PopupMenu(size_t pos);
|
||||
|
||||
#if wxUSE_ACCEL
|
||||
// find the item for the given accel and generate an event if found
|
||||
bool ProcessAccelEvent(const wxKeyEvent& event);
|
||||
#endif // wxUSE_ACCEL
|
||||
|
||||
// called by wxMenu when it is dismissed
|
||||
void OnDismissMenu(bool dismissMenuBar = false);
|
||||
|
||||
protected:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
// event handlers
|
||||
void OnLeftDown(wxMouseEvent& event);
|
||||
void OnMouseMove(wxMouseEvent& event);
|
||||
void OnKeyDown(wxKeyEvent& event);
|
||||
void OnKillFocus(wxFocusEvent& event);
|
||||
|
||||
// process the mouse move event, return true if we did, false to continue
|
||||
// processing as usual
|
||||
//
|
||||
// the coordinates are client coordinates of menubar, convert if necessary
|
||||
bool ProcessMouseEvent(const wxPoint& pt);
|
||||
|
||||
// called when the menu bar loses mouse capture - it is not hidden unlike
|
||||
// menus, but it doesn't have modal status any longer
|
||||
void OnDismiss();
|
||||
|
||||
// draw the menubar
|
||||
virtual void DoDraw(wxControlRenderer *renderer);
|
||||
|
||||
// menubar geometry
|
||||
virtual wxSize DoGetBestClientSize() const;
|
||||
|
||||
// has the menubar been created already?
|
||||
bool IsCreated() const { return m_frameLast != NULL; }
|
||||
|
||||
// "fast" version of GetMenuCount()
|
||||
size_t GetCount() const { return m_menuInfos.GetCount(); }
|
||||
|
||||
// get the (total) width of the specified menu
|
||||
wxCoord GetItemWidth(size_t pos) const;
|
||||
|
||||
// get the rect of the item
|
||||
wxRect GetItemRect(size_t pos) const;
|
||||
|
||||
// get the menu from the given point or -1 if none
|
||||
int GetMenuFromPoint(const wxPoint& pos) const;
|
||||
|
||||
// refresh the given item
|
||||
void RefreshItem(size_t pos);
|
||||
|
||||
// refresh all items after this one (including it)
|
||||
void RefreshAllItemsAfter(size_t pos);
|
||||
|
||||
// hide the currently shown menu and show this one
|
||||
void DoSelectMenu(size_t pos);
|
||||
|
||||
// popup the currently selected menu
|
||||
void PopupCurrentMenu(bool selectFirst = true);
|
||||
|
||||
// hide the currently selected menu
|
||||
void DismissMenu();
|
||||
|
||||
// do we show a menu currently?
|
||||
bool IsShowingMenu() const { return m_menuShown != 0; }
|
||||
|
||||
// we don't want to have focus except while selecting from menu
|
||||
void GiveAwayFocus();
|
||||
|
||||
// Release the mouse capture if we have it
|
||||
bool ReleaseMouseCapture();
|
||||
|
||||
// the array containing extra menu info we need
|
||||
wxMenuInfoArray m_menuInfos;
|
||||
|
||||
// the current item (only used when menubar has focus)
|
||||
int m_current;
|
||||
|
||||
private:
|
||||
// the last frame to which we were attached, NULL initially
|
||||
wxFrame *m_frameLast;
|
||||
|
||||
// the currently shown menu or NULL
|
||||
wxMenu *m_menuShown;
|
||||
|
||||
// should be showing the menu? this is subtly different from m_menuShown !=
|
||||
// NULL as the menu which should be shown may be disabled in which case we
|
||||
// don't show it - but will do as soon as the focus shifts to another menu
|
||||
bool m_shouldShowMenu;
|
||||
|
||||
// it calls out ProcessMouseEvent()
|
||||
friend class wxPopupMenuWindow;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxMenuBar)
|
||||
|
||||
public:
|
||||
|
||||
#if wxABI_VERSION >= 20805
|
||||
// Gets the original label at the top-level of the menubar
|
||||
wxString GetMenuLabel(size_t pos) const;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_MENU_H_
|
135
wxWidgets/include/wx/univ/menuitem.h
Normal file
135
wxWidgets/include/wx/univ/menuitem.h
Normal file
|
@ -0,0 +1,135 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/menuitem.h
|
||||
// Purpose: wxMenuItem class for wxUniversal
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 05.05.01
|
||||
// RCS-ID: $Id: menuitem.h 61872 2009-09-09 22:37:05Z VZ $
|
||||
// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_MENUITEM_H_
|
||||
#define _WX_UNIV_MENUITEM_H_
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxMenuItem implements wxMenuItemBase
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxMenuItem : public wxMenuItemBase
|
||||
{
|
||||
public:
|
||||
// ctor & dtor
|
||||
wxMenuItem(wxMenu *parentMenu = (wxMenu *)NULL,
|
||||
int id = wxID_SEPARATOR,
|
||||
const wxString& name = wxEmptyString,
|
||||
const wxString& help = wxEmptyString,
|
||||
wxItemKind kind = wxITEM_NORMAL,
|
||||
wxMenu *subMenu = (wxMenu *)NULL);
|
||||
virtual ~wxMenuItem();
|
||||
|
||||
// override base class virtuals to update the item appearance on screen
|
||||
virtual void SetText(const wxString& text);
|
||||
virtual void SetCheckable(bool checkable);
|
||||
|
||||
virtual void Enable(bool enable = true);
|
||||
virtual void Check(bool check = true);
|
||||
|
||||
// we add some extra functions which are also available under MSW from
|
||||
// wxOwnerDrawn class - they will be moved to wxMenuItemBase later
|
||||
// hopefully
|
||||
void SetBitmaps(const wxBitmap& bmpChecked,
|
||||
const wxBitmap& bmpUnchecked = wxNullBitmap);
|
||||
void SetBitmap(const wxBitmap& bmp) { SetBitmaps(bmp); }
|
||||
const wxBitmap& GetBitmap(bool checked = true) const
|
||||
{ return checked ? m_bmpChecked : m_bmpUnchecked; }
|
||||
|
||||
void SetDisabledBitmap( const wxBitmap& bmpDisabled )
|
||||
{ m_bmpDisabled = bmpDisabled; }
|
||||
const wxBitmap& GetDisabledBitmap() const
|
||||
{ return m_bmpDisabled; }
|
||||
|
||||
// mark item as belonging to the given radio group
|
||||
void SetAsRadioGroupStart();
|
||||
void SetRadioGroupStart(int start);
|
||||
void SetRadioGroupEnd(int end);
|
||||
|
||||
// wxUniv-specific methods for implementation only starting from here
|
||||
|
||||
// get the accel index of our label or -1 if none
|
||||
int GetAccelIndex() const { return m_indexAccel; }
|
||||
|
||||
// get the accel string (displayed to the right of the label)
|
||||
const wxString& GetAccelString() const { return m_strAccel; }
|
||||
|
||||
// set/get the y coord and the height of this item: note that it must be
|
||||
// set first and retrieved later, the item doesn't calculate it itself
|
||||
void SetGeometry(wxCoord y, wxCoord height)
|
||||
{
|
||||
m_posY = y;
|
||||
m_height = height;
|
||||
}
|
||||
|
||||
wxCoord GetPosition() const
|
||||
{
|
||||
wxASSERT_MSG( m_posY != wxDefaultCoord, wxT("must call SetHeight first!") );
|
||||
|
||||
return m_posY;
|
||||
}
|
||||
|
||||
wxCoord GetHeight() const
|
||||
{
|
||||
wxASSERT_MSG( m_height != wxDefaultCoord, wxT("must call SetHeight first!") );
|
||||
|
||||
return m_height;
|
||||
}
|
||||
|
||||
protected:
|
||||
// notify the menu about the change in this item
|
||||
inline void NotifyMenu();
|
||||
|
||||
// set the accel index and string from text
|
||||
void UpdateAccelInfo();
|
||||
|
||||
// the bitmaps (may be invalid, then they're not used)
|
||||
wxBitmap m_bmpChecked,
|
||||
m_bmpUnchecked,
|
||||
m_bmpDisabled;
|
||||
|
||||
// the positions of the first and last items of the radio group this item
|
||||
// belongs to or -1: start is the radio group start and is valid for all
|
||||
// but first radio group items (m_isRadioGroupStart == false), end is valid
|
||||
// only for the first one
|
||||
union
|
||||
{
|
||||
int start;
|
||||
int end;
|
||||
} m_radioGroup;
|
||||
|
||||
// does this item start a radio group?
|
||||
bool m_isRadioGroupStart;
|
||||
|
||||
// the position of the accelerator in our label, -1 if none
|
||||
int m_indexAccel;
|
||||
|
||||
// the accel string (i.e. "Ctrl-Q" or "Alt-F1")
|
||||
wxString m_strAccel;
|
||||
|
||||
// the position and height of the displayed item
|
||||
wxCoord m_posY,
|
||||
m_height;
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxMenuItem)
|
||||
|
||||
public:
|
||||
|
||||
#if wxABI_VERSION >= 20805
|
||||
// return the item label including any mnemonics and accelerators.
|
||||
// This used to be called GetText.
|
||||
wxString GetItemLabel() const { return GetText(); }
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_MENUITEM_H_
|
||||
|
257
wxWidgets/include/wx/univ/notebook.h
Normal file
257
wxWidgets/include/wx/univ/notebook.h
Normal file
|
@ -0,0 +1,257 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/notebook.h
|
||||
// Purpose: universal version of wxNotebook
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 01.02.01
|
||||
// RCS-ID: $Id: notebook.h 61872 2009-09-09 22:37:05Z VZ $
|
||||
// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_NOTEBOOK_H_
|
||||
#define _WX_UNIV_NOTEBOOK_H_
|
||||
|
||||
#include "wx/arrstr.h"
|
||||
|
||||
class WXDLLEXPORT wxSpinButton;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// the actions supported by this control
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// change the page: to the next/previous/given one
|
||||
#define wxACTION_NOTEBOOK_NEXT wxT("nexttab")
|
||||
#define wxACTION_NOTEBOOK_PREV wxT("prevtab")
|
||||
#define wxACTION_NOTEBOOK_GOTO wxT("gototab")
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxNotebook
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxNotebook : public wxNotebookBase
|
||||
{
|
||||
public:
|
||||
// ctors and such
|
||||
// --------------
|
||||
|
||||
wxNotebook() { Init(); }
|
||||
|
||||
wxNotebook(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxNotebookNameStr)
|
||||
{
|
||||
Init();
|
||||
|
||||
(void)Create(parent, id, pos, size, style, name);
|
||||
}
|
||||
|
||||
// quasi ctor
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxNotebookNameStr);
|
||||
|
||||
// dtor
|
||||
virtual ~wxNotebook();
|
||||
|
||||
// implement wxNotebookBase pure virtuals
|
||||
// --------------------------------------
|
||||
|
||||
virtual int SetSelection(size_t nPage) { return DoSetSelection(nPage, SetSelection_SendEvent); }
|
||||
virtual int GetSelection() const { return (int) m_sel; }
|
||||
|
||||
// changes selected page without sending events
|
||||
int ChangeSelection(size_t nPage) { return DoSetSelection(nPage); }
|
||||
|
||||
virtual bool SetPageText(size_t nPage, const wxString& strText);
|
||||
virtual wxString GetPageText(size_t nPage) const;
|
||||
|
||||
virtual int GetPageImage(size_t nPage) const;
|
||||
virtual bool SetPageImage(size_t nPage, int nImage);
|
||||
|
||||
virtual void SetPageSize(const wxSize& size);
|
||||
virtual void SetPadding(const wxSize& padding);
|
||||
virtual void SetTabSize(const wxSize& sz);
|
||||
|
||||
virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const;
|
||||
|
||||
virtual bool DeleteAllPages();
|
||||
|
||||
virtual bool InsertPage(size_t nPage,
|
||||
wxNotebookPage *pPage,
|
||||
const wxString& strText,
|
||||
bool bSelect = false,
|
||||
int imageId = -1);
|
||||
|
||||
// style tests
|
||||
// -----------
|
||||
|
||||
// return true if all tabs have the same width
|
||||
bool FixedSizeTabs() const { return HasFlag(wxNB_FIXEDWIDTH); }
|
||||
|
||||
// return wxTOP/wxBOTTOM/wxRIGHT/wxLEFT
|
||||
wxDirection GetTabOrientation() const;
|
||||
|
||||
// return true if the notebook has tabs at the sidesand not at the top (or
|
||||
// bottom) as usual
|
||||
bool IsVertical() const;
|
||||
|
||||
// hit testing
|
||||
// -----------
|
||||
|
||||
virtual int HitTest(const wxPoint& pt, long *flags = NULL) const;
|
||||
|
||||
// input handling
|
||||
// --------------
|
||||
|
||||
virtual bool PerformAction(const wxControlAction& action,
|
||||
long numArg = 0l,
|
||||
const wxString& strArg = wxEmptyString);
|
||||
|
||||
static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef);
|
||||
virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef)
|
||||
{
|
||||
return GetStdInputHandler(handlerDef);
|
||||
}
|
||||
|
||||
// refresh the currently selected tab
|
||||
void RefreshCurrent();
|
||||
|
||||
protected:
|
||||
virtual wxNotebookPage *DoRemovePage(size_t nPage);
|
||||
|
||||
// drawing
|
||||
virtual void DoDraw(wxControlRenderer *renderer);
|
||||
void DoDrawTab(wxDC& dc, const wxRect& rect, size_t n);
|
||||
|
||||
// resizing
|
||||
virtual wxSize DoGetBestClientSize() const;
|
||||
virtual void DoMoveWindow(int x, int y, int width, int height);
|
||||
virtual void DoSetSize(int x, int y,
|
||||
int width, int height,
|
||||
int sizeFlags = wxSIZE_AUTO);
|
||||
|
||||
int DoSetSelection(size_t nPage, int flags = 0);
|
||||
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
// resize the tab to fit its title (and icon if any)
|
||||
void ResizeTab(int page);
|
||||
|
||||
// recalculate the geometry of the notebook completely
|
||||
void Relayout();
|
||||
|
||||
// is the spin button currently shown?
|
||||
bool HasSpinBtn() const;
|
||||
|
||||
// calculate last (fully) visible tab: updates m_lastVisible
|
||||
void CalcLastVisibleTab();
|
||||
|
||||
// show or hide the spin control for tabs scrolling depending on whether it
|
||||
// is needed or not
|
||||
void UpdateSpinBtn();
|
||||
|
||||
// position the spin button
|
||||
void PositionSpinBtn();
|
||||
|
||||
// refresh the given tab only
|
||||
void RefreshTab(int page, bool forceSelected = false);
|
||||
|
||||
// refresh all tabs
|
||||
void RefreshAllTabs();
|
||||
|
||||
// get the tab rect (inefficient, don't use this in a loop)
|
||||
wxRect GetTabRect(int page) const;
|
||||
|
||||
// get the rectangle containing all tabs
|
||||
wxRect GetAllTabsRect() const;
|
||||
|
||||
// get the part occupied by the tabs - slightly smaller than
|
||||
// GetAllTabsRect() because the tabs may be indented from it
|
||||
wxRect GetTabsPart() const;
|
||||
|
||||
// calculate the tab size (without padding)
|
||||
wxSize CalcTabSize(int page) const;
|
||||
|
||||
// get the (cached) size of a tab
|
||||
void GetTabSize(int page, wxCoord *w, wxCoord *h) const;
|
||||
|
||||
// get the (cached) width of the tab
|
||||
wxCoord GetTabWidth(int page) const
|
||||
{ return FixedSizeTabs() ? m_widthMax : m_widths[page]; }
|
||||
|
||||
// return true if the tab has an associated image
|
||||
bool HasImage(int page) const
|
||||
{ return m_imageList && m_images[page] != -1; }
|
||||
|
||||
// get the part of the notebook reserved for the pages (slightly larger
|
||||
// than GetPageRect() as we draw a border and leave marginin between)
|
||||
wxRect GetPagePart() const;
|
||||
|
||||
// get the page rect in our client coords
|
||||
wxRect GetPageRect() const;
|
||||
|
||||
// get our client size from the page size
|
||||
wxSize GetSizeForPage(const wxSize& size) const;
|
||||
|
||||
// scroll the tabs so that the first page shown becomes the given one
|
||||
void ScrollTo(int page);
|
||||
|
||||
// scroll the tabs so that the first page shown becomes the given one
|
||||
void ScrollLastTo(int page);
|
||||
|
||||
// the pages titles
|
||||
wxArrayString m_titles;
|
||||
|
||||
// the current selection
|
||||
size_t m_sel;
|
||||
|
||||
// the spin button to change the pages
|
||||
wxSpinButton *m_spinbtn;
|
||||
|
||||
// the offset of the first page shown (may be changed with m_spinbtn)
|
||||
wxCoord m_offset;
|
||||
|
||||
// the first and last currently visible tabs: the name is not completely
|
||||
// accurate as m_lastVisible is, in fact, the first tab which is *not*
|
||||
// visible: so the visible tabs are those with indexes such that
|
||||
// m_firstVisible <= n < m_lastVisible
|
||||
size_t m_firstVisible,
|
||||
m_lastVisible;
|
||||
|
||||
// the last fully visible item, usually just m_lastVisible - 1 but may be
|
||||
// different from it
|
||||
size_t m_lastFullyVisible;
|
||||
|
||||
// the height of tabs in a normal notebook or the width of tabs in a
|
||||
// notebook with tabs on a side
|
||||
wxCoord m_heightTab;
|
||||
|
||||
// the biggest height (or width) of a notebook tab (used only if
|
||||
// FixedSizeTabs()) or -1 if not calculated yet
|
||||
wxCoord m_widthMax;
|
||||
|
||||
// the cached widths (or heights) of tabs
|
||||
wxArrayInt m_widths;
|
||||
|
||||
// the icon indices
|
||||
wxArrayInt m_images;
|
||||
|
||||
// the accel indexes for labels
|
||||
wxArrayInt m_accels;
|
||||
|
||||
// the padding
|
||||
wxSize m_sizePad;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxNotebook)
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_NOTEBOOK_H_
|
||||
|
151
wxWidgets/include/wx/univ/radiobox.h
Normal file
151
wxWidgets/include/wx/univ/radiobox.h
Normal file
|
@ -0,0 +1,151 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/radiobox.h
|
||||
// Purpose: wxRadioBox declaration
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 11.09.00
|
||||
// RCS-ID: $Id: radiobox.h 38319 2006-03-23 22:05:23Z VZ $
|
||||
// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_RADIOBOX_H_
|
||||
#define _WX_UNIV_RADIOBOX_H_
|
||||
|
||||
class WXDLLEXPORT wxRadioButton;
|
||||
|
||||
#include "wx/statbox.h"
|
||||
#include "wx/dynarray.h"
|
||||
|
||||
WX_DEFINE_EXPORTED_ARRAY_PTR(wxRadioButton *, wxArrayRadioButtons);
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxRadioBox: a box full of radio buttons
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxRadioBox : public wxStaticBox,
|
||||
public wxRadioBoxBase
|
||||
{
|
||||
public:
|
||||
// wxRadioBox construction
|
||||
wxRadioBox() { Init(); }
|
||||
|
||||
wxRadioBox(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
int n = 0, const wxString *choices = NULL,
|
||||
int majorDim = 0,
|
||||
long style = wxRA_SPECIFY_COLS,
|
||||
const wxValidator& val = wxDefaultValidator,
|
||||
const wxString& name = wxRadioBoxNameStr)
|
||||
{
|
||||
Init();
|
||||
|
||||
(void)Create(parent, id, title, pos, size, n, choices,
|
||||
majorDim, style, val, name);
|
||||
}
|
||||
wxRadioBox(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
const wxArrayString& choices,
|
||||
int majorDim = 0,
|
||||
long style = wxRA_SPECIFY_COLS,
|
||||
const wxValidator& val = wxDefaultValidator,
|
||||
const wxString& name = wxRadioBoxNameStr);
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
int n = 0, const wxString *choices = NULL,
|
||||
int majorDim = 0,
|
||||
long style = wxRA_SPECIFY_COLS,
|
||||
const wxValidator& val = wxDefaultValidator,
|
||||
const wxString& name = wxRadioBoxNameStr);
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
const wxArrayString& choices,
|
||||
int majorDim = 0,
|
||||
long style = wxRA_SPECIFY_COLS,
|
||||
const wxValidator& val = wxDefaultValidator,
|
||||
const wxString& name = wxRadioBoxNameStr);
|
||||
|
||||
virtual ~wxRadioBox();
|
||||
|
||||
// implement wxRadioBox interface
|
||||
virtual void SetSelection(int n);
|
||||
virtual int GetSelection() const;
|
||||
|
||||
virtual unsigned int GetCount() const
|
||||
{ return (unsigned int)m_buttons.GetCount(); }
|
||||
|
||||
virtual wxString GetString(unsigned int n) const;
|
||||
virtual void SetString(unsigned int n, const wxString& label);
|
||||
|
||||
virtual bool Enable(unsigned int n, bool enable = true);
|
||||
virtual bool Show(unsigned int n, bool show = true);
|
||||
|
||||
virtual bool IsItemEnabled(unsigned int n) const;
|
||||
virtual bool IsItemShown(unsigned int n) const;
|
||||
|
||||
// we also override the wxControl methods to avoid virtual function hiding
|
||||
virtual bool Enable(bool enable = true);
|
||||
virtual bool Show(bool show = true);
|
||||
virtual wxString GetLabel() const;
|
||||
virtual void SetLabel(const wxString& label);
|
||||
|
||||
// we inherit a version always returning false from wxStaticBox, override
|
||||
// it to behave normally
|
||||
virtual bool AcceptsFocus() const { return wxControl::AcceptsFocus(); }
|
||||
|
||||
#if wxUSE_TOOLTIPS
|
||||
virtual void DoSetToolTip( wxToolTip *tip );
|
||||
#endif // wxUSE_TOOLTIPS
|
||||
|
||||
// wxUniversal-only methods
|
||||
|
||||
// another Append() version
|
||||
void Append(int n, const wxString *choices);
|
||||
|
||||
// implementation only: called by wxRadioHookHandler
|
||||
void OnRadioButton(wxEvent& event);
|
||||
bool OnKeyDown(wxKeyEvent& event);
|
||||
|
||||
protected:
|
||||
// override the base class methods dealing with window positioning/sizing
|
||||
// as we must move/size the buttons as well
|
||||
virtual void DoMoveWindow(int x, int y, int width, int height);
|
||||
virtual wxSize DoGetBestClientSize() const;
|
||||
|
||||
// generate a radiobutton click event for the current item
|
||||
void SendRadioEvent();
|
||||
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
// calculate the max size of all buttons
|
||||
wxSize GetMaxButtonSize() const;
|
||||
|
||||
// the currently selected radio button or -1
|
||||
int m_selection;
|
||||
|
||||
// all radio buttons
|
||||
wxArrayRadioButtons m_buttons;
|
||||
|
||||
// the event handler which is used to translate radiobutton events into
|
||||
// radiobox one
|
||||
wxEvtHandler *m_evtRadioHook;
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxRadioBox)
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_RADIOBOX_H_
|
76
wxWidgets/include/wx/univ/radiobut.h
Normal file
76
wxWidgets/include/wx/univ/radiobut.h
Normal file
|
@ -0,0 +1,76 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/radiobut.h
|
||||
// Purpose: wxRadioButton declaration
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 10.09.00
|
||||
// RCS-ID: $Id: radiobut.h 35650 2005-09-23 12:56:45Z MR $
|
||||
// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_RADIOBUT_H_
|
||||
#define _WX_UNIV_RADIOBUT_H_
|
||||
|
||||
#include "wx/checkbox.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxRadioButton
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxRadioButton : public wxCheckBox
|
||||
{
|
||||
public:
|
||||
// constructors
|
||||
wxRadioButton() { Init(); }
|
||||
|
||||
wxRadioButton(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& label,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxRadioButtonNameStr)
|
||||
{
|
||||
Init();
|
||||
|
||||
Create(parent, id, label, pos, size, style, validator, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& label,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxRadioButtonNameStr);
|
||||
|
||||
// override some base class methods
|
||||
virtual void ChangeValue(bool value);
|
||||
|
||||
protected:
|
||||
// implement our own drawing
|
||||
virtual void DoDraw(wxControlRenderer *renderer);
|
||||
|
||||
// we use the radio button bitmaps for size calculation
|
||||
virtual wxSize GetBitmapSize() const;
|
||||
|
||||
// the radio button can only be cleared using this method, not
|
||||
// ChangeValue() above - and it is protected as it can only be called by
|
||||
// another radiobutton
|
||||
void ClearValue();
|
||||
|
||||
// called when the radio button becomes checked: we clear all the buttons
|
||||
// in the same group with us here
|
||||
virtual void OnCheck();
|
||||
|
||||
// send event about radio button selection
|
||||
virtual void SendEvent();
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxRadioButton)
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_RADIOBUT_H_
|
932
wxWidgets/include/wx/univ/renderer.h
Normal file
932
wxWidgets/include/wx/univ/renderer.h
Normal file
|
@ -0,0 +1,932 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/renderer.h
|
||||
// Purpose: wxRenderer class declaration
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 06.08.00
|
||||
// RCS-ID: $Id: renderer.h 43726 2006-11-30 23:44:55Z RD $
|
||||
// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_RENDERER_H_
|
||||
#define _WX_UNIV_RENDERER_H_
|
||||
|
||||
/*
|
||||
wxRenderer class is used to draw all wxWidgets controls. This is an ABC and
|
||||
the look of the application is determined by the concrete derivation of
|
||||
wxRenderer used in the program.
|
||||
|
||||
It also contains a few static methods which may be used by the concrete
|
||||
renderers and provide the functionality which is often similar or identical
|
||||
in all renderers (using inheritance here would be more restrictive as the
|
||||
given concrete renderer may need an arbitrary subset of the base class
|
||||
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).
|
||||
*/
|
||||
|
||||
#include "wx/renderer.h"
|
||||
|
||||
class WXDLLEXPORT wxWindow;
|
||||
class WXDLLEXPORT wxDC;
|
||||
class WXDLLEXPORT wxCheckListBox;
|
||||
|
||||
#if wxUSE_LISTBOX
|
||||
class WXDLLEXPORT wxListBox;
|
||||
#endif // wxUSE_LISTBOX
|
||||
|
||||
#if wxUSE_MENUS
|
||||
class WXDLLEXPORT wxMenu;
|
||||
class WXDLLEXPORT wxMenuGeometryInfo;
|
||||
#endif // wxUSE_MENUS
|
||||
|
||||
class WXDLLEXPORT wxScrollBar;
|
||||
|
||||
#if wxUSE_TEXTCTRL
|
||||
class WXDLLEXPORT wxTextCtrl;
|
||||
#endif
|
||||
|
||||
#if wxUSE_GAUGE
|
||||
class WXDLLEXPORT wxGauge;
|
||||
#endif // wxUSE_GAUGE
|
||||
|
||||
#include "wx/string.h"
|
||||
#include "wx/gdicmn.h"
|
||||
#include "wx/icon.h"
|
||||
|
||||
// helper class used by wxMenu-related functions
|
||||
class WXDLLEXPORT wxMenuGeometryInfo
|
||||
{
|
||||
public:
|
||||
// get the total size of the menu
|
||||
virtual wxSize GetSize() const = 0;
|
||||
|
||||
virtual ~wxMenuGeometryInfo();
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxRenderer: abstract renderers interface
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxRenderer : public wxDelegateRendererNative
|
||||
{
|
||||
public:
|
||||
// drawing functions
|
||||
// -----------------
|
||||
|
||||
// draw the controls background
|
||||
virtual void DrawBackground(wxDC& dc,
|
||||
const wxColour& col,
|
||||
const wxRect& rect,
|
||||
int flags,
|
||||
wxWindow *window = NULL) = 0;
|
||||
|
||||
// draw the button surface
|
||||
virtual void DrawButtonSurface(wxDC& dc,
|
||||
const wxColour& col,
|
||||
const wxRect& rect,
|
||||
int flags) = 0;
|
||||
|
||||
|
||||
// draw the focus rectangle around the label contained in the given rect
|
||||
//
|
||||
// only wxCONTROL_SELECTED makes sense in flags here
|
||||
virtual void DrawFocusRect(wxDC& dc, const wxRect& rect, int flags = 0) = 0;
|
||||
|
||||
// draw the label inside the given rectangle with the specified alignment
|
||||
// and optionally emphasize the character with the given index
|
||||
virtual void DrawLabel(wxDC& dc,
|
||||
const wxString& label,
|
||||
const wxRect& rect,
|
||||
int flags = 0,
|
||||
int alignment = wxALIGN_LEFT | wxALIGN_TOP,
|
||||
int indexAccel = -1,
|
||||
wxRect *rectBounds = NULL) = 0;
|
||||
|
||||
// same but also draw a bitmap if it is valid
|
||||
virtual void DrawButtonLabel(wxDC& dc,
|
||||
const wxString& label,
|
||||
const wxBitmap& image,
|
||||
const wxRect& rect,
|
||||
int flags = 0,
|
||||
int alignment = wxALIGN_LEFT | wxALIGN_TOP,
|
||||
int indexAccel = -1,
|
||||
wxRect *rectBounds = NULL) = 0;
|
||||
|
||||
|
||||
// draw the border and optionally return the rectangle containing the
|
||||
// region inside the border
|
||||
virtual void DrawBorder(wxDC& dc,
|
||||
wxBorder border,
|
||||
const wxRect& rect,
|
||||
int flags = 0,
|
||||
wxRect *rectIn = (wxRect *)NULL) = 0;
|
||||
|
||||
// draw text control border (I hate to have a separate method for this but
|
||||
// it is needed to accommodate GTK+)
|
||||
virtual void DrawTextBorder(wxDC& dc,
|
||||
wxBorder border,
|
||||
const wxRect& rect,
|
||||
int flags = 0,
|
||||
wxRect *rectIn = (wxRect *)NULL) = 0;
|
||||
|
||||
// draw push button border and return the rectangle left for the label
|
||||
virtual void DrawButtonBorder(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
int flags = 0,
|
||||
wxRect *rectIn = (wxRect *)NULL) = 0;
|
||||
|
||||
// draw a horizontal line
|
||||
virtual void DrawHorizontalLine(wxDC& dc,
|
||||
wxCoord y, wxCoord x1, wxCoord x2) = 0;
|
||||
|
||||
// draw a vertical line
|
||||
virtual void DrawVerticalLine(wxDC& dc,
|
||||
wxCoord x, wxCoord y1, wxCoord y2) = 0;
|
||||
|
||||
// draw a frame with the label (horizontal alignment can be specified)
|
||||
virtual void DrawFrame(wxDC& dc,
|
||||
const wxString& label,
|
||||
const wxRect& rect,
|
||||
int flags = 0,
|
||||
int alignment = wxALIGN_LEFT,
|
||||
int indexAccel = -1) = 0;
|
||||
|
||||
// draw an arrow in the given direction
|
||||
virtual void DrawArrow(wxDC& dc,
|
||||
wxDirection dir,
|
||||
const wxRect& rect,
|
||||
int flags = 0) = 0;
|
||||
|
||||
// draw a scrollbar arrow (may be the same as arrow but may be not)
|
||||
virtual void DrawScrollbarArrow(wxDC& dc,
|
||||
wxDirection dir,
|
||||
const wxRect& rect,
|
||||
int flags = 0) = 0;
|
||||
|
||||
// draw the scrollbar thumb
|
||||
virtual void DrawScrollbarThumb(wxDC& dc,
|
||||
wxOrientation orient,
|
||||
const wxRect& rect,
|
||||
int flags = 0) = 0;
|
||||
|
||||
// draw a (part of) scrollbar shaft
|
||||
virtual void DrawScrollbarShaft(wxDC& dc,
|
||||
wxOrientation orient,
|
||||
const wxRect& rect,
|
||||
int flags = 0) = 0;
|
||||
|
||||
// draw the rectangle in the corner between two scrollbars
|
||||
virtual void DrawScrollCorner(wxDC& dc,
|
||||
const wxRect& rect) = 0;
|
||||
|
||||
// draw an item of a wxListBox
|
||||
virtual void DrawItem(wxDC& dc,
|
||||
const wxString& label,
|
||||
const wxRect& rect,
|
||||
int flags = 0) = 0;
|
||||
|
||||
// draw an item of a wxCheckListBox
|
||||
virtual void DrawCheckItem(wxDC& dc,
|
||||
const wxString& label,
|
||||
const wxBitmap& bitmap,
|
||||
const wxRect& rect,
|
||||
int flags = 0) = 0;
|
||||
|
||||
// draw a checkbutton (bitmap may be invalid to use default one)
|
||||
virtual void DrawCheckButton(wxDC& dc,
|
||||
const wxString& label,
|
||||
const wxBitmap& bitmap,
|
||||
const wxRect& rect,
|
||||
int flags = 0,
|
||||
wxAlignment align = wxALIGN_LEFT,
|
||||
int indexAccel = -1) = 0;
|
||||
|
||||
// draw a radio button
|
||||
virtual void DrawRadioButton(wxDC& dc,
|
||||
const wxString& label,
|
||||
const wxBitmap& bitmap,
|
||||
const wxRect& rect,
|
||||
int flags = 0,
|
||||
wxAlignment align = wxALIGN_LEFT,
|
||||
int indexAccel = -1) = 0;
|
||||
|
||||
#if wxUSE_TOOLBAR
|
||||
// draw a toolbar button (label may be empty, bitmap may be invalid, if
|
||||
// both conditions are true this function draws a separator)
|
||||
virtual void DrawToolBarButton(wxDC& dc,
|
||||
const wxString& label,
|
||||
const wxBitmap& bitmap,
|
||||
const wxRect& rect,
|
||||
int flags = 0,
|
||||
long style = 0,
|
||||
int tbarStyle = 0) = 0;
|
||||
#endif // wxUSE_TOOLBAR
|
||||
|
||||
#if wxUSE_TEXTCTRL
|
||||
// draw a (part of) line in the text control
|
||||
virtual void DrawTextLine(wxDC& dc,
|
||||
const wxString& text,
|
||||
const wxRect& rect,
|
||||
int selStart = -1,
|
||||
int selEnd = -1,
|
||||
int flags = 0) = 0;
|
||||
|
||||
// draw a line wrap indicator
|
||||
virtual void DrawLineWrapMark(wxDC& dc, const wxRect& rect) = 0;
|
||||
#endif // wxUSE_TEXTCTRL
|
||||
|
||||
#if wxUSE_NOTEBOOK
|
||||
// draw a notebook tab
|
||||
virtual void DrawTab(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
wxDirection dir,
|
||||
const wxString& label,
|
||||
const wxBitmap& bitmap = wxNullBitmap,
|
||||
int flags = 0,
|
||||
int indexAccel = -1) = 0;
|
||||
#endif // wxUSE_NOTEBOOK
|
||||
|
||||
#if wxUSE_SLIDER
|
||||
|
||||
// draw the slider shaft
|
||||
virtual void DrawSliderShaft(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
int lenThumb,
|
||||
wxOrientation orient,
|
||||
int flags = 0,
|
||||
long style = 0,
|
||||
wxRect *rectShaft = NULL) = 0;
|
||||
|
||||
// draw the slider thumb
|
||||
virtual void DrawSliderThumb(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
wxOrientation orient,
|
||||
int flags = 0,
|
||||
long style = 0) = 0;
|
||||
|
||||
// draw the slider ticks
|
||||
virtual void DrawSliderTicks(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
int lenThumb,
|
||||
wxOrientation orient,
|
||||
int start,
|
||||
int end,
|
||||
int step = 1,
|
||||
int flags = 0,
|
||||
long style = 0) = 0;
|
||||
#endif // wxUSE_SLIDER
|
||||
|
||||
#if wxUSE_MENUS
|
||||
// draw a menu bar item
|
||||
virtual void DrawMenuBarItem(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
const wxString& label,
|
||||
int flags = 0,
|
||||
int indexAccel = -1) = 0;
|
||||
|
||||
// draw a menu item (also used for submenus if flags has ISSUBMENU flag)
|
||||
//
|
||||
// the geometryInfo is calculated by GetMenuGeometry() function from below
|
||||
virtual void DrawMenuItem(wxDC& dc,
|
||||
wxCoord y,
|
||||
const wxMenuGeometryInfo& geometryInfo,
|
||||
const wxString& label,
|
||||
const wxString& accel,
|
||||
const wxBitmap& bitmap = wxNullBitmap,
|
||||
int flags = 0,
|
||||
int indexAccel = -1) = 0;
|
||||
|
||||
// draw a menu bar separator
|
||||
virtual void DrawMenuSeparator(wxDC& dc,
|
||||
wxCoord y,
|
||||
const wxMenuGeometryInfo& geomInfo) = 0;
|
||||
#endif // wxUSE_MENUS
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
// draw a status bar field: wxCONTROL_ISDEFAULT bit in the flags is
|
||||
// interpreted specially and means "draw the status bar grip" here
|
||||
virtual void DrawStatusField(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
const wxString& label,
|
||||
int flags = 0, int style = 0) = 0;
|
||||
#endif // wxUSE_STATUSBAR
|
||||
|
||||
// draw complete frame/dialog titlebar
|
||||
virtual void DrawFrameTitleBar(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
const wxString& title,
|
||||
const wxIcon& icon,
|
||||
int flags,
|
||||
int specialButton = 0,
|
||||
int specialButtonFlags = 0) = 0;
|
||||
|
||||
// draw frame borders
|
||||
virtual void DrawFrameBorder(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
int flags) = 0;
|
||||
|
||||
// draw frame titlebar background
|
||||
virtual void DrawFrameBackground(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
int flags) = 0;
|
||||
|
||||
// draw frame title
|
||||
virtual void DrawFrameTitle(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
const wxString& title,
|
||||
int flags) = 0;
|
||||
|
||||
// draw frame icon
|
||||
virtual void DrawFrameIcon(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
const wxIcon& icon,
|
||||
int flags) = 0;
|
||||
|
||||
// draw frame buttons
|
||||
virtual void DrawFrameButton(wxDC& dc,
|
||||
wxCoord x, wxCoord y,
|
||||
int button,
|
||||
int flags = 0) = 0;
|
||||
|
||||
// misc functions
|
||||
// --------------
|
||||
|
||||
#if wxUSE_COMBOBOX
|
||||
// return the bitmaps to use for combobox button
|
||||
virtual void GetComboBitmaps(wxBitmap *bmpNormal,
|
||||
wxBitmap *bmpFocus,
|
||||
wxBitmap *bmpPressed,
|
||||
wxBitmap *bmpDisabled) = 0;
|
||||
#endif // wxUSE_COMBOBOX
|
||||
|
||||
// geometry functions
|
||||
// ------------------
|
||||
|
||||
// get the dimensions of the border: rect.x/y contain the width/height of
|
||||
// the left/top side, width/heigh - of the right/bottom one
|
||||
virtual wxRect GetBorderDimensions(wxBorder border) const = 0;
|
||||
|
||||
// the scrollbars may be drawn either inside the window border or outside
|
||||
// it - this function is used to decide how to draw them
|
||||
virtual bool AreScrollbarsInsideBorder() const = 0;
|
||||
|
||||
// adjust the size of the control of the given class: for most controls,
|
||||
// this just takes into account the border, but for some (buttons, for
|
||||
// example) it is more complicated - the result being, in any case, that
|
||||
// the control looks "nice" if it uses the adjusted rectangle
|
||||
virtual void AdjustSize(wxSize *size, const wxWindow *window) = 0;
|
||||
|
||||
#if wxUSE_SCROLLBAR
|
||||
// get the size of a scrollbar arrow
|
||||
virtual wxSize GetScrollbarArrowSize() const = 0;
|
||||
#endif // wxUSE_SCROLLBAR
|
||||
|
||||
// get the height of a listbox item from the base font height
|
||||
virtual wxCoord GetListboxItemHeight(wxCoord fontHeight) = 0;
|
||||
|
||||
// get the size of a checkbox/radio button bitmap
|
||||
virtual wxSize GetCheckBitmapSize() const = 0;
|
||||
virtual wxSize GetRadioBitmapSize() const = 0;
|
||||
virtual wxCoord GetCheckItemMargin() const = 0;
|
||||
|
||||
#if wxUSE_TOOLBAR
|
||||
// get the standard size of a toolbar button and also return the size of
|
||||
// a toolbar separator in the provided pointer
|
||||
virtual wxSize GetToolBarButtonSize(wxCoord *separator) const = 0;
|
||||
|
||||
// get the margins between/around the toolbar buttons
|
||||
virtual wxSize GetToolBarMargin() const = 0;
|
||||
#endif // wxUSE_TOOLBAR
|
||||
|
||||
#if wxUSE_TEXTCTRL
|
||||
// convert between text rectangle and client rectangle for text controls:
|
||||
// the former is typicall smaller to leave margins around text
|
||||
virtual wxRect GetTextTotalArea(const wxTextCtrl *text,
|
||||
const wxRect& rectText) const = 0;
|
||||
|
||||
// extra space is for line indicators
|
||||
virtual wxRect GetTextClientArea(const wxTextCtrl *text,
|
||||
const wxRect& rectTotal,
|
||||
wxCoord *extraSpaceBeyond) const = 0;
|
||||
#endif // wxUSE_TEXTCTRL
|
||||
|
||||
#if wxUSE_NOTEBOOK
|
||||
// get the overhang of a selected tab
|
||||
virtual wxSize GetTabIndent() const = 0;
|
||||
|
||||
// get the padding around the text in a tab
|
||||
virtual wxSize GetTabPadding() const = 0;
|
||||
#endif // wxUSE_NOTEBOOK
|
||||
|
||||
#if wxUSE_SLIDER
|
||||
// get the default size of the slider in lesser dimension (i.e. height of a
|
||||
// horizontal slider or width of a vertical one)
|
||||
virtual wxCoord GetSliderDim() const = 0;
|
||||
|
||||
// get the length of the slider ticks displayed along side slider
|
||||
virtual wxCoord GetSliderTickLen() const = 0;
|
||||
|
||||
// get the slider shaft rect from the total slider rect
|
||||
virtual wxRect GetSliderShaftRect(const wxRect& rect,
|
||||
int lenThumb,
|
||||
wxOrientation orient,
|
||||
long style = 0) const = 0;
|
||||
|
||||
// get the size of the slider thumb for the given total slider rect
|
||||
virtual wxSize GetSliderThumbSize(const wxRect& rect,
|
||||
int lenThumb,
|
||||
wxOrientation orient) const = 0;
|
||||
#endif // wxUSE_SLIDER
|
||||
|
||||
// get the size of one progress bar step (in horz and vertical directions)
|
||||
virtual wxSize GetProgressBarStep() const = 0;
|
||||
|
||||
#if wxUSE_MENUS
|
||||
// get the size of rectangle to use in the menubar for the given text rect
|
||||
virtual wxSize GetMenuBarItemSize(const wxSize& sizeText) const = 0;
|
||||
|
||||
// get the struct storing all layout info needed to draw all menu items
|
||||
// (this can't be calculated for each item separately as they should be
|
||||
// aligned)
|
||||
//
|
||||
// the returned pointer must be deleted by the caller
|
||||
virtual wxMenuGeometryInfo *GetMenuGeometry(wxWindow *win,
|
||||
const wxMenu& menu) const = 0;
|
||||
#endif // wxUSE_MENUS
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
// get the borders around the status bar fields (x and y fields of the
|
||||
// return value)
|
||||
virtual wxSize GetStatusBarBorders() const = 0;
|
||||
|
||||
// get the border between the status bar fields
|
||||
virtual wxCoord GetStatusBarBorderBetweenFields() const = 0;
|
||||
|
||||
// get the mergin between a field and its border
|
||||
virtual wxSize GetStatusBarFieldMargins() const = 0;
|
||||
#endif // wxUSE_STATUSBAR
|
||||
|
||||
// get client area rectangle of top level window (i.e. subtract
|
||||
// decorations from given rectangle)
|
||||
virtual wxRect GetFrameClientArea(const wxRect& rect, int flags) const = 0;
|
||||
|
||||
// get size of whole top level window, given size of its client area size
|
||||
virtual wxSize GetFrameTotalSize(const wxSize& clientSize, int flags) const = 0;
|
||||
|
||||
// get the minimal size of top level window
|
||||
virtual wxSize GetFrameMinSize(int flags) const = 0;
|
||||
|
||||
// get titlebar icon size
|
||||
virtual wxSize GetFrameIconSize() const = 0;
|
||||
|
||||
// returns one of wxHT_TOPLEVEL_XXX constants
|
||||
virtual int HitTestFrame(const wxRect& rect,
|
||||
const wxPoint& pt,
|
||||
int flags = 0) const = 0;
|
||||
|
||||
// virtual dtor for any base class
|
||||
virtual ~wxRenderer();
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDelegateRenderer: it is impossible to inherit from any of standard
|
||||
// renderers as their declarations are in private code, but you can use this
|
||||
// class to override only some of the Draw() functions - all the other ones
|
||||
// will be left to the original renderer
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxDelegateRenderer : public wxRenderer
|
||||
{
|
||||
public:
|
||||
wxDelegateRenderer(wxRenderer *renderer) : m_renderer(renderer) { }
|
||||
|
||||
virtual void DrawBackground(wxDC& dc,
|
||||
const wxColour& col,
|
||||
const wxRect& rect,
|
||||
int flags,
|
||||
wxWindow *window = NULL )
|
||||
{ m_renderer->DrawBackground(dc, col, rect, flags, window ); }
|
||||
virtual void DrawButtonSurface(wxDC& dc,
|
||||
const wxColour& col,
|
||||
const wxRect& rect,
|
||||
int flags)
|
||||
{ m_renderer->DrawButtonSurface(dc, col, rect, flags); }
|
||||
virtual void DrawFocusRect(wxDC& dc, const wxRect& rect, int flags = 0)
|
||||
{ m_renderer->DrawFocusRect(dc, rect, flags); }
|
||||
virtual void DrawLabel(wxDC& dc,
|
||||
const wxString& label,
|
||||
const wxRect& rect,
|
||||
int flags = 0,
|
||||
int align = wxALIGN_LEFT | wxALIGN_TOP,
|
||||
int indexAccel = -1,
|
||||
wxRect *rectBounds = NULL)
|
||||
{ m_renderer->DrawLabel(dc, label, rect,
|
||||
flags, align, indexAccel, rectBounds); }
|
||||
virtual void DrawButtonLabel(wxDC& dc,
|
||||
const wxString& label,
|
||||
const wxBitmap& image,
|
||||
const wxRect& rect,
|
||||
int flags = 0,
|
||||
int align = wxALIGN_LEFT | wxALIGN_TOP,
|
||||
int indexAccel = -1,
|
||||
wxRect *rectBounds = NULL)
|
||||
{ m_renderer->DrawButtonLabel(dc, label, image, rect,
|
||||
flags, align, indexAccel, rectBounds); }
|
||||
virtual void DrawBorder(wxDC& dc,
|
||||
wxBorder border,
|
||||
const wxRect& rect,
|
||||
int flags = 0,
|
||||
wxRect *rectIn = (wxRect *)NULL)
|
||||
{ m_renderer->DrawBorder(dc, border, rect, flags, rectIn); }
|
||||
virtual void DrawTextBorder(wxDC& dc,
|
||||
wxBorder border,
|
||||
const wxRect& rect,
|
||||
int flags = 0,
|
||||
wxRect *rectIn = (wxRect *)NULL)
|
||||
{ m_renderer->DrawTextBorder(dc, border, rect, flags, rectIn); }
|
||||
virtual void DrawButtonBorder(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
int flags = 0,
|
||||
wxRect *rectIn = (wxRect *)NULL)
|
||||
{ m_renderer->DrawButtonBorder(dc, rect, flags, rectIn); }
|
||||
virtual void DrawFrame(wxDC& dc,
|
||||
const wxString& label,
|
||||
const wxRect& rect,
|
||||
int flags = 0,
|
||||
int align = wxALIGN_LEFT,
|
||||
int indexAccel = -1)
|
||||
{ m_renderer->DrawFrame(dc, label, rect, flags, align, indexAccel); }
|
||||
virtual void DrawHorizontalLine(wxDC& dc,
|
||||
wxCoord y, wxCoord x1, wxCoord x2)
|
||||
{ m_renderer->DrawHorizontalLine(dc, y, x1, x2); }
|
||||
virtual void DrawVerticalLine(wxDC& dc,
|
||||
wxCoord x, wxCoord y1, wxCoord y2)
|
||||
{ m_renderer->DrawVerticalLine(dc, x, y1, y2); }
|
||||
virtual void DrawArrow(wxDC& dc,
|
||||
wxDirection dir,
|
||||
const wxRect& rect,
|
||||
int flags = 0)
|
||||
{ m_renderer->DrawArrow(dc, dir, rect, flags); }
|
||||
virtual void DrawScrollbarArrow(wxDC& dc,
|
||||
wxDirection dir,
|
||||
const wxRect& rect,
|
||||
int flags = 0)
|
||||
{ m_renderer->DrawScrollbarArrow(dc, dir, rect, flags); }
|
||||
virtual void DrawScrollbarThumb(wxDC& dc,
|
||||
wxOrientation orient,
|
||||
const wxRect& rect,
|
||||
int flags = 0)
|
||||
{ m_renderer->DrawScrollbarThumb(dc, orient, rect, flags); }
|
||||
virtual void DrawScrollbarShaft(wxDC& dc,
|
||||
wxOrientation orient,
|
||||
const wxRect& rect,
|
||||
int flags = 0)
|
||||
{ m_renderer->DrawScrollbarShaft(dc, orient, rect, flags); }
|
||||
virtual void DrawScrollCorner(wxDC& dc,
|
||||
const wxRect& rect)
|
||||
{ m_renderer->DrawScrollCorner(dc, rect); }
|
||||
virtual void DrawItem(wxDC& dc,
|
||||
const wxString& label,
|
||||
const wxRect& rect,
|
||||
int flags = 0)
|
||||
{ m_renderer->DrawItem(dc, label, rect, flags); }
|
||||
virtual void DrawCheckItem(wxDC& dc,
|
||||
const wxString& label,
|
||||
const wxBitmap& bitmap,
|
||||
const wxRect& rect,
|
||||
int flags = 0)
|
||||
{ m_renderer->DrawCheckItem(dc, label, bitmap, rect, flags); }
|
||||
virtual void DrawCheckButton(wxDC& dc,
|
||||
const wxString& label,
|
||||
const wxBitmap& bitmap,
|
||||
const wxRect& rect,
|
||||
int flags = 0,
|
||||
wxAlignment align = wxALIGN_LEFT,
|
||||
int indexAccel = -1)
|
||||
{ m_renderer->DrawCheckButton(dc, label, bitmap, rect,
|
||||
flags, align, indexAccel); }
|
||||
virtual void DrawRadioButton(wxDC& dc,
|
||||
const wxString& label,
|
||||
const wxBitmap& bitmap,
|
||||
const wxRect& rect,
|
||||
int flags = 0,
|
||||
wxAlignment align = wxALIGN_LEFT,
|
||||
int indexAccel = -1)
|
||||
{ m_renderer->DrawRadioButton(dc, label, bitmap, rect,
|
||||
flags, align, indexAccel); }
|
||||
#if wxUSE_TOOLBAR
|
||||
virtual void DrawToolBarButton(wxDC& dc,
|
||||
const wxString& label,
|
||||
const wxBitmap& bitmap,
|
||||
const wxRect& rect,
|
||||
int flags = 0,
|
||||
long style = 0,
|
||||
int tbarStyle = 0)
|
||||
{ m_renderer->DrawToolBarButton(dc, label, bitmap, rect, flags, style, tbarStyle); }
|
||||
#endif // wxUSE_TOOLBAR
|
||||
|
||||
#if wxUSE_TEXTCTRL
|
||||
virtual void DrawTextLine(wxDC& dc,
|
||||
const wxString& text,
|
||||
const wxRect& rect,
|
||||
int selStart = -1,
|
||||
int selEnd = -1,
|
||||
int flags = 0)
|
||||
{ m_renderer->DrawTextLine(dc, text, rect, selStart, selEnd, flags); }
|
||||
virtual void DrawLineWrapMark(wxDC& dc, const wxRect& rect)
|
||||
{ m_renderer->DrawLineWrapMark(dc, rect); }
|
||||
#endif // wxUSE_TEXTCTRL
|
||||
|
||||
#if wxUSE_NOTEBOOK
|
||||
virtual void DrawTab(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
wxDirection dir,
|
||||
const wxString& label,
|
||||
const wxBitmap& bitmap = wxNullBitmap,
|
||||
int flags = 0,
|
||||
int accel = -1)
|
||||
{ m_renderer->DrawTab(dc, rect, dir, label, bitmap, flags, accel); }
|
||||
#endif // wxUSE_NOTEBOOK
|
||||
|
||||
#if wxUSE_SLIDER
|
||||
|
||||
virtual void DrawSliderShaft(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
int lenThumb,
|
||||
wxOrientation orient,
|
||||
int flags = 0,
|
||||
long style = 0,
|
||||
wxRect *rectShaft = NULL)
|
||||
{ m_renderer->DrawSliderShaft(dc, rect, lenThumb, orient, flags, style, rectShaft); }
|
||||
virtual void DrawSliderThumb(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
wxOrientation orient,
|
||||
int flags = 0,
|
||||
long style = 0)
|
||||
{ m_renderer->DrawSliderThumb(dc, rect, orient, flags, style); }
|
||||
virtual void DrawSliderTicks(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
int lenThumb,
|
||||
wxOrientation orient,
|
||||
int start,
|
||||
int end,
|
||||
int WXUNUSED(step) = 1,
|
||||
int flags = 0,
|
||||
long style = 0)
|
||||
{ m_renderer->DrawSliderTicks(dc, rect, lenThumb, orient,
|
||||
start, end, start, flags, style); }
|
||||
#endif // wxUSE_SLIDER
|
||||
|
||||
#if wxUSE_MENUS
|
||||
virtual void DrawMenuBarItem(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
const wxString& label,
|
||||
int flags = 0,
|
||||
int indexAccel = -1)
|
||||
{ m_renderer->DrawMenuBarItem(dc, rect, label, flags, indexAccel); }
|
||||
virtual void DrawMenuItem(wxDC& dc,
|
||||
wxCoord y,
|
||||
const wxMenuGeometryInfo& gi,
|
||||
const wxString& label,
|
||||
const wxString& accel,
|
||||
const wxBitmap& bitmap = wxNullBitmap,
|
||||
int flags = 0,
|
||||
int indexAccel = -1)
|
||||
{ m_renderer->DrawMenuItem(dc, y, gi, label, accel,
|
||||
bitmap, flags, indexAccel); }
|
||||
virtual void DrawMenuSeparator(wxDC& dc,
|
||||
wxCoord y,
|
||||
const wxMenuGeometryInfo& geomInfo)
|
||||
{ m_renderer->DrawMenuSeparator(dc, y, geomInfo); }
|
||||
#endif // wxUSE_MENUS
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
virtual void DrawStatusField(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
const wxString& label,
|
||||
int flags = 0, int style = 0)
|
||||
{ m_renderer->DrawStatusField(dc, rect, label, flags, style); }
|
||||
#endif // wxUSE_STATUSBAR
|
||||
|
||||
virtual void DrawFrameTitleBar(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
const wxString& title,
|
||||
const wxIcon& icon,
|
||||
int flags,
|
||||
int specialButton = 0,
|
||||
int specialButtonFlag = 0)
|
||||
{ m_renderer->DrawFrameTitleBar(dc, rect, title, icon, flags,
|
||||
specialButton, specialButtonFlag); }
|
||||
virtual void DrawFrameBorder(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
int flags)
|
||||
{ m_renderer->DrawFrameBorder(dc, rect, flags); }
|
||||
virtual void DrawFrameBackground(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
int flags)
|
||||
{ m_renderer->DrawFrameBackground(dc, rect, flags); }
|
||||
virtual void DrawFrameTitle(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
const wxString& title,
|
||||
int flags)
|
||||
{ m_renderer->DrawFrameTitle(dc, rect, title, flags); }
|
||||
virtual void DrawFrameIcon(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
const wxIcon& icon,
|
||||
int flags)
|
||||
{ m_renderer->DrawFrameIcon(dc, rect, icon, flags); }
|
||||
virtual void DrawFrameButton(wxDC& dc,
|
||||
wxCoord x, wxCoord y,
|
||||
int button,
|
||||
int flags = 0)
|
||||
{ m_renderer->DrawFrameButton(dc, x, y, button, flags); }
|
||||
|
||||
#if wxUSE_COMBOBOX
|
||||
virtual void GetComboBitmaps(wxBitmap *bmpNormal,
|
||||
wxBitmap *bmpFocus,
|
||||
wxBitmap *bmpPressed,
|
||||
wxBitmap *bmpDisabled)
|
||||
{ m_renderer->GetComboBitmaps(bmpNormal, bmpFocus,
|
||||
bmpPressed, bmpDisabled); }
|
||||
#endif // wxUSE_COMBOBOX
|
||||
|
||||
virtual void AdjustSize(wxSize *size, const wxWindow *window)
|
||||
{ m_renderer->AdjustSize(size, window); }
|
||||
virtual wxRect GetBorderDimensions(wxBorder border) const
|
||||
{ return m_renderer->GetBorderDimensions(border); }
|
||||
virtual bool AreScrollbarsInsideBorder() const
|
||||
{ return m_renderer->AreScrollbarsInsideBorder(); }
|
||||
|
||||
#if wxUSE_SCROLLBAR
|
||||
virtual wxSize GetScrollbarArrowSize() const
|
||||
{ return m_renderer->GetScrollbarArrowSize(); }
|
||||
#endif // wxUSE_SCROLLBAR
|
||||
|
||||
virtual wxCoord GetListboxItemHeight(wxCoord fontHeight)
|
||||
{ return m_renderer->GetListboxItemHeight(fontHeight); }
|
||||
virtual wxSize GetCheckBitmapSize() const
|
||||
{ return m_renderer->GetCheckBitmapSize(); }
|
||||
virtual wxSize GetRadioBitmapSize() const
|
||||
{ return m_renderer->GetRadioBitmapSize(); }
|
||||
virtual wxCoord GetCheckItemMargin() const
|
||||
{ return m_renderer->GetCheckItemMargin(); }
|
||||
|
||||
#if wxUSE_TOOLBAR
|
||||
virtual wxSize GetToolBarButtonSize(wxCoord *separator) const
|
||||
{ return m_renderer->GetToolBarButtonSize(separator); }
|
||||
virtual wxSize GetToolBarMargin() const
|
||||
{ return m_renderer->GetToolBarMargin(); }
|
||||
#endif // wxUSE_TOOLBAR
|
||||
|
||||
#if wxUSE_TEXTCTRL
|
||||
virtual wxRect GetTextTotalArea(const wxTextCtrl *text,
|
||||
const wxRect& rect) const
|
||||
{ return m_renderer->GetTextTotalArea(text, rect); }
|
||||
virtual wxRect GetTextClientArea(const wxTextCtrl *text,
|
||||
const wxRect& rect,
|
||||
wxCoord *extraSpaceBeyond) const
|
||||
{ return m_renderer->GetTextClientArea(text, rect, extraSpaceBeyond); }
|
||||
#endif // wxUSE_TEXTCTRL
|
||||
|
||||
#if wxUSE_NOTEBOOK
|
||||
virtual wxSize GetTabIndent() const { return m_renderer->GetTabIndent(); }
|
||||
virtual wxSize GetTabPadding() const { return m_renderer->GetTabPadding(); }
|
||||
#endif // wxUSE_NOTEBOOK
|
||||
|
||||
#if wxUSE_SLIDER
|
||||
virtual wxCoord GetSliderDim() const
|
||||
{ return m_renderer->GetSliderDim(); }
|
||||
virtual wxCoord GetSliderTickLen() const
|
||||
{ return m_renderer->GetSliderTickLen(); }
|
||||
|
||||
virtual wxRect GetSliderShaftRect(const wxRect& rect,
|
||||
int lenThumb,
|
||||
wxOrientation orient,
|
||||
long style = 0) const
|
||||
{ return m_renderer->GetSliderShaftRect(rect, lenThumb, orient, style); }
|
||||
virtual wxSize GetSliderThumbSize(const wxRect& rect,
|
||||
int lenThumb,
|
||||
wxOrientation orient) const
|
||||
{ return m_renderer->GetSliderThumbSize(rect, lenThumb, orient); }
|
||||
#endif // wxUSE_SLIDER
|
||||
|
||||
virtual wxSize GetProgressBarStep() const
|
||||
{ return m_renderer->GetProgressBarStep(); }
|
||||
|
||||
#if wxUSE_MENUS
|
||||
virtual wxSize GetMenuBarItemSize(const wxSize& sizeText) const
|
||||
{ return m_renderer->GetMenuBarItemSize(sizeText); }
|
||||
virtual wxMenuGeometryInfo *GetMenuGeometry(wxWindow *win,
|
||||
const wxMenu& menu) const
|
||||
{ return m_renderer->GetMenuGeometry(win, menu); }
|
||||
#endif // wxUSE_MENUS
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
virtual wxSize GetStatusBarBorders() const
|
||||
{ return m_renderer->GetStatusBarBorders(); }
|
||||
virtual wxCoord GetStatusBarBorderBetweenFields() const
|
||||
{ return m_renderer->GetStatusBarBorderBetweenFields(); }
|
||||
virtual wxSize GetStatusBarFieldMargins() const
|
||||
{ return m_renderer->GetStatusBarFieldMargins(); }
|
||||
#endif // wxUSE_STATUSBAR
|
||||
|
||||
virtual wxRect GetFrameClientArea(const wxRect& rect, int flags) const
|
||||
{ return m_renderer->GetFrameClientArea(rect, flags); }
|
||||
virtual wxSize GetFrameTotalSize(const wxSize& clientSize, int flags) const
|
||||
{ return m_renderer->GetFrameTotalSize(clientSize, flags); }
|
||||
virtual wxSize GetFrameMinSize(int flags) const
|
||||
{ return m_renderer->GetFrameMinSize(flags); }
|
||||
virtual wxSize GetFrameIconSize() const
|
||||
{ return m_renderer->GetFrameIconSize(); }
|
||||
virtual int HitTestFrame(const wxRect& rect,
|
||||
const wxPoint& pt,
|
||||
int flags) const
|
||||
{ return m_renderer->HitTestFrame(rect, pt, flags); }
|
||||
|
||||
virtual int DrawHeaderButton(wxWindow *win,
|
||||
wxDC& dc,
|
||||
const wxRect& rect,
|
||||
int flags = 0,
|
||||
wxHeaderSortIconType sortIcon = wxHDR_SORT_ICON_NONE,
|
||||
wxHeaderButtonParams* params = NULL)
|
||||
{ return m_renderer->DrawHeaderButton(win, dc, rect, flags, sortIcon, params); }
|
||||
virtual void DrawTreeItemButton(wxWindow *win,
|
||||
wxDC& dc,
|
||||
const wxRect& rect,
|
||||
int flags = 0)
|
||||
{ m_renderer->DrawTreeItemButton(win, dc, rect, flags); }
|
||||
|
||||
protected:
|
||||
wxRenderer *m_renderer;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxControlRenderer: wraps the wxRenderer functions in a form easy to use from
|
||||
// OnPaint()
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxControlRenderer
|
||||
{
|
||||
public:
|
||||
// create a renderer for this dc with this "fundamental" renderer
|
||||
wxControlRenderer(wxWindow *control, wxDC& dc, wxRenderer *renderer);
|
||||
|
||||
// operations
|
||||
void DrawLabel(const wxBitmap& bitmap = wxNullBitmap,
|
||||
wxCoord marginX = 0, wxCoord marginY = 0);
|
||||
#if wxUSE_LISTBOX
|
||||
void DrawItems(const wxListBox *listbox,
|
||||
size_t itemFirst, size_t itemLast);
|
||||
#endif // wxUSE_LISTBOX
|
||||
#if wxUSE_CHECKLISTBOX
|
||||
void DrawCheckItems(const wxCheckListBox *listbox,
|
||||
size_t itemFirst, size_t itemLast);
|
||||
#endif // wxUSE_CHECKLISTBOX
|
||||
void DrawButtonBorder();
|
||||
// the line must be either horizontal or vertical
|
||||
void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
|
||||
void DrawFrame();
|
||||
void DrawBitmap(const wxBitmap& bitmap);
|
||||
void DrawBackgroundBitmap();
|
||||
void DrawScrollbar(const wxScrollBar *scrollbar, int thumbPosOld);
|
||||
#if wxUSE_GAUGE
|
||||
void DrawProgressBar(const wxGauge *gauge);
|
||||
#endif // wxUSE_GAUGE
|
||||
|
||||
// accessors
|
||||
wxWindow *GetWindow() const { return m_window; }
|
||||
wxRenderer *GetRenderer() const { return m_renderer; }
|
||||
|
||||
wxDC& GetDC() { return m_dc; }
|
||||
|
||||
const wxRect& GetRect() const { return m_rect; }
|
||||
wxRect& GetRect() { return m_rect; }
|
||||
|
||||
// static helpers
|
||||
static void DrawBitmap(wxDC &dc,
|
||||
const wxBitmap& bitmap,
|
||||
const wxRect& rect,
|
||||
int alignment = wxALIGN_CENTRE |
|
||||
wxALIGN_CENTRE_VERTICAL,
|
||||
wxStretch stretch = wxSTRETCH_NOT);
|
||||
|
||||
private:
|
||||
|
||||
#if wxUSE_LISTBOX
|
||||
// common part of DrawItems() and DrawCheckItems()
|
||||
void DoDrawItems(const wxListBox *listbox,
|
||||
size_t itemFirst, size_t itemLast,
|
||||
bool isCheckLbox = false);
|
||||
#endif // wxUSE_LISTBOX
|
||||
|
||||
wxWindow *m_window;
|
||||
wxRenderer *m_renderer;
|
||||
wxDC& m_dc;
|
||||
wxRect m_rect;
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_RENDERER_H_
|
112
wxWidgets/include/wx/univ/scrarrow.h
Normal file
112
wxWidgets/include/wx/univ/scrarrow.h
Normal file
|
@ -0,0 +1,112 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/scrarrow.h
|
||||
// Purpose: wxScrollArrows class
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 22.01.01
|
||||
// RCS-ID: $Id: scrarrow.h 42715 2006-10-30 12:24:13Z VS $
|
||||
// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_SCRARROW_H_
|
||||
#define _WX_UNIV_SCRARROW_H_
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxScrollArrows is not a control but just a class containing the common
|
||||
// functionality of scroll arrows, whether part of scrollbars, spin ctrls or
|
||||
// anything else.
|
||||
//
|
||||
// To customize its behaviour, wxScrollArrows doesn't use any virtual methods
|
||||
// but instead a callback pointer to a wxControlWithArrows object which is used
|
||||
// for all control-dependent stuff. Thus, to use wxScrollArrows, you just need
|
||||
// to derive from the wxControlWithArrows interface and implement its methods.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxControlWithArrows;
|
||||
class WXDLLEXPORT wxDC;
|
||||
class WXDLLEXPORT wxMouseEvent;
|
||||
class WXDLLEXPORT wxRect;
|
||||
class WXDLLEXPORT wxRenderer;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxScrollArrows: an abstraction of scrollbar arrow
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxScrollArrows
|
||||
{
|
||||
public:
|
||||
enum Arrow
|
||||
{
|
||||
Arrow_None = -1,
|
||||
Arrow_First, // left or top
|
||||
Arrow_Second, // right or bottom
|
||||
Arrow_Max
|
||||
};
|
||||
|
||||
// ctor requires a back pointer to wxControlWithArrows
|
||||
wxScrollArrows(wxControlWithArrows *control);
|
||||
|
||||
// draws the arrow on the given DC in the given rectangle, uses
|
||||
// wxControlWithArrows::GetArrowState() to get its current state
|
||||
void DrawArrow(Arrow arrow, wxDC& dc, const wxRect& rect,
|
||||
bool scrollbarLike = false) const;
|
||||
|
||||
// process a mouse move, enter or leave event, possibly calling
|
||||
// wxControlWithArrows::SetArrowState() if
|
||||
// wxControlWithArrows::HitTestArrow() says that the mouse has left/entered
|
||||
// an arrow
|
||||
bool HandleMouseMove(const wxMouseEvent& event) const;
|
||||
|
||||
// process a mouse click event
|
||||
bool HandleMouse(const wxMouseEvent& event) const;
|
||||
|
||||
// dtor
|
||||
~wxScrollArrows();
|
||||
|
||||
private:
|
||||
// set or clear the wxCONTROL_CURRENT flag for the arrow
|
||||
void UpdateCurrentFlag(Arrow arrow, Arrow arrowCur) const;
|
||||
|
||||
// the main control
|
||||
wxControlWithArrows *m_control;
|
||||
|
||||
// the data for the mouse capture
|
||||
struct wxScrollArrowCaptureData *m_captureData;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxControlWithArrows: interface implemented by controls using wxScrollArrows
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxControlWithArrows
|
||||
{
|
||||
public:
|
||||
virtual ~wxControlWithArrows() {}
|
||||
|
||||
// get the renderer to use for drawing the arrows
|
||||
virtual wxRenderer *GetRenderer() const = 0;
|
||||
|
||||
// get the controls window (used for mouse capturing)
|
||||
virtual wxWindow *GetWindow() = 0;
|
||||
|
||||
// get the orientation of the arrows (vertical or horizontal)
|
||||
virtual bool IsVertical() const = 0;
|
||||
|
||||
// get the state of this arrow as combination of wxCONTROL_XXX flags
|
||||
virtual int GetArrowState(wxScrollArrows::Arrow arrow) const = 0;
|
||||
|
||||
// set or clear the specified flag in the arrow state: this function is
|
||||
// responsible for refreshing the control
|
||||
virtual void SetArrowFlag(wxScrollArrows::Arrow arrow,
|
||||
int flag, bool set = true) = 0;
|
||||
|
||||
// hit testing: return on which arrow the point is (or Arrow_None)
|
||||
virtual wxScrollArrows::Arrow HitTestArrow(const wxPoint& pt) const = 0;
|
||||
|
||||
// called when the arrow is pressed, return true to continue scrolling and
|
||||
// false to stop it
|
||||
virtual bool OnArrow(wxScrollArrows::Arrow arrow) = 0;
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_SCRARROW_H_
|
283
wxWidgets/include/wx/univ/scrolbar.h
Normal file
283
wxWidgets/include/wx/univ/scrolbar.h
Normal file
|
@ -0,0 +1,283 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/scrolbar.h
|
||||
// Purpose: wxScrollBar for wxUniversal
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 20.08.00
|
||||
// RCS-ID: $Id: scrolbar.h 61872 2009-09-09 22:37:05Z VZ $
|
||||
// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_SCROLBAR_H_
|
||||
#define _WX_UNIV_SCROLBAR_H_
|
||||
|
||||
class WXDLLEXPORT wxScrollTimer;
|
||||
|
||||
#include "wx/univ/scrarrow.h"
|
||||
#include "wx/renderer.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// the actions supported by this control
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// scroll the bar
|
||||
#define wxACTION_SCROLL_START wxT("start") // to the beginning
|
||||
#define wxACTION_SCROLL_END wxT("end") // to the end
|
||||
#define wxACTION_SCROLL_LINE_UP wxT("lineup") // one line up/left
|
||||
#define wxACTION_SCROLL_PAGE_UP wxT("pageup") // one page up/left
|
||||
#define wxACTION_SCROLL_LINE_DOWN wxT("linedown") // one line down/right
|
||||
#define wxACTION_SCROLL_PAGE_DOWN wxT("pagedown") // one page down/right
|
||||
|
||||
// the scrollbar thumb may be dragged
|
||||
#define wxACTION_SCROLL_THUMB_DRAG wxT("thumbdrag")
|
||||
#define wxACTION_SCROLL_THUMB_MOVE wxT("thumbmove")
|
||||
#define wxACTION_SCROLL_THUMB_RELEASE wxT("thumbrelease")
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxScrollBar
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxScrollBar : public wxScrollBarBase,
|
||||
public wxControlWithArrows
|
||||
{
|
||||
public:
|
||||
// scrollbar elements: they correspond to wxHT_SCROLLBAR_XXX constants but
|
||||
// start from 0 which allows to use them as array indices
|
||||
enum Element
|
||||
{
|
||||
Element_Arrow_Line_1,
|
||||
Element_Arrow_Line_2,
|
||||
Element_Arrow_Page_1,
|
||||
Element_Arrow_Page_2,
|
||||
Element_Thumb,
|
||||
Element_Bar_1,
|
||||
Element_Bar_2,
|
||||
Element_Max
|
||||
};
|
||||
|
||||
wxScrollBar();
|
||||
wxScrollBar(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxSB_HORIZONTAL,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxScrollBarNameStr);
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxSB_HORIZONTAL,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxScrollBarNameStr);
|
||||
|
||||
virtual ~wxScrollBar();
|
||||
|
||||
// implement base class pure virtuals
|
||||
virtual int GetThumbPosition() const;
|
||||
virtual int GetThumbSize() const;
|
||||
virtual int GetPageSize() const;
|
||||
virtual int GetRange() const;
|
||||
|
||||
virtual void SetThumbPosition(int thumbPos);
|
||||
virtual void SetScrollbar(int position, int thumbSize,
|
||||
int range, int pageSize,
|
||||
bool refresh = true);
|
||||
|
||||
// wxScrollBar actions
|
||||
void ScrollToStart();
|
||||
void ScrollToEnd();
|
||||
bool ScrollLines(int nLines);
|
||||
bool ScrollPages(int nPages);
|
||||
|
||||
virtual bool PerformAction(const wxControlAction& action,
|
||||
long numArg = 0,
|
||||
const wxString& strArg = wxEmptyString);
|
||||
|
||||
static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef);
|
||||
virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef)
|
||||
{
|
||||
return GetStdInputHandler(handlerDef);
|
||||
}
|
||||
|
||||
// scrollbars around a normal window should not receive the focus
|
||||
virtual bool AcceptsFocus() const;
|
||||
|
||||
// wxScrollBar sub elements state (combination of wxCONTROL_XXX)
|
||||
void SetState(Element which, int flags);
|
||||
int GetState(Element which) const;
|
||||
|
||||
// implement wxControlWithArrows methods
|
||||
virtual wxRenderer *GetRenderer() const { return m_renderer; }
|
||||
virtual wxWindow *GetWindow() { return this; }
|
||||
virtual bool IsVertical() const { return wxScrollBarBase::IsVertical(); }
|
||||
virtual int GetArrowState(wxScrollArrows::Arrow arrow) const;
|
||||
virtual void SetArrowFlag(wxScrollArrows::Arrow arrow, int flag, bool set);
|
||||
virtual bool OnArrow(wxScrollArrows::Arrow arrow);
|
||||
virtual wxScrollArrows::Arrow HitTestArrow(const wxPoint& pt) const;
|
||||
|
||||
// for wxControlRenderer::DrawScrollbar() only
|
||||
const wxScrollArrows& GetArrows() const { return m_arrows; }
|
||||
|
||||
// returns one of wxHT_SCROLLBAR_XXX constants
|
||||
wxHitTest HitTestBar(const wxPoint& pt) const;
|
||||
|
||||
// idle processing
|
||||
virtual void OnInternalIdle();
|
||||
|
||||
protected:
|
||||
virtual wxSize DoGetBestClientSize() const;
|
||||
virtual void DoDraw(wxControlRenderer *renderer);
|
||||
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
|
||||
|
||||
// forces update of thumb's visual appearence (does nothing if m_dirty=false)
|
||||
void UpdateThumb();
|
||||
|
||||
// SetThumbPosition() helper
|
||||
void DoSetThumb(int thumbPos);
|
||||
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
// is this scrollbar attached to a window or a standalone control?
|
||||
bool IsStandalone() const;
|
||||
|
||||
// scrollbar geometry methods:
|
||||
|
||||
// gets the bounding box for a scrollbar element for the given (by default
|
||||
// - current) thumb position
|
||||
wxRect GetScrollbarRect(wxScrollBar::Element elem, int thumbPos = -1) const;
|
||||
|
||||
// returns the size of the scrollbar shaft excluding the arrows
|
||||
wxCoord GetScrollbarSize() const;
|
||||
|
||||
// translate the scrollbar position (in logical units) into physical
|
||||
// coordinate (in pixels) and the other way round
|
||||
wxCoord ScrollbarToPixel(int thumbPos = -1);
|
||||
int PixelToScrollbar(wxCoord coord);
|
||||
|
||||
// return the starting and ending positions, in pixels, of the thumb of a
|
||||
// scrollbar with the given logical position, thumb size and range and the
|
||||
// given physical length
|
||||
static void GetScrollBarThumbSize(wxCoord length,
|
||||
int thumbPos,
|
||||
int thumbSize,
|
||||
int range,
|
||||
wxCoord *thumbStart,
|
||||
wxCoord *thumbEnd);
|
||||
|
||||
private:
|
||||
// total range of the scrollbar in logical units
|
||||
int m_range;
|
||||
|
||||
// the current and previous (after last refresh - this is used for
|
||||
// repainting optimisation) size of the thumb in logical units (from 0 to
|
||||
// m_range) and its position (from 0 to m_range - m_thumbSize)
|
||||
int m_thumbSize,
|
||||
m_thumbPos,
|
||||
m_thumbPosOld;
|
||||
|
||||
// the page size, i.e. the number of lines by which to scroll when page
|
||||
// up/down action is performed
|
||||
int m_pageSize;
|
||||
|
||||
// the state of the sub elements
|
||||
int m_elementsState[Element_Max];
|
||||
|
||||
// the dirty flag: if set, scrollbar must be updated
|
||||
bool m_dirty;
|
||||
|
||||
// the object handling the arrows
|
||||
wxScrollArrows m_arrows;
|
||||
|
||||
friend WXDLLEXPORT class wxControlRenderer; // for geometry methods
|
||||
friend class wxStdScrollBarInputHandler; // for geometry methods
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxScrollBar)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Standard scrollbar input handler which can be used as a base class
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxStdScrollBarInputHandler : public wxStdInputHandler
|
||||
{
|
||||
public:
|
||||
// constructor takes a renderer (used for scrollbar hit testing) and the
|
||||
// base handler to which all unhandled events are forwarded
|
||||
wxStdScrollBarInputHandler(wxRenderer *renderer,
|
||||
wxInputHandler *inphand);
|
||||
|
||||
virtual bool HandleKey(wxInputConsumer *consumer,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed);
|
||||
virtual bool HandleMouse(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event);
|
||||
virtual bool HandleMouseMove(wxInputConsumer *consumer, const wxMouseEvent& event);
|
||||
|
||||
virtual ~wxStdScrollBarInputHandler();
|
||||
|
||||
// this method is called by wxScrollBarTimer only and may be overridden
|
||||
//
|
||||
// return true to continue scrolling, false to stop the timer
|
||||
virtual bool OnScrollTimer(wxScrollBar *scrollbar,
|
||||
const wxControlAction& action);
|
||||
|
||||
protected:
|
||||
// return true if the mouse button can be used to activate scrollbar, false
|
||||
// if not (any button under GTK+ unlike left button only which is default)
|
||||
virtual bool IsAllowedButton(int button) const
|
||||
{ return button == wxMOUSE_BTN_LEFT; }
|
||||
|
||||
// set or clear the specified flag on the scrollbar element corresponding
|
||||
// to m_htLast
|
||||
void SetElementState(wxScrollBar *scrollbar, int flag, bool doIt);
|
||||
|
||||
// [un]highlight the scrollbar element corresponding to m_htLast
|
||||
virtual void Highlight(wxScrollBar *scrollbar, bool doIt)
|
||||
{ SetElementState(scrollbar, wxCONTROL_CURRENT, doIt); }
|
||||
|
||||
// [un]press the scrollbar element corresponding to m_htLast
|
||||
virtual void Press(wxScrollBar *scrollbar, bool doIt)
|
||||
{ SetElementState(scrollbar, wxCONTROL_PRESSED, doIt); }
|
||||
|
||||
// stop scrolling because we reached the end point
|
||||
void StopScrolling(wxScrollBar *scrollbar);
|
||||
|
||||
// get the mouse coordinates in the scrollbar direction from the event
|
||||
wxCoord GetMouseCoord(const wxScrollBar *scrollbar,
|
||||
const wxMouseEvent& event) const;
|
||||
|
||||
// generate a "thumb move" action for this mouse event
|
||||
void HandleThumbMove(wxScrollBar *scrollbar, const wxMouseEvent& event);
|
||||
|
||||
|
||||
// the window (scrollbar) which has capture or NULL and the flag telling if
|
||||
// the mouse is inside the element which captured it or not
|
||||
wxWindow *m_winCapture;
|
||||
bool m_winHasMouse;
|
||||
int m_btnCapture; // the mouse button which has captured mouse
|
||||
|
||||
// the position where we started scrolling by page
|
||||
wxPoint m_ptStartScrolling;
|
||||
|
||||
// one of wxHT_SCROLLBAR_XXX value: where has the mouse been last time?
|
||||
wxHitTest m_htLast;
|
||||
|
||||
// the renderer (we use it only for hit testing)
|
||||
wxRenderer *m_renderer;
|
||||
|
||||
// the offset of the top/left of the scrollbar relative to the mouse to
|
||||
// keep during the thumb drag
|
||||
int m_ofsMouse;
|
||||
|
||||
// the timer for generating scroll events when the mouse stays pressed on
|
||||
// a scrollbar
|
||||
wxScrollTimer *m_timerScroll;
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_SCROLBAR_H_
|
||||
|
140
wxWidgets/include/wx/univ/scrthumb.h
Normal file
140
wxWidgets/include/wx/univ/scrthumb.h
Normal file
|
@ -0,0 +1,140 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/scrthumb.h
|
||||
// Purpose: wxScrollThumb class
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 12.02.01
|
||||
// RCS-ID: $Id: scrthumb.h 37168 2006-01-26 19:35:32Z ABX $
|
||||
// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_SCRTHUMB_H_
|
||||
#define _WX_UNIV_SCRTHUMB_H_
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxScrollThumb is not a control but just a class containing the common
|
||||
// functionality of scroll thumb such as used by scrollbars, sliders and maybe
|
||||
// other (user) controls
|
||||
//
|
||||
// This class is similar to wxScrollThumb.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxControlWithThumb;
|
||||
class WXDLLEXPORT wxMouseEvent;
|
||||
class WXDLLEXPORT wxRect;
|
||||
class WXDLLEXPORT wxScrollTimer;
|
||||
|
||||
#include "wx/timer.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxScrollThumb: an abstraction of scrollbar thumb
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxScrollThumb
|
||||
{
|
||||
public:
|
||||
enum Shaft
|
||||
{
|
||||
Shaft_None = -1,
|
||||
Shaft_Above, // or to the left of the thumb
|
||||
Shaft_Below, // or to the right of the thumb
|
||||
Shaft_Thumb, // on the thumb
|
||||
Shaft_Max
|
||||
};
|
||||
|
||||
// ctor requires a back pointer to wxControlWithThumb
|
||||
wxScrollThumb(wxControlWithThumb *control);
|
||||
|
||||
// process a mouse click: will capture the mouse if the button was pressed
|
||||
// on either the thumb (start dragging it then) or the shaft (start
|
||||
// scrolling)
|
||||
bool HandleMouse(const wxMouseEvent& event) const;
|
||||
|
||||
// process a mouse move
|
||||
bool HandleMouseMove(const wxMouseEvent& event) const;
|
||||
|
||||
// dtor
|
||||
~wxScrollThumb();
|
||||
|
||||
private:
|
||||
// do we have the mouse capture?
|
||||
bool HasCapture() const { return m_captureData != NULL; }
|
||||
|
||||
// get the coord of this event in the direction we're interested in (y for
|
||||
// vertical shaft or x for horizontal ones)
|
||||
wxCoord GetMouseCoord(const wxMouseEvent& event) const;
|
||||
|
||||
// get the position of the thumb corresponding to the current mouse
|
||||
// position (can only be called while we're dragging the thumb!)
|
||||
int GetThumbPos(const wxMouseEvent& event) const;
|
||||
|
||||
// the main control
|
||||
wxControlWithThumb *m_control;
|
||||
|
||||
// the part of it where the mouse currently is
|
||||
Shaft m_shaftPart;
|
||||
|
||||
// the data for the mouse capture
|
||||
struct WXDLLEXPORT wxScrollThumbCaptureData *m_captureData;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxControlWithThumb: interface implemented by controls using wxScrollThumb
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxControlWithThumb
|
||||
{
|
||||
public:
|
||||
virtual ~wxControlWithThumb() {}
|
||||
|
||||
// simple accessors
|
||||
// ----------------
|
||||
|
||||
// get the controls window (used for mouse capturing)
|
||||
virtual wxWindow *GetWindow() = 0;
|
||||
|
||||
// get the orientation of the shaft (vertical or horizontal)
|
||||
virtual bool IsVertical() const = 0;
|
||||
|
||||
// geometry functions
|
||||
// ------------------
|
||||
|
||||
// hit testing: return part of the shaft the point is in (or Shaft_None)
|
||||
virtual wxScrollThumb::Shaft HitTest(const wxPoint& pt) const = 0;
|
||||
|
||||
// get the current position in pixels of the thumb
|
||||
virtual wxCoord ThumbPosToPixel() const = 0;
|
||||
|
||||
// transform from pixel offset to the thumb logical position
|
||||
virtual int PixelToThumbPos(wxCoord x) const = 0;
|
||||
|
||||
// callbacks
|
||||
// ---------
|
||||
|
||||
// set or clear the specified flag in the arrow state: this function is
|
||||
// responsible for refreshing the control
|
||||
virtual void SetShaftPartState(wxScrollThumb::Shaft shaftPart,
|
||||
int flag,
|
||||
bool set = true) = 0;
|
||||
|
||||
// called when the user starts dragging the thumb
|
||||
virtual void OnThumbDragStart(int pos) = 0;
|
||||
|
||||
// called while the user drags the thumb
|
||||
virtual void OnThumbDrag(int pos) = 0;
|
||||
|
||||
// called when the user stops dragging the thumb
|
||||
virtual void OnThumbDragEnd(int pos) = 0;
|
||||
|
||||
// called before starting to call OnPageScroll() - gives the control the
|
||||
// possibility to remember its current state
|
||||
virtual void OnPageScrollStart() = 0;
|
||||
|
||||
// called while the user keeps the mouse pressed above/below the thumb,
|
||||
// return true to continue scrollign and false to stop it (e.g. because the
|
||||
// scrollbar has reached the top/bottom)
|
||||
virtual bool OnPageScroll(int pageInc) = 0;
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_SCRTHUMB_H_
|
51
wxWidgets/include/wx/univ/scrtimer.h
Normal file
51
wxWidgets/include/wx/univ/scrtimer.h
Normal file
|
@ -0,0 +1,51 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/scrtimer.h
|
||||
// Purpose: wxScrollTimer: small helper class for wxScrollArrow/Thumb
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 18.02.01
|
||||
// RCS-ID: $Id: scrtimer.h 39633 2006-06-08 11:25:30Z ABX $
|
||||
// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_SCRTIMER_H
|
||||
#define _WX_UNIV_SCRTIMER_H
|
||||
|
||||
// NB: this class is implemented in scrolbar.cpp
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_TIMER
|
||||
|
||||
#include "wx/timer.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxScrollTimer: the timer used when the arrow or scrollbar shaft is kept
|
||||
// pressed
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxScrollTimer : public wxTimer
|
||||
{
|
||||
public:
|
||||
// default ctor
|
||||
wxScrollTimer();
|
||||
|
||||
// start generating the events
|
||||
void StartAutoScroll();
|
||||
|
||||
// the base class method
|
||||
virtual void Notify();
|
||||
|
||||
protected:
|
||||
// to implement in derived classes: perform the scroll action and return
|
||||
// true to continue scrolling or false to stop
|
||||
virtual bool DoNotify() = 0;
|
||||
|
||||
// should we skip the next timer event?
|
||||
bool m_skipNext;
|
||||
};
|
||||
|
||||
#endif // wxUSE_TIMER
|
||||
|
||||
#endif // _WX_UNIV_SCRTIMER_H
|
1328
wxWidgets/include/wx/univ/setup.h
Normal file
1328
wxWidgets/include/wx/univ/setup.h
Normal file
File diff suppressed because it is too large
Load diff
1328
wxWidgets/include/wx/univ/setup0.h
Normal file
1328
wxWidgets/include/wx/univ/setup0.h
Normal file
File diff suppressed because it is too large
Load diff
226
wxWidgets/include/wx/univ/slider.h
Normal file
226
wxWidgets/include/wx/univ/slider.h
Normal file
|
@ -0,0 +1,226 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/slider.h
|
||||
// Purpose: wxSlider control for wxUniversal
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 09.02.01
|
||||
// RCS-ID: $Id: slider.h 61872 2009-09-09 22:37:05Z VZ $
|
||||
// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_SLIDER_H_
|
||||
#define _WX_UNIV_SLIDER_H_
|
||||
|
||||
#include "wx/univ/scrthumb.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// the actions supported by this control
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// our actions are the same as scrollbars
|
||||
|
||||
#define wxACTION_SLIDER_START wxT("start") // to the beginning
|
||||
#define wxACTION_SLIDER_END wxT("end") // to the end
|
||||
#define wxACTION_SLIDER_LINE_UP wxT("lineup") // one line up/left
|
||||
#define wxACTION_SLIDER_PAGE_UP wxT("pageup") // one page up/left
|
||||
#define wxACTION_SLIDER_LINE_DOWN wxT("linedown") // one line down/right
|
||||
#define wxACTION_SLIDER_PAGE_DOWN wxT("pagedown") // one page down/right
|
||||
#define wxACTION_SLIDER_PAGE_CHANGE wxT("pagechange")// change page by numArg
|
||||
|
||||
#define wxACTION_SLIDER_THUMB_DRAG wxT("thumbdrag")
|
||||
#define wxACTION_SLIDER_THUMB_MOVE wxT("thumbmove")
|
||||
#define wxACTION_SLIDER_THUMB_RELEASE wxT("thumbrelease")
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxSlider
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxSlider : public wxSliderBase,
|
||||
public wxControlWithThumb
|
||||
{
|
||||
public:
|
||||
// ctors and such
|
||||
wxSlider();
|
||||
|
||||
wxSlider(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
int value, int minValue, int maxValue,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxSL_HORIZONTAL,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxSliderNameStr);
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
int value, int minValue, int maxValue,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxSL_HORIZONTAL,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxSliderNameStr);
|
||||
|
||||
// implement base class pure virtuals
|
||||
virtual int GetValue() const;
|
||||
virtual void SetValue(int value);
|
||||
|
||||
virtual void SetRange(int minValue, int maxValue);
|
||||
virtual int GetMin() const;
|
||||
virtual int GetMax() const;
|
||||
|
||||
virtual void SetLineSize(int lineSize);
|
||||
virtual void SetPageSize(int pageSize);
|
||||
virtual int GetLineSize() const;
|
||||
virtual int GetPageSize() const;
|
||||
|
||||
virtual void SetThumbLength(int lenPixels);
|
||||
virtual int GetThumbLength() const;
|
||||
|
||||
virtual void SetTickFreq(int n, int WXUNUSED(dummy) = 0);
|
||||
virtual int GetTickFreq() const { return m_tickFreq; }
|
||||
|
||||
// wxUniv-specific methods
|
||||
// -----------------------
|
||||
|
||||
// is this a vertical slider?
|
||||
bool IsVert() const { return (GetWindowStyle() & wxSL_VERTICAL) != 0; }
|
||||
|
||||
// get the slider orientation
|
||||
wxOrientation GetOrientation() const
|
||||
{ return IsVert() ? wxVERTICAL : wxHORIZONTAL; }
|
||||
|
||||
// do we have labels?
|
||||
bool HasLabels() const
|
||||
{ return ((GetWindowStyle() & wxSL_LABELS) != 0) &&
|
||||
((GetWindowStyle() & (wxSL_TOP|wxSL_BOTTOM|wxSL_LEFT|wxSL_RIGHT)) != 0); }
|
||||
|
||||
// do we have ticks?
|
||||
bool HasTicks() const
|
||||
{ return ((GetWindowStyle() & wxSL_TICKS) != 0) &&
|
||||
((GetWindowStyle() & (wxSL_TOP|wxSL_BOTTOM|wxSL_LEFT|wxSL_RIGHT|wxSL_BOTH)) != 0); }
|
||||
|
||||
// implement wxControlWithThumb interface
|
||||
virtual wxWindow *GetWindow() { return this; }
|
||||
virtual bool IsVertical() const { return IsVert(); }
|
||||
|
||||
virtual wxScrollThumb::Shaft HitTest(const wxPoint& pt) const;
|
||||
virtual wxCoord ThumbPosToPixel() const;
|
||||
virtual int PixelToThumbPos(wxCoord x) const;
|
||||
|
||||
virtual void SetShaftPartState(wxScrollThumb::Shaft shaftPart,
|
||||
int flag,
|
||||
bool set = true);
|
||||
|
||||
virtual void OnThumbDragStart(int pos);
|
||||
virtual void OnThumbDrag(int pos);
|
||||
virtual void OnThumbDragEnd(int pos);
|
||||
virtual void OnPageScrollStart();
|
||||
virtual bool OnPageScroll(int pageInc);
|
||||
|
||||
// for wxStdSliderInputHandler
|
||||
wxScrollThumb& GetThumb() { return m_thumb; }
|
||||
|
||||
virtual bool PerformAction(const wxControlAction& action,
|
||||
long numArg = 0,
|
||||
const wxString& strArg = wxEmptyString);
|
||||
|
||||
static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef);
|
||||
virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef)
|
||||
{
|
||||
return GetStdInputHandler(handlerDef);
|
||||
}
|
||||
|
||||
protected:
|
||||
enum
|
||||
{
|
||||
INVALID_THUMB_VALUE = -0xffff
|
||||
};
|
||||
|
||||
// overridden base class virtuals
|
||||
virtual wxSize DoGetBestClientSize() const;
|
||||
virtual void DoDraw(wxControlRenderer *renderer);
|
||||
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
|
||||
|
||||
// event handlers
|
||||
void OnSize(wxSizeEvent& event);
|
||||
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
// normalize the value to fit in the range
|
||||
int NormalizeValue(int value) const;
|
||||
|
||||
// change the value by the given increment, return true if really changed
|
||||
bool ChangeValueBy(int inc);
|
||||
|
||||
// change the value to the given one
|
||||
bool ChangeValueTo(int value);
|
||||
|
||||
// is the value inside the range?
|
||||
bool IsInRange(int value) { return (value >= m_min) && (value <= m_max); }
|
||||
|
||||
// format the value for printing as label
|
||||
virtual wxString FormatValue(int value) const;
|
||||
|
||||
// calculate max label size
|
||||
wxSize CalcLabelSize() const;
|
||||
|
||||
// calculate m_rectLabel/Slider
|
||||
void CalcGeometry();
|
||||
|
||||
// get the thumb size
|
||||
wxSize GetThumbSize() const;
|
||||
|
||||
// get the shaft rect (uses m_rectSlider which is supposed to be calculated)
|
||||
wxRect GetShaftRect() const;
|
||||
|
||||
// calc the current thumb position using the shaft rect (if the pointer is
|
||||
// NULL, we calculate it here too)
|
||||
void CalcThumbRect(const wxRect *rectShaft,
|
||||
wxRect *rectThumbOut,
|
||||
wxRect *rectLabelOut,
|
||||
int value = INVALID_THUMB_VALUE) const;
|
||||
|
||||
// return the slider rect calculating it if needed
|
||||
const wxRect& GetSliderRect() const;
|
||||
|
||||
// refresh the current thumb position
|
||||
void RefreshThumb();
|
||||
|
||||
private:
|
||||
// get the default thumb size (without using m_thumbSize)
|
||||
wxSize GetDefaultThumbSize() const;
|
||||
|
||||
// the object which manages our thumb
|
||||
wxScrollThumb m_thumb;
|
||||
|
||||
// the slider range and value
|
||||
int m_min,
|
||||
m_max,
|
||||
m_value;
|
||||
|
||||
// the tick frequence (default is 1)
|
||||
int m_tickFreq;
|
||||
|
||||
// the line and page increments (logical units)
|
||||
int m_lineSize,
|
||||
m_pageSize;
|
||||
|
||||
// the size of the thumb (in pixels)
|
||||
int m_thumbSize;
|
||||
|
||||
// the part of the client area reserved for the label, the ticks and the
|
||||
// part for the slider itself
|
||||
wxRect m_rectLabel,
|
||||
m_rectTicks,
|
||||
m_rectSlider;
|
||||
|
||||
// the state of the thumb (wxCONTROL_XXX constants sum)
|
||||
int m_thumbFlags;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxSlider)
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_SLIDER_H_
|
122
wxWidgets/include/wx/univ/spinbutt.h
Normal file
122
wxWidgets/include/wx/univ/spinbutt.h
Normal file
|
@ -0,0 +1,122 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/spinbutt.h
|
||||
// Purpose: universal version of wxSpinButton
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 21.01.01
|
||||
// RCS-ID: $Id: spinbutt.h 61872 2009-09-09 22:37:05Z VZ $
|
||||
// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_SPINBUTT_H_
|
||||
#define _WX_UNIV_SPINBUTT_H_
|
||||
|
||||
#include "wx/univ/scrarrow.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxSpinButton
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// actions supported by this control
|
||||
#define wxACTION_SPIN_INC wxT("inc")
|
||||
#define wxACTION_SPIN_DEC wxT("dec")
|
||||
|
||||
class WXDLLEXPORT wxSpinButton : public wxSpinButtonBase,
|
||||
public wxControlWithArrows
|
||||
{
|
||||
public:
|
||||
wxSpinButton();
|
||||
wxSpinButton(wxWindow *parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxSP_VERTICAL | wxSP_ARROW_KEYS,
|
||||
const wxString& name = wxSPIN_BUTTON_NAME);
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxSP_VERTICAL | wxSP_ARROW_KEYS,
|
||||
const wxString& name = wxSPIN_BUTTON_NAME);
|
||||
|
||||
// implement wxSpinButtonBase methods
|
||||
virtual int GetValue() const;
|
||||
virtual void SetValue(int val);
|
||||
virtual void SetRange(int minVal, int maxVal);
|
||||
|
||||
// implement wxControlWithArrows methods
|
||||
virtual wxRenderer *GetRenderer() const { return m_renderer; }
|
||||
virtual wxWindow *GetWindow() { return this; }
|
||||
virtual bool IsVertical() const { return wxSpinButtonBase::IsVertical(); }
|
||||
virtual int GetArrowState(wxScrollArrows::Arrow arrow) const;
|
||||
virtual void SetArrowFlag(wxScrollArrows::Arrow arrow, int flag, bool set);
|
||||
virtual bool OnArrow(wxScrollArrows::Arrow arrow);
|
||||
virtual wxScrollArrows::Arrow HitTestArrow(const wxPoint& pt) const;
|
||||
|
||||
// for wxStdSpinButtonInputHandler
|
||||
const wxScrollArrows& GetArrows() { return m_arrows; }
|
||||
|
||||
virtual bool PerformAction(const wxControlAction& action,
|
||||
long numArg = 0,
|
||||
const wxString& strArg = wxEmptyString);
|
||||
|
||||
static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef);
|
||||
virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef)
|
||||
{
|
||||
return GetStdInputHandler(handlerDef);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual wxSize DoGetBestClientSize() const;
|
||||
virtual void DoDraw(wxControlRenderer *renderer);
|
||||
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
|
||||
|
||||
// the common part of all ctors
|
||||
void Init();
|
||||
|
||||
// normalize the value to fit into min..max range
|
||||
int NormalizeValue(int value) const;
|
||||
|
||||
// change the value by +1/-1 and send the event, return true if value was
|
||||
// changed
|
||||
bool ChangeValue(int inc);
|
||||
|
||||
// get the rectangles for our 2 arrows
|
||||
void CalcArrowRects(wxRect *rect1, wxRect *rect2) const;
|
||||
|
||||
// the current controls value
|
||||
int m_value;
|
||||
|
||||
private:
|
||||
// the object which manages our arrows
|
||||
wxScrollArrows m_arrows;
|
||||
|
||||
// the state (combination of wxCONTROL_XXX flags) of the arrows
|
||||
int m_arrowsState[wxScrollArrows::Arrow_Max];
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxSpinButton)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxStdSpinButtonInputHandler: manages clicks on them (use arrows like
|
||||
// wxStdScrollBarInputHandler) and processes keyboard events too
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxStdSpinButtonInputHandler : public wxStdInputHandler
|
||||
{
|
||||
public:
|
||||
wxStdSpinButtonInputHandler(wxInputHandler *inphand);
|
||||
|
||||
virtual bool HandleKey(wxInputConsumer *consumer,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed);
|
||||
virtual bool HandleMouse(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event);
|
||||
virtual bool HandleMouseMove(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event);
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_SPINBUTT_H_
|
||||
|
74
wxWidgets/include/wx/univ/statbmp.h
Normal file
74
wxWidgets/include/wx/univ/statbmp.h
Normal file
|
@ -0,0 +1,74 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/statbmp.h
|
||||
// Purpose: wxStaticBitmap class for wxUniversal
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 25.08.00
|
||||
// RCS-ID: $Id: statbmp.h 37393 2006-02-08 21:47:09Z VZ $
|
||||
// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_STATBMP_H_
|
||||
#define _WX_UNIV_STATBMP_H_
|
||||
|
||||
#include "wx/bitmap.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxStaticBitmap
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxStaticBitmap : public wxStaticBitmapBase
|
||||
{
|
||||
public:
|
||||
wxStaticBitmap()
|
||||
{
|
||||
}
|
||||
|
||||
wxStaticBitmap(wxWindow *parent,
|
||||
const wxBitmap& label,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0)
|
||||
{
|
||||
Create(parent, wxID_ANY, label, pos, size, style);
|
||||
}
|
||||
|
||||
wxStaticBitmap(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxBitmap& label,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxStaticBitmapNameStr)
|
||||
{
|
||||
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 = wxStaticBitmapNameStr);
|
||||
|
||||
virtual void SetBitmap(const wxBitmap& bitmap);
|
||||
virtual void SetIcon(const wxIcon& icon);
|
||||
virtual wxBitmap GetBitmap() const { return m_bitmap; }
|
||||
|
||||
wxIcon GetIcon() const;
|
||||
|
||||
virtual bool HasTransparentBackground() { return true; }
|
||||
|
||||
protected:
|
||||
virtual void DoDraw(wxControlRenderer *renderer);
|
||||
|
||||
private:
|
||||
// the bitmap which we show
|
||||
wxBitmap m_bitmap;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxStaticBitmap)
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_STATBMP_H_
|
65
wxWidgets/include/wx/univ/statbox.h
Normal file
65
wxWidgets/include/wx/univ/statbox.h
Normal file
|
@ -0,0 +1,65 @@
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/statbox.h
|
||||
// Purpose: wxStaticBox declaration
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 15.08.00
|
||||
// RCS-ID: $Id: statbox.h 37393 2006-02-08 21:47:09Z VZ $
|
||||
// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_STATBOX_H_
|
||||
#define _WX_UNIV_STATBOX_H_
|
||||
|
||||
class WXDLLEXPORT wxStaticBox : public wxStaticBoxBase
|
||||
{
|
||||
public:
|
||||
wxStaticBox() { }
|
||||
|
||||
wxStaticBox(wxWindow *parent,
|
||||
const wxString& label,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize)
|
||||
{
|
||||
Create(parent, wxID_ANY, label, pos, size);
|
||||
}
|
||||
|
||||
wxStaticBox(wxWindow *parent, wxWindowID id,
|
||||
const wxString& label,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxStaticBoxNameStr)
|
||||
{
|
||||
Create(parent, id, label, pos, size, style, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& label,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxStaticBoxNameStr);
|
||||
|
||||
// the origin of the static box is inside the border and under the label:
|
||||
// take account of this
|
||||
virtual wxPoint GetBoxAreaOrigin() const;
|
||||
|
||||
// returning true from here ensures that we act as a container window for
|
||||
// our children
|
||||
virtual bool IsStaticBox() const { return true; }
|
||||
|
||||
protected:
|
||||
// draw the control
|
||||
virtual void DoDraw(wxControlRenderer *renderer);
|
||||
|
||||
// get the size of the border
|
||||
wxRect GetBorderGeometry() const;
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxStaticBox)
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_STATBOX_H_
|
56
wxWidgets/include/wx/univ/statline.h
Normal file
56
wxWidgets/include/wx/univ/statline.h
Normal file
|
@ -0,0 +1,56 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/statline.h
|
||||
// Purpose: wxStaticLine class for wxUniversal
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 28.06.99
|
||||
// Version: $Id: statline.h 43874 2006-12-09 14:52:59Z VZ $
|
||||
// Copyright: (c) 1999 Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_STATLINE_H_
|
||||
#define _WX_UNIV_STATLINE_H_
|
||||
|
||||
class WXDLLEXPORT wxStaticLine : public wxStaticLineBase
|
||||
{
|
||||
public:
|
||||
// constructors and pseudo-constructors
|
||||
wxStaticLine() { }
|
||||
|
||||
wxStaticLine(wxWindow *parent,
|
||||
const wxPoint &pos,
|
||||
wxCoord length,
|
||||
long style = wxLI_HORIZONTAL)
|
||||
{
|
||||
Create(parent, wxID_ANY, pos,
|
||||
style & wxLI_VERTICAL ? wxSize(wxDefaultCoord, length)
|
||||
: wxSize(length, wxDefaultCoord),
|
||||
style);
|
||||
}
|
||||
|
||||
wxStaticLine(wxWindow *parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxPoint &pos = wxDefaultPosition,
|
||||
const wxSize &size = wxDefaultSize,
|
||||
long style = wxLI_HORIZONTAL,
|
||||
const wxString &name = wxStaticLineNameStr )
|
||||
{
|
||||
Create(parent, id, pos, size, style, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxPoint &pos = wxDefaultPosition,
|
||||
const wxSize &size = wxDefaultSize,
|
||||
long style = wxLI_HORIZONTAL,
|
||||
const wxString &name = wxStaticLineNameStr );
|
||||
|
||||
protected:
|
||||
virtual void DoDraw(wxControlRenderer *renderer);
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxStaticLine)
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_STATLINE_H_
|
||||
|
66
wxWidgets/include/wx/univ/stattext.h
Normal file
66
wxWidgets/include/wx/univ/stattext.h
Normal file
|
@ -0,0 +1,66 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/stattext.h
|
||||
// Purpose: wxStaticText
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 14.08.00
|
||||
// RCS-ID: $Id: stattext.h 35650 2005-09-23 12:56:45Z MR $
|
||||
// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_STATTEXT_H_
|
||||
#define _WX_UNIV_STATTEXT_H_
|
||||
|
||||
class WXDLLEXPORT wxStaticText : public wxStaticTextBase
|
||||
{
|
||||
public:
|
||||
wxStaticText() { }
|
||||
|
||||
// usual ctor
|
||||
wxStaticText(wxWindow *parent,
|
||||
const wxString& label,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize)
|
||||
{
|
||||
Create(parent, wxID_ANY, label, pos, size, 0, wxStaticTextNameStr);
|
||||
}
|
||||
|
||||
// full form
|
||||
wxStaticText(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& label,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString &name = wxStaticTextNameStr)
|
||||
{
|
||||
Create(parent, id, label, pos, size, style, name);
|
||||
}
|
||||
|
||||
// function ctor
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString &label,
|
||||
const wxPoint &pos = wxDefaultPosition,
|
||||
const wxSize &size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString &name = wxStaticTextNameStr);
|
||||
|
||||
// implementation only from now on
|
||||
|
||||
virtual void SetLabel(const wxString& label);
|
||||
|
||||
virtual bool IsFocused() const { return false; }
|
||||
|
||||
protected:
|
||||
// calculate the optimal size for the label
|
||||
virtual wxSize DoGetBestClientSize() const;
|
||||
|
||||
// draw the control
|
||||
virtual void DoDraw(wxControlRenderer *renderer);
|
||||
|
||||
DECLARE_ABSTRACT_CLASS(wxStaticText)
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_STATTEXT_H_
|
110
wxWidgets/include/wx/univ/statusbr.h
Normal file
110
wxWidgets/include/wx/univ/statusbr.h
Normal file
|
@ -0,0 +1,110 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/statusbr.h
|
||||
// Purpose: wxStatusBarUniv: wxStatusBar for wxUniversal declaration
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 14.10.01
|
||||
// RCS-ID: $Id: statusbr.h 37393 2006-02-08 21:47:09Z VZ $
|
||||
// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_STATUSBR_H_
|
||||
#define _WX_UNIV_STATUSBR_H_
|
||||
|
||||
#include "wx/univ/inpcons.h"
|
||||
#include "wx/arrstr.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxStatusBar: a window near the bottom of the frame used for status info
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxStatusBarUniv : public wxStatusBarBase,
|
||||
public wxInputConsumer
|
||||
{
|
||||
public:
|
||||
wxStatusBarUniv() { Init(); }
|
||||
|
||||
wxStatusBarUniv(wxWindow *parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
long style = 0,
|
||||
const wxString& name = wxPanelNameStr)
|
||||
{
|
||||
Init();
|
||||
|
||||
(void)Create(parent, id, style, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
long style = 0,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
|
||||
// set field count/widths
|
||||
virtual void SetFieldsCount(int number = 1, const int *widths = NULL);
|
||||
virtual void SetStatusWidths(int n, const int widths[]);
|
||||
|
||||
// get/set the text of the given field
|
||||
virtual void SetStatusText(const wxString& text, int number = 0);
|
||||
virtual wxString GetStatusText(int number = 0) const;
|
||||
|
||||
// Get the position and size of the field's internal bounding rectangle
|
||||
virtual bool GetFieldRect(int i, wxRect& rect) const;
|
||||
|
||||
// sets the minimal vertical size of the status bar
|
||||
virtual void SetMinHeight(int height);
|
||||
|
||||
// get the dimensions of the horizontal and vertical borders
|
||||
virtual int GetBorderX() const;
|
||||
virtual int GetBorderY() const;
|
||||
|
||||
// wxInputConsumer pure virtual
|
||||
virtual wxWindow *GetInputWindow() const
|
||||
{ return wx_const_cast(wxStatusBar*, this); }
|
||||
|
||||
protected:
|
||||
// recalculate the field widths
|
||||
void OnSize(wxSizeEvent& event);
|
||||
|
||||
// draw the statusbar
|
||||
virtual void DoDraw(wxControlRenderer *renderer);
|
||||
|
||||
// tell them about our preferred height
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
||||
// override DoSetSize() to prevent the status bar height from changing
|
||||
virtual void DoSetSize(int x, int y,
|
||||
int width, int height,
|
||||
int sizeFlags = wxSIZE_AUTO);
|
||||
|
||||
// get the (fixed) status bar height
|
||||
wxCoord GetHeight() const;
|
||||
|
||||
// get the rectangle containing all the fields and the border between them
|
||||
//
|
||||
// also updates m_widthsAbs if necessary
|
||||
wxRect GetTotalFieldRect(wxCoord *borderBetweenFields);
|
||||
|
||||
// get the rect for this field without ani side effects (see code)
|
||||
wxRect DoGetFieldRect(int n) const;
|
||||
|
||||
// refresh the given field
|
||||
void RefreshField(int i);
|
||||
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
private:
|
||||
// the status fields strings
|
||||
wxArrayString m_statusText;
|
||||
|
||||
// the absolute status fields widths
|
||||
wxArrayInt m_widthsAbs;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxStatusBarUniv)
|
||||
DECLARE_EVENT_TABLE()
|
||||
WX_DECLARE_INPUT_CONSUMER()
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_STATUSBR_H_
|
||||
|
352
wxWidgets/include/wx/univ/stdrend.h
Normal file
352
wxWidgets/include/wx/univ/stdrend.h
Normal file
|
@ -0,0 +1,352 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/stdrend.h
|
||||
// Purpose: wxStdRenderer class declaration
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 2006-09-18
|
||||
// RCS-ID: $Id: stdrend.h 42716 2006-10-30 12:33:25Z VS $
|
||||
// Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_STDREND_H_
|
||||
#define _WX_UNIV_STDREND_H_
|
||||
|
||||
#include "wx/univ/renderer.h"
|
||||
#include "wx/pen.h"
|
||||
|
||||
class WXDLLEXPORT wxColourScheme;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxStdRenderer: implements as much of wxRenderer API as possible generically
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class wxStdRenderer : public wxRenderer
|
||||
{
|
||||
public:
|
||||
// the renderer will use the given scheme, whose lifetime must be at least
|
||||
// as long as of this object itself, to choose the colours for drawing
|
||||
wxStdRenderer(const wxColourScheme *scheme);
|
||||
|
||||
virtual void DrawBackground(wxDC& dc,
|
||||
const wxColour& col,
|
||||
const wxRect& rect,
|
||||
int flags = 0,
|
||||
wxWindow *window = NULL);
|
||||
virtual void DrawButtonSurface(wxDC& dc,
|
||||
const wxColour& col,
|
||||
const wxRect& rect,
|
||||
int flags);
|
||||
|
||||
|
||||
virtual void DrawFocusRect(wxDC& dc, const wxRect& rect, int flags = 0);
|
||||
virtual void DrawLabel(wxDC& dc,
|
||||
const wxString& label,
|
||||
const wxRect& rect,
|
||||
int flags = 0,
|
||||
int alignment = wxALIGN_LEFT | wxALIGN_TOP,
|
||||
int indexAccel = -1,
|
||||
wxRect *rectBounds = NULL);
|
||||
virtual void DrawButtonLabel(wxDC& dc,
|
||||
const wxString& label,
|
||||
const wxBitmap& image,
|
||||
const wxRect& rect,
|
||||
int flags = 0,
|
||||
int alignment = wxALIGN_LEFT | wxALIGN_TOP,
|
||||
int indexAccel = -1,
|
||||
wxRect *rectBounds = NULL);
|
||||
|
||||
|
||||
virtual void DrawBorder(wxDC& dc,
|
||||
wxBorder border,
|
||||
const wxRect& rect,
|
||||
int flags = 0,
|
||||
wxRect *rectIn = NULL);
|
||||
virtual void DrawTextBorder(wxDC& dc,
|
||||
wxBorder border,
|
||||
const wxRect& rect,
|
||||
int flags = 0,
|
||||
wxRect *rectIn = NULL);
|
||||
|
||||
virtual void DrawHorizontalLine(wxDC& dc,
|
||||
wxCoord y, wxCoord x1, wxCoord x2);
|
||||
virtual void DrawVerticalLine(wxDC& dc,
|
||||
wxCoord x, wxCoord y1, wxCoord y2);
|
||||
virtual void DrawFrame(wxDC& dc,
|
||||
const wxString& label,
|
||||
const wxRect& rect,
|
||||
int flags = 0,
|
||||
int alignment = wxALIGN_LEFT,
|
||||
int indexAccel = -1);
|
||||
|
||||
|
||||
virtual void DrawItem(wxDC& dc,
|
||||
const wxString& label,
|
||||
const wxRect& rect,
|
||||
int flags = 0);
|
||||
virtual void DrawCheckItem(wxDC& dc,
|
||||
const wxString& label,
|
||||
const wxBitmap& bitmap,
|
||||
const wxRect& rect,
|
||||
int flags = 0);
|
||||
|
||||
virtual void DrawCheckButton(wxDC& dc,
|
||||
const wxString& label,
|
||||
const wxBitmap& bitmap,
|
||||
const wxRect& rect,
|
||||
int flags = 0,
|
||||
wxAlignment align = wxALIGN_LEFT,
|
||||
int indexAccel = -1);
|
||||
virtual void DrawRadioButton(wxDC& dc,
|
||||
const wxString& label,
|
||||
const wxBitmap& bitmap,
|
||||
const wxRect& rect,
|
||||
int flags = 0,
|
||||
wxAlignment align = wxALIGN_LEFT,
|
||||
int indexAccel = -1);
|
||||
|
||||
virtual void DrawScrollbarArrow(wxDC& dc,
|
||||
wxDirection dir,
|
||||
const wxRect& rect,
|
||||
int flags = 0);
|
||||
virtual void DrawScrollCorner(wxDC& dc,
|
||||
const wxRect& rect);
|
||||
|
||||
#if wxUSE_TEXTCTRL
|
||||
virtual void DrawTextLine(wxDC& dc,
|
||||
const wxString& text,
|
||||
const wxRect& rect,
|
||||
int selStart = -1,
|
||||
int selEnd = -1,
|
||||
int flags = 0);
|
||||
|
||||
virtual void DrawLineWrapMark(wxDC& dc, const wxRect& rect);
|
||||
|
||||
virtual wxRect GetTextTotalArea(const wxTextCtrl *text,
|
||||
const wxRect& rect) const;
|
||||
virtual wxRect GetTextClientArea(const wxTextCtrl *text,
|
||||
const wxRect& rect,
|
||||
wxCoord *extraSpaceBeyond) const;
|
||||
#endif // wxUSE_TEXTCTRL
|
||||
|
||||
virtual wxRect GetBorderDimensions(wxBorder border) const;
|
||||
|
||||
virtual bool AreScrollbarsInsideBorder() const;
|
||||
|
||||
virtual void AdjustSize(wxSize *size, const wxWindow *window);
|
||||
|
||||
virtual wxCoord GetListboxItemHeight(wxCoord fontHeight);
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
virtual void DrawStatusField(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
const wxString& label,
|
||||
int flags = 0, int style = 0);
|
||||
|
||||
virtual wxSize GetStatusBarBorders() const;
|
||||
|
||||
virtual wxCoord GetStatusBarBorderBetweenFields() const;
|
||||
|
||||
virtual wxSize GetStatusBarFieldMargins() const;
|
||||
#endif // wxUSE_STATUSBAR
|
||||
|
||||
virtual wxCoord GetCheckItemMargin() const { return 0; }
|
||||
|
||||
|
||||
virtual void DrawFrameTitleBar(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
const wxString& title,
|
||||
const wxIcon& icon,
|
||||
int flags,
|
||||
int specialButton = 0,
|
||||
int specialButtonFlag = 0);
|
||||
virtual void DrawFrameBorder(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
int flags);
|
||||
virtual void DrawFrameBackground(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
int flags);
|
||||
virtual void DrawFrameTitle(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
const wxString& title,
|
||||
int flags);
|
||||
virtual void DrawFrameIcon(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
const wxIcon& icon,
|
||||
int flags);
|
||||
virtual void DrawFrameButton(wxDC& dc,
|
||||
wxCoord x, wxCoord y,
|
||||
int button,
|
||||
int flags = 0);
|
||||
|
||||
virtual wxRect GetFrameClientArea(const wxRect& rect, int flags) const;
|
||||
|
||||
virtual wxSize GetFrameTotalSize(const wxSize& clientSize, int flags) const;
|
||||
|
||||
virtual wxSize GetFrameMinSize(int flags) const;
|
||||
|
||||
virtual wxSize GetFrameIconSize() const;
|
||||
|
||||
virtual int HitTestFrame(const wxRect& rect,
|
||||
const wxPoint& pt,
|
||||
int flags = 0) const;
|
||||
protected:
|
||||
// various constants
|
||||
enum ArrowDirection
|
||||
{
|
||||
Arrow_Left,
|
||||
Arrow_Right,
|
||||
Arrow_Up,
|
||||
Arrow_Down,
|
||||
Arrow_Max
|
||||
};
|
||||
|
||||
enum ArrowStyle
|
||||
{
|
||||
Arrow_Normal,
|
||||
Arrow_Disabled,
|
||||
Arrow_Pressed,
|
||||
Arrow_Inverted,
|
||||
Arrow_InvertedDisabled,
|
||||
Arrow_StateMax
|
||||
};
|
||||
|
||||
enum FrameButtonType
|
||||
{
|
||||
FrameButton_Close,
|
||||
FrameButton_Minimize,
|
||||
FrameButton_Maximize,
|
||||
FrameButton_Restore,
|
||||
FrameButton_Help,
|
||||
FrameButton_Max
|
||||
};
|
||||
|
||||
enum IndicatorType
|
||||
{
|
||||
IndicatorType_Check,
|
||||
IndicatorType_Radio,
|
||||
IndicatorType_MaxCtrl,
|
||||
IndicatorType_Menu = IndicatorType_MaxCtrl,
|
||||
IndicatorType_Max
|
||||
};
|
||||
|
||||
enum IndicatorState
|
||||
{
|
||||
IndicatorState_Normal,
|
||||
IndicatorState_Pressed, // this one is for check/radioboxes
|
||||
IndicatorState_Disabled,
|
||||
IndicatorState_MaxCtrl,
|
||||
|
||||
// the rest of the states are valid for menu items only
|
||||
IndicatorState_Selected = IndicatorState_Pressed,
|
||||
IndicatorState_SelectedDisabled = IndicatorState_MaxCtrl,
|
||||
IndicatorState_MaxMenu
|
||||
};
|
||||
|
||||
enum IndicatorStatus
|
||||
{
|
||||
IndicatorStatus_Checked,
|
||||
IndicatorStatus_Unchecked,
|
||||
IndicatorStatus_Undetermined,
|
||||
IndicatorStatus_Max
|
||||
};
|
||||
|
||||
// translate the appropriate bits in flags to the above enum elements
|
||||
static void GetIndicatorsFromFlags(int flags,
|
||||
IndicatorState& state,
|
||||
IndicatorStatus& status);
|
||||
|
||||
// translate wxDirection to ArrowDirection
|
||||
static ArrowDirection GetArrowDirection(wxDirection dir);
|
||||
|
||||
|
||||
// fill the rectangle with a brush of given colour (must be valid)
|
||||
void DrawSolidRect(wxDC& dc, const wxColour& col, const wxRect& rect);
|
||||
|
||||
|
||||
// all the functions in this section adjust the rect parameter to
|
||||
// correspond to the interiour of the drawn area
|
||||
|
||||
// draw complete rectangle
|
||||
void DrawRect(wxDC& dc, wxRect *rect, const wxPen& pen);
|
||||
|
||||
// draw the rectange using the first pen for the left and top sides
|
||||
// and the second one for the bottom and right ones
|
||||
void DrawShadedRect(wxDC& dc, wxRect *rect,
|
||||
const wxPen& pen1, const wxPen& pen2);
|
||||
|
||||
// border drawing routines, may be overridden in the derived class
|
||||
virtual void DrawRaisedBorder(wxDC& dc, wxRect *rect);
|
||||
virtual void DrawSunkenBorder(wxDC& dc, wxRect *rect);
|
||||
virtual void DrawAntiSunkenBorder(wxDC& dc, wxRect *rect);
|
||||
virtual void DrawBoxBorder(wxDC& dc, wxRect *rect);
|
||||
virtual void DrawStaticBorder(wxDC& dc, wxRect *rect);
|
||||
virtual void DrawExtraBorder(wxDC& dc, wxRect *rect);
|
||||
|
||||
|
||||
// draw the frame with non-empty label inside the given rectText
|
||||
virtual void DrawFrameWithLabel(wxDC& dc,
|
||||
const wxString& label,
|
||||
const wxRect& rectFrame,
|
||||
const wxRect& rectText,
|
||||
int flags,
|
||||
int alignment,
|
||||
int indexAccel);
|
||||
|
||||
// draw the (static box) frame without the part corresponding to rectLabel
|
||||
void DrawFrameWithoutLabel(wxDC& dc,
|
||||
const wxRect& rectFrame,
|
||||
const wxRect& rectLabel);
|
||||
|
||||
|
||||
// draw the bitmap for a check item (which is by default the same as check
|
||||
// box one but may be different)
|
||||
virtual void DrawCheckItemBitmap(wxDC& dc,
|
||||
const wxBitmap& bitmap,
|
||||
const wxRect& rect,
|
||||
int flags);
|
||||
|
||||
// common routine for drawing check and radio buttons
|
||||
void DrawCheckOrRadioButton(wxDC& dc,
|
||||
const wxString& label,
|
||||
const wxBitmap& bitmap,
|
||||
const wxRect& rect,
|
||||
int flags,
|
||||
wxAlignment align,
|
||||
int indexAccel);
|
||||
|
||||
// return the check/radio bitmap for the given flags
|
||||
virtual wxBitmap GetRadioBitmap(int flags) = 0;
|
||||
virtual wxBitmap GetCheckBitmap(int flags) = 0;
|
||||
|
||||
// return the frame icon bitmap
|
||||
virtual wxBitmap GetFrameButtonBitmap(FrameButtonType type) = 0;
|
||||
|
||||
// get the width of either normal or resizeable frame border depending on
|
||||
// whether flags contains wxTOPLEVEL_RESIZEABLE bit
|
||||
//
|
||||
// notice that these methods only make sense with standard border drawing
|
||||
// code which uses the borders of the same width on all sides, this is why
|
||||
// they are only present here and not in wxRenderer itself
|
||||
virtual int GetFrameBorderWidth(int flags) const;
|
||||
|
||||
#if wxUSE_TEXTCTRL
|
||||
// return the width of the border around the text area in the text control
|
||||
virtual int GetTextBorderWidth(const wxTextCtrl *text) const;
|
||||
#endif // wxUSE_TEXTCTRL
|
||||
|
||||
// GDI objects we often use
|
||||
wxPen m_penBlack,
|
||||
m_penDarkGrey,
|
||||
m_penLightGrey,
|
||||
m_penHighlight;
|
||||
|
||||
wxFont m_titlebarFont;
|
||||
|
||||
// the colours we use, they never change currently so we don't have to ever
|
||||
// update m_penXXX objects above
|
||||
const wxColourScheme * const m_scheme;
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxStdRenderer)
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_STDREND_H_
|
534
wxWidgets/include/wx/univ/textctrl.h
Normal file
534
wxWidgets/include/wx/univ/textctrl.h
Normal file
|
@ -0,0 +1,534 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/textctrl.h
|
||||
// Purpose: wxTextCtrl class
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 15.09.00
|
||||
// RCS-ID: $Id: textctrl.h 61872 2009-09-09 22:37:05Z VZ $
|
||||
// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_TEXTCTRL_H_
|
||||
#define _WX_UNIV_TEXTCTRL_H_
|
||||
|
||||
class WXDLLEXPORT wxCaret;
|
||||
class WXDLLEXPORT wxTextCtrlCommandProcessor;
|
||||
|
||||
#include "wx/scrolwin.h" // for wxScrollHelper
|
||||
|
||||
#include "wx/univ/inphand.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxTextCtrl actions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// cursor movement and also selection and delete operations
|
||||
#define wxACTION_TEXT_GOTO wxT("goto") // to pos in numArg
|
||||
#define wxACTION_TEXT_FIRST wxT("first") // go to pos 0
|
||||
#define wxACTION_TEXT_LAST wxT("last") // go to last pos
|
||||
#define wxACTION_TEXT_HOME wxT("home")
|
||||
#define wxACTION_TEXT_END wxT("end")
|
||||
#define wxACTION_TEXT_LEFT wxT("left")
|
||||
#define wxACTION_TEXT_RIGHT wxT("right")
|
||||
#define wxACTION_TEXT_UP wxT("up")
|
||||
#define wxACTION_TEXT_DOWN wxT("down")
|
||||
#define wxACTION_TEXT_WORD_LEFT wxT("wordleft")
|
||||
#define wxACTION_TEXT_WORD_RIGHT wxT("wordright")
|
||||
#define wxACTION_TEXT_PAGE_UP wxT("pageup")
|
||||
#define wxACTION_TEXT_PAGE_DOWN wxT("pagedown")
|
||||
|
||||
// clipboard operations
|
||||
#define wxACTION_TEXT_COPY wxT("copy")
|
||||
#define wxACTION_TEXT_CUT wxT("cut")
|
||||
#define wxACTION_TEXT_PASTE wxT("paste")
|
||||
|
||||
// insert text at the cursor position: the text is in strArg of PerformAction
|
||||
#define wxACTION_TEXT_INSERT wxT("insert")
|
||||
|
||||
// if the action starts with either of these prefixes and the rest of the
|
||||
// string is one of the movement commands, it means to select/delete text from
|
||||
// the current cursor position to the new one
|
||||
#define wxACTION_TEXT_PREFIX_SEL wxT("sel")
|
||||
#define wxACTION_TEXT_PREFIX_DEL wxT("del")
|
||||
|
||||
// mouse selection
|
||||
#define wxACTION_TEXT_ANCHOR_SEL wxT("anchorsel")
|
||||
#define wxACTION_TEXT_EXTEND_SEL wxT("extendsel")
|
||||
#define wxACTION_TEXT_SEL_WORD wxT("wordsel")
|
||||
#define wxACTION_TEXT_SEL_LINE wxT("linesel")
|
||||
|
||||
// undo or redo
|
||||
#define wxACTION_TEXT_UNDO wxT("undo")
|
||||
#define wxACTION_TEXT_REDO wxT("redo")
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxTextCtrl
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxTextCtrl : public wxTextCtrlBase,
|
||||
public wxScrollHelper
|
||||
{
|
||||
public:
|
||||
// creation
|
||||
// --------
|
||||
|
||||
wxTextCtrl() : wxScrollHelper(this) { Init(); }
|
||||
|
||||
wxTextCtrl(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& value = wxEmptyString,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxTextCtrlNameStr)
|
||||
: wxScrollHelper(this)
|
||||
{
|
||||
Init();
|
||||
|
||||
Create(parent, id, value, pos, size, style, validator, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& value = wxEmptyString,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxTextCtrlNameStr);
|
||||
|
||||
virtual ~wxTextCtrl();
|
||||
|
||||
// implement base class pure virtuals
|
||||
// ----------------------------------
|
||||
|
||||
virtual wxString GetValue() const;
|
||||
|
||||
virtual int GetLineLength(wxTextCoord lineNo) const;
|
||||
virtual wxString GetLineText(wxTextCoord lineNo) const;
|
||||
virtual int GetNumberOfLines() const;
|
||||
|
||||
virtual bool IsModified() const;
|
||||
virtual bool IsEditable() const;
|
||||
|
||||
// If the return values from and to are the same, there is no selection.
|
||||
virtual void GetSelection(wxTextPos* from, wxTextPos* to) const;
|
||||
|
||||
// operations
|
||||
// ----------
|
||||
|
||||
// editing
|
||||
virtual void Clear();
|
||||
virtual void Replace(wxTextPos from, wxTextPos to, const wxString& value);
|
||||
virtual void Remove(wxTextPos from, wxTextPos to);
|
||||
|
||||
// sets/clears the dirty flag
|
||||
virtual void MarkDirty();
|
||||
virtual void DiscardEdits();
|
||||
|
||||
// writing text inserts it at the current position, appending always
|
||||
// inserts it at the end
|
||||
virtual void WriteText(const wxString& text);
|
||||
virtual void AppendText(const wxString& text);
|
||||
|
||||
// translate between the position (which is just an index in the text ctrl
|
||||
// considering all its contents as a single strings) and (x, y) coordinates
|
||||
// which represent (logical, i.e. unwrapped) column and line.
|
||||
virtual wxTextPos XYToPosition(wxTextCoord x, wxTextCoord y) const;
|
||||
virtual bool PositionToXY(wxTextPos pos,
|
||||
wxTextCoord *x, wxTextCoord *y) const;
|
||||
|
||||
// wxUniv-specific: find a screen position (in client coordinates) of the
|
||||
// given text position or of the caret
|
||||
bool PositionToLogicalXY(wxTextPos pos, wxCoord *x, wxCoord *y) const;
|
||||
bool PositionToDeviceXY(wxTextPos pos, wxCoord *x, wxCoord *y) const;
|
||||
wxPoint GetCaretPosition() const;
|
||||
|
||||
virtual void ShowPosition(wxTextPos pos);
|
||||
|
||||
// Clipboard operations
|
||||
virtual void Copy();
|
||||
virtual void Cut();
|
||||
virtual void Paste();
|
||||
|
||||
// Undo/redo
|
||||
virtual void Undo();
|
||||
virtual void Redo();
|
||||
|
||||
virtual bool CanUndo() const;
|
||||
virtual bool CanRedo() const;
|
||||
|
||||
// Insertion point
|
||||
virtual void SetInsertionPoint(wxTextPos pos);
|
||||
virtual void SetInsertionPointEnd();
|
||||
virtual wxTextPos GetInsertionPoint() const;
|
||||
virtual wxTextPos GetLastPosition() const;
|
||||
|
||||
virtual void SetSelection(wxTextPos from, wxTextPos to);
|
||||
virtual void SetEditable(bool editable);
|
||||
|
||||
// wxUniv-specific methods
|
||||
// -----------------------
|
||||
|
||||
// caret stuff
|
||||
virtual void ShowCaret(bool show = true);
|
||||
void HideCaret() { ShowCaret(false); }
|
||||
void CreateCaret(); // for the current font size
|
||||
|
||||
// helpers for cursor movement
|
||||
wxTextPos GetWordStart() const;
|
||||
wxTextPos GetWordEnd() const;
|
||||
|
||||
// selection helpers
|
||||
bool HasSelection() const
|
||||
{ return m_selStart != -1 && m_selEnd > m_selStart; }
|
||||
void ClearSelection();
|
||||
void RemoveSelection();
|
||||
wxString GetSelectionText() const;
|
||||
|
||||
virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const;
|
||||
virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt,
|
||||
wxTextCoord *col,
|
||||
wxTextCoord *row) const;
|
||||
|
||||
// find the character at this position in the given line, return value as
|
||||
// for HitTest()
|
||||
//
|
||||
// NB: x is the logical coord (client and unscrolled)
|
||||
wxTextCtrlHitTestResult HitTestLine(const wxString& line,
|
||||
wxCoord x,
|
||||
wxTextCoord *colOut) const;
|
||||
|
||||
// bring the given position into view
|
||||
void ShowHorzPosition(wxCoord pos);
|
||||
|
||||
// scroll the window horizontally so that the first character shown is in
|
||||
// position pos
|
||||
void ScrollText(wxTextCoord col);
|
||||
|
||||
// adjust the DC for horz text control scrolling too
|
||||
virtual void DoPrepareDC(wxDC& dc);
|
||||
|
||||
// implementation only from now on
|
||||
// -------------------------------
|
||||
|
||||
// override this to take into account our scrollbar-less scrolling
|
||||
virtual void CalcUnscrolledPosition(int x, int y, int *xx, int *yy) const;
|
||||
virtual void CalcScrolledPosition(int x, int y, int *xx, int *yy) const;
|
||||
|
||||
// perform an action
|
||||
virtual bool PerformAction(const wxControlAction& action,
|
||||
long numArg = -1,
|
||||
const wxString& strArg = wxEmptyString);
|
||||
|
||||
static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef);
|
||||
virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef)
|
||||
{
|
||||
return GetStdInputHandler(handlerDef);
|
||||
}
|
||||
|
||||
// override these methods to handle the caret
|
||||
virtual bool SetFont(const wxFont &font);
|
||||
virtual bool Enable(bool enable = true);
|
||||
|
||||
// more readable flag testing methods
|
||||
bool IsPassword() const { return HasFlag(wxTE_PASSWORD); }
|
||||
bool WrapLines() const { return m_wrapLines; }
|
||||
|
||||
// only for wxStdTextCtrlInputHandler
|
||||
void RefreshSelection();
|
||||
|
||||
// override wxScrollHelper method to prevent (auto)scrolling beyond the end
|
||||
// of line
|
||||
virtual bool SendAutoScrollEvents(wxScrollWinEvent& event) const;
|
||||
|
||||
// idle processing
|
||||
virtual void OnInternalIdle();
|
||||
|
||||
protected:
|
||||
// ensure we have correct default border
|
||||
virtual wxBorder GetDefaultBorder() const { return wxBORDER_SUNKEN; }
|
||||
|
||||
// override base class methods
|
||||
virtual void DoDrawBorder(wxDC& dc, const wxRect& rect);
|
||||
virtual void DoDraw(wxControlRenderer *renderer);
|
||||
|
||||
// calc the size from the text extent
|
||||
virtual wxSize DoGetBestClientSize() const;
|
||||
|
||||
// implements Set/ChangeValue()
|
||||
virtual void DoSetValue(const wxString& value, int flags = 0);
|
||||
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
// drawing
|
||||
// -------
|
||||
|
||||
// draw the text in the given rectangle
|
||||
void DoDrawTextInRect(wxDC& dc, const wxRect& rectUpdate);
|
||||
|
||||
// draw the line wrap marks in this rect
|
||||
void DoDrawLineWrapMarks(wxDC& dc, const wxRect& rectUpdate);
|
||||
|
||||
// line/row geometry calculations
|
||||
// ------------------------------
|
||||
|
||||
// get the extent (width) of the text
|
||||
wxCoord GetTextWidth(const wxString& text) const;
|
||||
|
||||
// get the logical text width (accounting for scrolling)
|
||||
wxCoord GetTotalWidth() const;
|
||||
|
||||
// get total number of rows (different from number of lines if the lines
|
||||
// can be wrapped)
|
||||
wxTextCoord GetRowCount() const;
|
||||
|
||||
// find the number of rows in this line (only if WrapLines())
|
||||
wxTextCoord GetRowsPerLine(wxTextCoord line) const;
|
||||
|
||||
// get the starting row of the given line
|
||||
wxTextCoord GetFirstRowOfLine(wxTextCoord line) const;
|
||||
|
||||
// get the row following this line
|
||||
wxTextCoord GetRowAfterLine(wxTextCoord line) const;
|
||||
|
||||
// refresh functions
|
||||
// -----------------
|
||||
|
||||
// the text area is the part of the window in which the text can be
|
||||
// displayed, i.e. part of it inside the margins and the real text area is
|
||||
// the area in which the text *is* currently displayed: for example, in the
|
||||
// multiline control case the text area can have extra space at the bottom
|
||||
// which is not tall enough for another line and which is then not included
|
||||
// into the real text area
|
||||
wxRect GetRealTextArea() const;
|
||||
|
||||
// refresh the text in the given (in logical coords) rect
|
||||
void RefreshTextRect(const wxRect& rect, bool textOnly = true);
|
||||
|
||||
// refresh the line wrap marks for the given range of lines (inclusive)
|
||||
void RefreshLineWrapMarks(wxTextCoord rowFirst, wxTextCoord rowLast);
|
||||
|
||||
// refresh the text in the given range (in logical coords) of this line, if
|
||||
// width is 0, refresh to the end of line
|
||||
void RefreshPixelRange(wxTextCoord line, wxCoord start, wxCoord width);
|
||||
|
||||
// refresh the text in the given range (in text coords) in this line
|
||||
void RefreshColRange(wxTextCoord line, wxTextPos start, size_t count);
|
||||
|
||||
// refresh the text from in the given line range (inclusive)
|
||||
void RefreshLineRange(wxTextCoord lineFirst, wxTextCoord lineLast);
|
||||
|
||||
// refresh the text in the given range which can span multiple lines
|
||||
// (this method accepts arguments in any order)
|
||||
void RefreshTextRange(wxTextPos start, wxTextPos end);
|
||||
|
||||
// get the text to show: either the text itself or the text replaced with
|
||||
// starts for wxTE_PASSWORD control
|
||||
wxString GetTextToShow(const wxString& text) const;
|
||||
|
||||
// find the row in this line where the given position (counted from the
|
||||
// start of line) is
|
||||
wxTextCoord GetRowInLine(wxTextCoord line,
|
||||
wxTextCoord col,
|
||||
wxTextCoord *colRowStart = NULL) const;
|
||||
|
||||
// find the number of characters of a line before it wraps
|
||||
// (and optionally also the real width of the line)
|
||||
size_t GetPartOfWrappedLine(const wxChar* text,
|
||||
wxCoord *widthReal = NULL) const;
|
||||
|
||||
// get the start and end of the selection for this line: if the line is
|
||||
// outside the selection, both will be -1 and false will be returned
|
||||
bool GetSelectedPartOfLine(wxTextCoord line,
|
||||
wxTextPos *start, wxTextPos *end) const;
|
||||
|
||||
// update the text rect: the zone inside our client rect (its coords are
|
||||
// client coords) which contains the text
|
||||
void UpdateTextRect();
|
||||
|
||||
// calculate the last visible position
|
||||
void UpdateLastVisible();
|
||||
|
||||
// move caret to the given position unconditionally
|
||||
// (SetInsertionPoint() does nothing if the position didn't change)
|
||||
void DoSetInsertionPoint(wxTextPos pos);
|
||||
|
||||
// move caret to the new position without updating the display (for
|
||||
// internal use only)
|
||||
void MoveInsertionPoint(wxTextPos pos);
|
||||
|
||||
// set the caret to its initial (default) position
|
||||
void InitInsertionPoint();
|
||||
|
||||
// get the width of the longest line in pixels
|
||||
wxCoord GetMaxWidth() const;
|
||||
|
||||
// force recalculation of the max line width
|
||||
void RecalcMaxWidth();
|
||||
|
||||
// update the max width after the given line was modified
|
||||
void UpdateMaxWidth(wxTextCoord line);
|
||||
|
||||
// hit testing
|
||||
// -----------
|
||||
|
||||
// HitTest2() is more efficient than 2 consecutive HitTest()s with the same
|
||||
// line (i.e. y) and it also returns the offset of the starting position in
|
||||
// pixels
|
||||
//
|
||||
// as the last hack, this function accepts either logical or device (by
|
||||
// default) coords depending on devCoords flag
|
||||
wxTextCtrlHitTestResult HitTest2(wxCoord y,
|
||||
wxCoord x1,
|
||||
wxCoord x2,
|
||||
wxTextCoord *row,
|
||||
wxTextCoord *colStart,
|
||||
wxTextCoord *colEnd,
|
||||
wxTextCoord *colRowStart,
|
||||
bool devCoords = true) const;
|
||||
|
||||
// HitTest() version which takes the logical text coordinates and not the
|
||||
// device ones
|
||||
wxTextCtrlHitTestResult HitTestLogical(const wxPoint& pos,
|
||||
wxTextCoord *col,
|
||||
wxTextCoord *row) const;
|
||||
|
||||
// get the line and the row in this line corresponding to the given row,
|
||||
// return true if ok and false if row is out of range
|
||||
//
|
||||
// NB: this function can only be called for controls which wrap lines
|
||||
bool GetLineAndRow(wxTextCoord row,
|
||||
wxTextCoord *line,
|
||||
wxTextCoord *rowInLine) const;
|
||||
|
||||
// get the height of one line (the same for all lines)
|
||||
wxCoord GetLineHeight() const
|
||||
{
|
||||
// this one should be already precalculated
|
||||
wxASSERT_MSG( m_heightLine != -1, wxT("should have line height") );
|
||||
|
||||
return m_heightLine;
|
||||
}
|
||||
|
||||
// get the average char width
|
||||
wxCoord GetAverageWidth() const { return m_widthAvg; }
|
||||
|
||||
// recalc the line height and char width (to call when the font changes)
|
||||
void RecalcFontMetrics();
|
||||
|
||||
// vertical scrolling helpers
|
||||
// --------------------------
|
||||
|
||||
// all these functions are for multi line controls only
|
||||
|
||||
// get the number of visible lines
|
||||
size_t GetLinesPerPage() const;
|
||||
|
||||
// return the position above the cursor or INVALID_POS_VALUE
|
||||
wxTextPos GetPositionAbove();
|
||||
|
||||
// return the position below the cursor or INVALID_POS_VALUE
|
||||
wxTextPos GetPositionBelow();
|
||||
|
||||
// event handlers
|
||||
// --------------
|
||||
void OnChar(wxKeyEvent& event);
|
||||
void OnSize(wxSizeEvent& event);
|
||||
|
||||
// return the struct containing control-type dependent data
|
||||
struct wxTextSingleLineData& SData() { return *m_data.sdata; }
|
||||
struct wxTextMultiLineData& MData() { return *m_data.mdata; }
|
||||
struct wxTextWrappedData& WData() { return *m_data.wdata; }
|
||||
const wxTextSingleLineData& SData() const { return *m_data.sdata; }
|
||||
const wxTextMultiLineData& MData() const { return *m_data.mdata; }
|
||||
const wxTextWrappedData& WData() const { return *m_data.wdata; }
|
||||
|
||||
// clipboard operations (unlike the versions without Do prefix, they have a
|
||||
// return code)
|
||||
bool DoCut();
|
||||
bool DoPaste();
|
||||
|
||||
private:
|
||||
// all these methods are for multiline text controls only
|
||||
|
||||
// update the scrollbars (only called from OnIdle)
|
||||
void UpdateScrollbars();
|
||||
|
||||
// get read only access to the lines of multiline control
|
||||
inline const wxArrayString& GetLines() const;
|
||||
inline size_t GetLineCount() const;
|
||||
|
||||
// replace a line (returns true if the number of rows in thel ine changed)
|
||||
bool ReplaceLine(wxTextCoord line, const wxString& text);
|
||||
|
||||
// remove a line
|
||||
void RemoveLine(wxTextCoord line);
|
||||
|
||||
// insert a line at this position
|
||||
void InsertLine(wxTextCoord line, const wxString& text);
|
||||
|
||||
// calculate geometry of this line
|
||||
void LayoutLine(wxTextCoord line, class wxWrappedLineData& lineData) const;
|
||||
|
||||
// calculate geometry of all lines until the given one
|
||||
void LayoutLines(wxTextCoord lineLast) const;
|
||||
|
||||
// the initially specified control size
|
||||
wxSize m_sizeInitial;
|
||||
|
||||
// the global control text
|
||||
wxString m_value;
|
||||
|
||||
// current position
|
||||
wxTextPos m_curPos;
|
||||
wxTextCoord m_curCol,
|
||||
m_curRow;
|
||||
|
||||
// last position (only used by GetLastPosition())
|
||||
wxTextPos m_posLast;
|
||||
|
||||
// selection
|
||||
wxTextPos m_selAnchor,
|
||||
m_selStart,
|
||||
m_selEnd;
|
||||
|
||||
// flags
|
||||
bool m_isModified:1,
|
||||
m_isEditable:1,
|
||||
m_hasCaret:1,
|
||||
m_wrapLines:1; // can't be changed after creation
|
||||
|
||||
// the rectangle (in client coordinates) to draw text inside
|
||||
wxRect m_rectText;
|
||||
|
||||
// the height of one line (cached value of GetCharHeight)
|
||||
wxCoord m_heightLine;
|
||||
|
||||
// and the average char width (cached value of GetCharWidth)
|
||||
wxCoord m_widthAvg;
|
||||
|
||||
// we have some data which depends on the kind of control (single or multi
|
||||
// line)
|
||||
union
|
||||
{
|
||||
wxTextSingleLineData *sdata;
|
||||
wxTextMultiLineData *mdata;
|
||||
wxTextWrappedData *wdata;
|
||||
void *data;
|
||||
} m_data;
|
||||
|
||||
// the object to which we delegate our undo/redo implementation
|
||||
wxTextCtrlCommandProcessor *m_cmdProcessor;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxTextCtrl)
|
||||
|
||||
friend class wxWrappedLineData;
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_TEXTCTRL_H_
|
||||
|
70
wxWidgets/include/wx/univ/tglbtn.h
Normal file
70
wxWidgets/include/wx/univ/tglbtn.h
Normal file
|
@ -0,0 +1,70 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/button.h
|
||||
// Purpose: wxToggleButton for wxUniversal
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by: David Bjorkevik
|
||||
// Created: 16.05.06
|
||||
// RCS-ID: $Id: tglbtn.h 39320 2006-05-24 17:17:27Z PC $
|
||||
// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_TGLBTN_H_
|
||||
#define _WX_UNIV_TGLBTN_H_
|
||||
|
||||
#include "wx/button.h"
|
||||
|
||||
extern WXDLLEXPORT_DATA(const wxChar) wxCheckBoxNameStr[];
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxToggleButton: a push button
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxToggleButton: public wxButton
|
||||
{
|
||||
public:
|
||||
wxToggleButton();
|
||||
|
||||
wxToggleButton(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxBitmap& bitmap,
|
||||
const wxString& label = wxEmptyString,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxCheckBoxNameStr);
|
||||
|
||||
wxToggleButton(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& label = wxEmptyString,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxCheckBoxNameStr);
|
||||
|
||||
virtual ~wxToggleButton();
|
||||
|
||||
virtual bool IsPressed() const { return m_isPressed || m_value; }
|
||||
|
||||
// wxToggleButton actions
|
||||
virtual void Toggle();
|
||||
virtual void Click();
|
||||
|
||||
// Get/set the value
|
||||
void SetValue(bool state);
|
||||
bool GetValue() const { return m_value; }
|
||||
|
||||
protected:
|
||||
// the current value
|
||||
bool m_value;
|
||||
|
||||
private:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxToggleButton)
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_TGLBTN_H_
|
202
wxWidgets/include/wx/univ/theme.h
Normal file
202
wxWidgets/include/wx/univ/theme.h
Normal file
|
@ -0,0 +1,202 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/theme.h
|
||||
// Purpose: wxTheme class manages all configurable aspects of the
|
||||
// application including the look (wxRenderer), feel
|
||||
// (wxInputHandler) and the colours (wxColourScheme)
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 06.08.00
|
||||
// RCS-ID: $Id: theme.h 42455 2006-10-26 15:33:10Z VS $
|
||||
// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_THEME_H_
|
||||
#define _WX_UNIV_THEME_H_
|
||||
|
||||
#include "wx/string.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxTheme
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxArtProvider;
|
||||
class WXDLLEXPORT wxColourScheme;
|
||||
class WXDLLEXPORT wxInputConsumer;
|
||||
class WXDLLEXPORT wxInputHandler;
|
||||
class WXDLLEXPORT wxRenderer;
|
||||
struct WXDLLEXPORT wxThemeInfo;
|
||||
|
||||
class WXDLLEXPORT wxTheme
|
||||
{
|
||||
public:
|
||||
// static methods
|
||||
// --------------
|
||||
|
||||
// create the default theme
|
||||
static bool CreateDefault();
|
||||
|
||||
// create the theme by name (will return NULL if not found)
|
||||
static wxTheme *Create(const wxString& name);
|
||||
|
||||
// change the current scheme
|
||||
static wxTheme *Set(wxTheme *theme);
|
||||
|
||||
// get the current theme (never NULL)
|
||||
static wxTheme *Get() { return ms_theme; }
|
||||
|
||||
// the theme methods
|
||||
// -----------------
|
||||
|
||||
// get the renderer implementing all the control-drawing operations in
|
||||
// this theme
|
||||
virtual wxRenderer *GetRenderer() = 0;
|
||||
|
||||
// get the art provider to be used together with this theme
|
||||
virtual wxArtProvider *GetArtProvider() = 0;
|
||||
|
||||
// get the input handler of the given type, forward to the standard one
|
||||
virtual wxInputHandler *GetInputHandler(const wxString& handlerType,
|
||||
wxInputConsumer *consumer) = 0;
|
||||
|
||||
// get the colour scheme for the control with this name
|
||||
virtual wxColourScheme *GetColourScheme() = 0;
|
||||
|
||||
// implementation only from now on
|
||||
// -------------------------------
|
||||
|
||||
virtual ~wxTheme();
|
||||
|
||||
private:
|
||||
// the list of descriptions of all known themes
|
||||
static wxThemeInfo *ms_allThemes;
|
||||
|
||||
// the current theme
|
||||
static wxTheme *ms_theme;
|
||||
friend struct WXDLLEXPORT wxThemeInfo;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDelegateTheme: it is impossible to inherit from any of standard
|
||||
// themes as their declarations are in private code, but you can use this
|
||||
// class to override only some of their functions - all the other ones
|
||||
// will be left to the original theme
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class wxDelegateTheme : public wxTheme
|
||||
{
|
||||
public:
|
||||
wxDelegateTheme(const wxChar *theme);
|
||||
virtual ~wxDelegateTheme();
|
||||
|
||||
virtual wxRenderer *GetRenderer();
|
||||
virtual wxArtProvider *GetArtProvider();
|
||||
virtual wxInputHandler *GetInputHandler(const wxString& control,
|
||||
wxInputConsumer *consumer);
|
||||
virtual wxColourScheme *GetColourScheme();
|
||||
|
||||
protected:
|
||||
// gets or creates theme and sets m_theme to point to it,
|
||||
// returns true on success
|
||||
bool GetOrCreateTheme();
|
||||
|
||||
wxString m_themeName;
|
||||
wxTheme *m_theme;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// dynamic theme creation helpers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
struct WXDLLEXPORT wxThemeInfo
|
||||
{
|
||||
typedef wxTheme *(*Constructor)();
|
||||
|
||||
// theme name and (user readable) description
|
||||
wxString name, desc;
|
||||
|
||||
// the function to create a theme object
|
||||
Constructor ctor;
|
||||
|
||||
// next node in the linked list or NULL
|
||||
wxThemeInfo *next;
|
||||
|
||||
// constructor for the struct itself
|
||||
wxThemeInfo(Constructor ctor, const wxChar *name, const wxChar *desc);
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// macros
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// to use a standard theme insert this macro into one of the application files:
|
||||
// without it, an over optimizing linker may discard the object module
|
||||
// containing the theme implementation entirely
|
||||
#define WX_USE_THEME(themename) \
|
||||
/* this indirection makes it possible to pass macro as the argument */ \
|
||||
WX_USE_THEME_IMPL(themename)
|
||||
|
||||
#define WX_USE_THEME_IMPL(themename) \
|
||||
extern WXDLLEXPORT_DATA(bool) wxThemeUse##themename; \
|
||||
static struct wxThemeUserFor##themename \
|
||||
{ \
|
||||
wxThemeUserFor##themename() { wxThemeUse##themename = true; } \
|
||||
} wxThemeDoUse##themename
|
||||
|
||||
// to declare a new theme, this macro must be used in the class declaration
|
||||
#define WX_DECLARE_THEME(themename) \
|
||||
private: \
|
||||
static wxThemeInfo ms_info##themename; \
|
||||
public: \
|
||||
const wxThemeInfo *GetThemeInfo() const \
|
||||
{ return &ms_info##themename; }
|
||||
|
||||
// and this one must be inserted in the source file
|
||||
#define WX_IMPLEMENT_THEME(classname, themename, themedesc) \
|
||||
WXDLLEXPORT_DATA(bool) wxThemeUse##themename = true; \
|
||||
wxTheme *wxCtorFor##themename() { return new classname; } \
|
||||
wxThemeInfo classname::ms_info##themename(wxCtorFor##themename, \
|
||||
wxT( #themename ), themedesc)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// determine default theme
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if wxUSE_ALL_THEMES
|
||||
#undef wxUSE_THEME_WIN32
|
||||
#define wxUSE_THEME_WIN32 1
|
||||
#undef wxUSE_THEME_GTK
|
||||
#define wxUSE_THEME_GTK 1
|
||||
#undef wxUSE_THEME_MONO
|
||||
#define wxUSE_THEME_MONO 1
|
||||
#undef wxUSE_THEME_METAL
|
||||
#define wxUSE_THEME_METAL 1
|
||||
#endif // wxUSE_ALL_THEMES
|
||||
|
||||
// determine the default theme to use:
|
||||
#if defined(__WXGTK__) && wxUSE_THEME_GTK
|
||||
#define wxUNIV_DEFAULT_THEME gtk
|
||||
#elif defined(__WXDFB__) && wxUSE_THEME_MONO
|
||||
// use mono theme for DirectFB port because it cannot correctly
|
||||
// render neither win32 nor gtk themes yet:
|
||||
#define wxUNIV_DEFAULT_THEME mono
|
||||
#endif
|
||||
|
||||
// if no theme was picked, get any theme compiled in (sorted by
|
||||
// quality/completeness of the theme):
|
||||
#ifndef wxUNIV_DEFAULT_THEME
|
||||
#if wxUSE_THEME_WIN32
|
||||
#define wxUNIV_DEFAULT_THEME win32
|
||||
#elif wxUSE_THEME_GTK
|
||||
#define wxUNIV_DEFAULT_THEME gtk
|
||||
#elif wxUSE_THEME_MONO
|
||||
#define wxUNIV_DEFAULT_THEME mono
|
||||
#endif
|
||||
// If nothing matches, no themes are compiled and the app must provide
|
||||
// some theme itself
|
||||
// (note that wxUSE_THEME_METAL depends on win32 theme, so we don't have to
|
||||
// try it)
|
||||
//
|
||||
#endif // !wxUNIV_DEFAULT_THEME
|
||||
|
||||
#endif // _WX_UNIV_THEME_H_
|
138
wxWidgets/include/wx/univ/toolbar.h
Normal file
138
wxWidgets/include/wx/univ/toolbar.h
Normal file
|
@ -0,0 +1,138 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/toolbar.h
|
||||
// Purpose: wxToolBar declaration
|
||||
// Author: Robert Roebling
|
||||
// Modified by:
|
||||
// Created: 10.09.00
|
||||
// RCS-ID: $Id: toolbar.h 61872 2009-09-09 22:37:05Z VZ $
|
||||
// Copyright: (c) Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_TOOLBAR_H_
|
||||
#define _WX_UNIV_TOOLBAR_H_
|
||||
|
||||
#include "wx/button.h" // for wxStdButtonInputHandler
|
||||
|
||||
class WXDLLEXPORT wxToolBarTool;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// the actions supported by this control
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#define wxACTION_TOOLBAR_TOGGLE wxACTION_BUTTON_TOGGLE
|
||||
#define wxACTION_TOOLBAR_PRESS wxACTION_BUTTON_PRESS
|
||||
#define wxACTION_TOOLBAR_RELEASE wxACTION_BUTTON_RELEASE
|
||||
#define wxACTION_TOOLBAR_CLICK wxACTION_BUTTON_CLICK
|
||||
#define wxACTION_TOOLBAR_ENTER wxT("enter") // highlight the tool
|
||||
#define wxACTION_TOOLBAR_LEAVE wxT("leave") // unhighlight the tool
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxToolBar
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxToolBar : public wxToolBarBase
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
wxToolBar() { Init(); }
|
||||
wxToolBar(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxToolBarNameStr)
|
||||
{
|
||||
Init();
|
||||
|
||||
Create(parent, id, pos, size, style, name);
|
||||
}
|
||||
|
||||
bool Create( wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxToolBarNameStr );
|
||||
|
||||
virtual ~wxToolBar();
|
||||
|
||||
virtual bool Realize();
|
||||
|
||||
virtual void SetWindowStyleFlag( long style );
|
||||
|
||||
virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const;
|
||||
|
||||
virtual void SetToolShortHelp(int id, const wxString& helpString);
|
||||
|
||||
virtual void SetMargins(int x, int y);
|
||||
void SetMargins(const wxSize& size)
|
||||
{ SetMargins((int) size.x, (int) size.y); }
|
||||
|
||||
virtual bool PerformAction(const wxControlAction& action,
|
||||
long numArg = -1,
|
||||
const wxString& strArg = wxEmptyString);
|
||||
static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef);
|
||||
virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef)
|
||||
{
|
||||
return GetStdInputHandler(handlerDef);
|
||||
}
|
||||
|
||||
protected:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
// implement base class pure virtuals
|
||||
virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool);
|
||||
virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool);
|
||||
|
||||
virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable);
|
||||
virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle);
|
||||
virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle);
|
||||
|
||||
virtual wxToolBarToolBase *CreateTool(int id,
|
||||
const wxString& label,
|
||||
const wxBitmap& bmpNormal,
|
||||
const wxBitmap& bmpDisabled,
|
||||
wxItemKind kind,
|
||||
wxObject *clientData,
|
||||
const wxString& shortHelp,
|
||||
const wxString& longHelp);
|
||||
virtual wxToolBarToolBase *CreateTool(wxControl *control);
|
||||
|
||||
virtual wxSize DoGetBestClientSize() const;
|
||||
virtual void DoSetSize(int x, int y,
|
||||
int width, int height,
|
||||
int sizeFlags = wxSIZE_AUTO);
|
||||
virtual void DoDraw(wxControlRenderer *renderer);
|
||||
|
||||
// get the bounding rect for the given tool
|
||||
wxRect GetToolRect(wxToolBarToolBase *tool) const;
|
||||
|
||||
// redraw the given tool
|
||||
void RefreshTool(wxToolBarToolBase *tool);
|
||||
|
||||
// (re)calculate the tool positions, should only be called if it is
|
||||
// necessary to do it, i.e. m_needsLayout == true
|
||||
void DoLayout();
|
||||
|
||||
// get the rect limits depending on the orientation: top/bottom for a
|
||||
// vertical toolbar, left/right for a horizontal one
|
||||
void GetRectLimits(const wxRect& rect, wxCoord *start, wxCoord *end) const;
|
||||
|
||||
private:
|
||||
// have we calculated the positions of our tools?
|
||||
bool m_needsLayout;
|
||||
|
||||
// the width of a separator
|
||||
wxCoord m_widthSeparator;
|
||||
|
||||
// the total size of all toolbar elements
|
||||
wxCoord m_maxWidth,
|
||||
m_maxHeight;
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxToolBar)
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_TOOLBAR_H_
|
197
wxWidgets/include/wx/univ/toplevel.h
Normal file
197
wxWidgets/include/wx/univ/toplevel.h
Normal file
|
@ -0,0 +1,197 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/toplevel.h
|
||||
// Purpose: Top level window, abstraction of wxFrame and wxDialog
|
||||
// Author: Vaclav Slavik
|
||||
// Id: $Id: toplevel.h 61872 2009-09-09 22:37:05Z VZ $
|
||||
// Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com)
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef __WX_UNIV_TOPLEVEL_H__
|
||||
#define __WX_UNIV_TOPLEVEL_H__
|
||||
|
||||
#include "wx/univ/inpcons.h"
|
||||
#include "wx/univ/inphand.h"
|
||||
#include "wx/icon.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// frame decorations type flags used in wxRenderer and wxColourScheme
|
||||
enum
|
||||
{
|
||||
wxTOPLEVEL_ACTIVE = 0x00000001,
|
||||
wxTOPLEVEL_MAXIMIZED = 0x00000002,
|
||||
wxTOPLEVEL_TITLEBAR = 0x00000004,
|
||||
wxTOPLEVEL_ICON = 0x00000008,
|
||||
wxTOPLEVEL_RESIZEABLE = 0x00000010,
|
||||
wxTOPLEVEL_BORDER = 0x00000020,
|
||||
wxTOPLEVEL_BUTTON_CLOSE = 0x01000000,
|
||||
wxTOPLEVEL_BUTTON_MAXIMIZE = 0x02000000,
|
||||
wxTOPLEVEL_BUTTON_ICONIZE = 0x04000000,
|
||||
wxTOPLEVEL_BUTTON_RESTORE = 0x08000000,
|
||||
wxTOPLEVEL_BUTTON_HELP = 0x10000000
|
||||
};
|
||||
|
||||
// frame hit test return values:
|
||||
enum
|
||||
{
|
||||
wxHT_TOPLEVEL_NOWHERE = 0x00000000,
|
||||
wxHT_TOPLEVEL_CLIENT_AREA = 0x00000001,
|
||||
wxHT_TOPLEVEL_ICON = 0x00000002,
|
||||
wxHT_TOPLEVEL_TITLEBAR = 0x00000004,
|
||||
|
||||
wxHT_TOPLEVEL_BORDER_N = 0x00000010,
|
||||
wxHT_TOPLEVEL_BORDER_S = 0x00000020,
|
||||
wxHT_TOPLEVEL_BORDER_E = 0x00000040,
|
||||
wxHT_TOPLEVEL_BORDER_W = 0x00000080,
|
||||
wxHT_TOPLEVEL_BORDER_NE = wxHT_TOPLEVEL_BORDER_N | wxHT_TOPLEVEL_BORDER_E,
|
||||
wxHT_TOPLEVEL_BORDER_SE = wxHT_TOPLEVEL_BORDER_S | wxHT_TOPLEVEL_BORDER_E,
|
||||
wxHT_TOPLEVEL_BORDER_NW = wxHT_TOPLEVEL_BORDER_N | wxHT_TOPLEVEL_BORDER_W,
|
||||
wxHT_TOPLEVEL_BORDER_SW = wxHT_TOPLEVEL_BORDER_S | wxHT_TOPLEVEL_BORDER_W,
|
||||
wxHT_TOPLEVEL_ANY_BORDER = 0x000000F0,
|
||||
|
||||
wxHT_TOPLEVEL_BUTTON_CLOSE = /*0x01000000*/ wxTOPLEVEL_BUTTON_CLOSE,
|
||||
wxHT_TOPLEVEL_BUTTON_MAXIMIZE = /*0x02000000*/ wxTOPLEVEL_BUTTON_MAXIMIZE,
|
||||
wxHT_TOPLEVEL_BUTTON_ICONIZE = /*0x04000000*/ wxTOPLEVEL_BUTTON_ICONIZE,
|
||||
wxHT_TOPLEVEL_BUTTON_RESTORE = /*0x08000000*/ wxTOPLEVEL_BUTTON_RESTORE,
|
||||
wxHT_TOPLEVEL_BUTTON_HELP = /*0x10000000*/ wxTOPLEVEL_BUTTON_HELP,
|
||||
wxHT_TOPLEVEL_ANY_BUTTON = 0x1F000000
|
||||
};
|
||||
|
||||
// Flags for interactive frame manipulation functions (only in wxUniversal):
|
||||
enum
|
||||
{
|
||||
wxINTERACTIVE_MOVE = 0x00000001,
|
||||
wxINTERACTIVE_RESIZE = 0x00000002,
|
||||
wxINTERACTIVE_RESIZE_S = 0x00000010,
|
||||
wxINTERACTIVE_RESIZE_N = 0x00000020,
|
||||
wxINTERACTIVE_RESIZE_W = 0x00000040,
|
||||
wxINTERACTIVE_RESIZE_E = 0x00000080,
|
||||
wxINTERACTIVE_WAIT_FOR_INPUT = 0x10000000
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// the actions supported by this control
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#define wxACTION_TOPLEVEL_ACTIVATE wxT("activate") // (de)activate the frame
|
||||
#define wxACTION_TOPLEVEL_BUTTON_PRESS wxT("pressbtn") // press titlebar btn
|
||||
#define wxACTION_TOPLEVEL_BUTTON_RELEASE wxT("releasebtn") // press titlebar btn
|
||||
#define wxACTION_TOPLEVEL_BUTTON_CLICK wxT("clickbtn") // press titlebar btn
|
||||
#define wxACTION_TOPLEVEL_MOVE wxT("move") // move the frame
|
||||
#define wxACTION_TOPLEVEL_RESIZE wxT("resize") // resize the frame
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxTopLevelWindow
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxTopLevelWindow : public wxTopLevelWindowNative,
|
||||
public wxInputConsumer
|
||||
{
|
||||
public:
|
||||
// construction
|
||||
wxTopLevelWindow() { Init(); }
|
||||
wxTopLevelWindow(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr)
|
||||
{
|
||||
Init();
|
||||
|
||||
Create(parent, id, title, pos, size, style, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr);
|
||||
|
||||
// wxUniv-specific methods: do [not] use native decorations for this (or
|
||||
// all) window(s)
|
||||
//
|
||||
// notice that this has no effect if the system doesn't support any native
|
||||
// decorations anyhow and that by default native decorations are used
|
||||
//
|
||||
// if UseNativeDecorations() is used, it must be called before Create()
|
||||
static void UseNativeDecorationsByDefault(bool native = true);
|
||||
void UseNativeDecorations(bool native = true);
|
||||
bool IsUsingNativeDecorations() const;
|
||||
|
||||
|
||||
// implement base class pure virtuals
|
||||
virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
|
||||
virtual wxPoint GetClientAreaOrigin() const;
|
||||
virtual void SetIcon(const wxIcon& icon) { SetIcons( wxIconBundle( icon ) ); }
|
||||
virtual void SetIcons(const wxIconBundle& icons);
|
||||
|
||||
// implementation from now on
|
||||
// --------------------------
|
||||
|
||||
// tests for frame's part at given point
|
||||
long HitTest(const wxPoint& pt) const;
|
||||
|
||||
virtual bool PerformAction(const wxControlAction& action,
|
||||
long numArg = -1,
|
||||
const wxString& strArg = wxEmptyString);
|
||||
|
||||
static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef);
|
||||
virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef)
|
||||
{
|
||||
return GetStdInputHandler(handlerDef);
|
||||
}
|
||||
|
||||
// move/resize the frame interactively, i.e. let the user do it
|
||||
virtual void InteractiveMove(int flags = wxINTERACTIVE_MOVE);
|
||||
|
||||
virtual wxSize GetMinSize() const;
|
||||
|
||||
virtual wxWindow *GetInputWindow() const { return wx_const_cast(wxTopLevelWindow*, this); }
|
||||
|
||||
protected:
|
||||
virtual void DoGetClientSize(int *width, int *height) const;
|
||||
virtual void DoSetClientSize(int width, int height);
|
||||
|
||||
// handle titlebar button click event
|
||||
virtual void ClickTitleBarButton(long button);
|
||||
|
||||
// return wxTOPLEVEL_xxx combination based on current state of the frame
|
||||
long GetDecorationsStyle() const;
|
||||
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
void RefreshTitleBar();
|
||||
void OnNcPaint(wxNcPaintEvent& event);
|
||||
void OnSystemMenu(wxCommandEvent& event);
|
||||
|
||||
// true if wxTLW should render decorations (aka titlebar) itself
|
||||
static int ms_drawDecorations;
|
||||
// true if wxTLW can be iconized
|
||||
static int ms_canIconize;
|
||||
|
||||
// true if we're using native decorations
|
||||
bool m_usingNativeDecorations;
|
||||
// true for currently active frame
|
||||
bool m_isActive;
|
||||
// version of icon for titlebar (16x16)
|
||||
wxIcon m_titlebarIcon;
|
||||
// saved window style in fullscreen mdoe
|
||||
long m_fsSavedStyle;
|
||||
// currently pressed titlebar button
|
||||
long m_pressedButton;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxTopLevelWindow)
|
||||
DECLARE_EVENT_TABLE()
|
||||
WX_DECLARE_INPUT_CONSUMER()
|
||||
};
|
||||
|
||||
#endif // __WX_UNIV_TOPLEVEL_H__
|
287
wxWidgets/include/wx/univ/window.h
Normal file
287
wxWidgets/include/wx/univ/window.h
Normal file
|
@ -0,0 +1,287 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/window.h
|
||||
// Purpose: wxWindow class which is the base class for all
|
||||
// wxUniv port controls, it supports the customization of the
|
||||
// window drawing and input processing.
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 06.08.00
|
||||
// RCS-ID: $Id: window.h 39633 2006-06-08 11:25:30Z ABX $
|
||||
// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_WINDOW_H_
|
||||
#define _WX_UNIV_WINDOW_H_
|
||||
|
||||
#include "wx/bitmap.h" // for m_bitmapBg
|
||||
|
||||
class WXDLLEXPORT wxControlRenderer;
|
||||
class WXDLLEXPORT wxEventLoop;
|
||||
|
||||
#if wxUSE_MENUS
|
||||
class WXDLLEXPORT wxMenu;
|
||||
class WXDLLEXPORT wxMenuBar;
|
||||
#endif // wxUSE_MENUS
|
||||
|
||||
class WXDLLEXPORT wxRenderer;
|
||||
|
||||
#if wxUSE_SCROLLBAR
|
||||
class WXDLLEXPORT wxScrollBar;
|
||||
#endif // wxUSE_SCROLLBAR
|
||||
|
||||
#ifdef __WXX11__
|
||||
#define wxUSE_TWO_WINDOWS 1
|
||||
#else
|
||||
#define wxUSE_TWO_WINDOWS 0
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxWindow
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#define wxWindowNative wxWindowMSW
|
||||
#elif defined(__WXGTK__)
|
||||
#define wxWindowNative wxWindowGTK
|
||||
#elif defined(__WXMGL__)
|
||||
#define wxWindowNative wxWindowMGL
|
||||
#elif defined(__WXX11__)
|
||||
#define wxWindowNative wxWindowX11
|
||||
#elif defined(__WXMAC__)
|
||||
#define wxWindowNative wxWindowMac
|
||||
#endif
|
||||
|
||||
class WXDLLEXPORT wxWindow : public wxWindowNative
|
||||
{
|
||||
public:
|
||||
// ctors and create functions
|
||||
// ---------------------------
|
||||
|
||||
wxWindow() { Init(); }
|
||||
|
||||
wxWindow(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxPanelNameStr)
|
||||
: wxWindowNative(parent, id, pos, size, style | wxCLIP_CHILDREN, name)
|
||||
{ Init(); }
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
|
||||
virtual ~wxWindow();
|
||||
|
||||
// background pixmap support
|
||||
// -------------------------
|
||||
|
||||
virtual void SetBackground(const wxBitmap& bitmap,
|
||||
int alignment = wxALIGN_CENTRE,
|
||||
wxStretch stretch = wxSTRETCH_NOT);
|
||||
|
||||
const wxBitmap& GetBackgroundBitmap(int *alignment = NULL,
|
||||
wxStretch *stretch = NULL) const;
|
||||
|
||||
// scrollbars: we (re)implement it ourselves using our own scrollbars
|
||||
// instead of the native ones
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
virtual void SetScrollbar(int orient,
|
||||
int pos,
|
||||
int page,
|
||||
int range,
|
||||
bool refresh = true );
|
||||
virtual void SetScrollPos(int orient, int pos, bool refresh = true);
|
||||
virtual int GetScrollPos(int orient) const;
|
||||
virtual int GetScrollThumb(int orient) const;
|
||||
virtual int GetScrollRange(int orient) const;
|
||||
virtual void ScrollWindow(int dx, int dy,
|
||||
const wxRect* rect = (wxRect *) NULL);
|
||||
|
||||
// take into account the borders here
|
||||
virtual wxPoint GetClientAreaOrigin() const;
|
||||
|
||||
// popup menu support
|
||||
// ------------------
|
||||
|
||||
// NB: all menu related functions are implemented in menu.cpp
|
||||
|
||||
#if wxUSE_MENUS
|
||||
// this is wxUniv-specific private method to be used only by wxMenu
|
||||
void DismissPopupMenu();
|
||||
#endif // wxUSE_MENUS
|
||||
|
||||
// miscellaneous other methods
|
||||
// ---------------------------
|
||||
|
||||
// get the state information
|
||||
virtual bool IsFocused() const;
|
||||
virtual bool IsCurrent() const;
|
||||
virtual bool IsPressed() const;
|
||||
virtual bool IsDefault() const;
|
||||
|
||||
// return all state flags at once (combination of wxCONTROL_XXX values)
|
||||
int GetStateFlags() const;
|
||||
|
||||
// set the "highlighted" flag and return true if it changed
|
||||
virtual bool SetCurrent(bool doit = true);
|
||||
|
||||
#if wxUSE_SCROLLBAR
|
||||
// get the scrollbar (may be NULL) for the given orientation
|
||||
wxScrollBar *GetScrollbar(int orient) const
|
||||
{
|
||||
return orient & wxVERTICAL ? m_scrollbarVert : m_scrollbarHorz;
|
||||
}
|
||||
#endif // wxUSE_SCROLLBAR
|
||||
|
||||
// methods used by wxColourScheme to choose the colours for this window
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
// return true if this is a panel/canvas window which contains other
|
||||
// controls only
|
||||
virtual bool IsCanvasWindow() const { return false; }
|
||||
|
||||
// return true if this control can be highlighted when the mouse is over
|
||||
// it (the theme decides itself whether it is really highlighted or not)
|
||||
virtual bool CanBeHighlighted() const { return false; }
|
||||
|
||||
// return true if we should use the colours/fonts returned by the
|
||||
// corresponding GetXXX() methods instead of the default ones
|
||||
bool UseFgCol() const { return m_hasFgCol; }
|
||||
bool UseFont() const { return m_hasFont; }
|
||||
|
||||
// return true if this window serves as a container for the other windows
|
||||
// only and doesn't get any input itself
|
||||
virtual bool IsStaticBox() const { return false; }
|
||||
|
||||
// returns the (low level) renderer to use for drawing the control by
|
||||
// querying the current theme
|
||||
wxRenderer *GetRenderer() const { return m_renderer; }
|
||||
|
||||
// scrolling helper: like ScrollWindow() except that it doesn't refresh the
|
||||
// uncovered window areas but returns the rectangle to update (don't call
|
||||
// this with both dx and dy non zero)
|
||||
wxRect ScrollNoRefresh(int dx, int dy, const wxRect *rect = NULL);
|
||||
|
||||
// after scrollbars are added or removed they must be refreshed by calling
|
||||
// this function
|
||||
void RefreshScrollbars();
|
||||
|
||||
// erase part of the control
|
||||
virtual void EraseBackground(wxDC& dc, const wxRect& rect);
|
||||
|
||||
// overridden base class methods
|
||||
// -----------------------------
|
||||
|
||||
// the rect coordinates are, for us, in client coords, but if no rect is
|
||||
// specified, the entire window is refreshed
|
||||
virtual void Refresh(bool eraseBackground = true,
|
||||
const wxRect *rect = (const wxRect *) NULL);
|
||||
|
||||
// we refresh the window when it is dis/enabled
|
||||
virtual bool Enable(bool enable = true);
|
||||
|
||||
// should we use the standard control colours or not?
|
||||
virtual bool ShouldInheritColours() const { return false; }
|
||||
|
||||
protected:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
#if wxUSE_MENUS
|
||||
virtual bool DoPopupMenu(wxMenu *menu, int x, int y);
|
||||
#endif // wxUSE_MENUS
|
||||
|
||||
// we deal with the scrollbars in these functions
|
||||
virtual void DoSetClientSize(int width, int height);
|
||||
virtual void DoGetClientSize(int *width, int *height) const;
|
||||
virtual wxHitTest DoHitTest(wxCoord x, wxCoord y) const;
|
||||
|
||||
// event handlers
|
||||
void OnSize(wxSizeEvent& event);
|
||||
void OnNcPaint(wxNcPaintEvent& event);
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
void OnErase(wxEraseEvent& event);
|
||||
|
||||
#if wxUSE_ACCEL || wxUSE_MENUS
|
||||
void OnKeyDown(wxKeyEvent& event);
|
||||
#endif // wxUSE_ACCEL
|
||||
|
||||
#if wxUSE_MENUS
|
||||
void OnChar(wxKeyEvent& event);
|
||||
void OnKeyUp(wxKeyEvent& event);
|
||||
#endif // wxUSE_MENUS
|
||||
|
||||
// draw the control background, return true if done
|
||||
virtual bool DoDrawBackground(wxDC& dc);
|
||||
|
||||
// draw the controls border
|
||||
virtual void DoDrawBorder(wxDC& dc, const wxRect& rect);
|
||||
|
||||
// draw the controls contents
|
||||
virtual void DoDraw(wxControlRenderer *renderer);
|
||||
|
||||
// calculate the best size for the client area of the window: default
|
||||
// implementation of DoGetBestSize() uses this method and adds the border
|
||||
// width to the result
|
||||
virtual wxSize DoGetBestClientSize() const;
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
||||
// adjust the size of the window to take into account its borders
|
||||
wxSize AdjustSize(const wxSize& size) const;
|
||||
|
||||
// put the scrollbars along the edges of the window
|
||||
void PositionScrollbars();
|
||||
|
||||
#if wxUSE_MENUS
|
||||
// return the menubar of the parent frame or NULL
|
||||
wxMenuBar *GetParentFrameMenuBar() const;
|
||||
#endif // wxUSE_MENUS
|
||||
|
||||
// the renderer we use
|
||||
wxRenderer *m_renderer;
|
||||
|
||||
// background bitmap info
|
||||
wxBitmap m_bitmapBg;
|
||||
int m_alignBgBitmap;
|
||||
wxStretch m_stretchBgBitmap;
|
||||
|
||||
// old size
|
||||
wxSize m_oldSize;
|
||||
|
||||
// is the mouse currently inside the window?
|
||||
bool m_isCurrent:1;
|
||||
|
||||
#ifdef __WXMSW__
|
||||
public:
|
||||
// override MSWWindowProc() to process WM_NCHITTEST
|
||||
WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
||||
#endif // __WXMSW__
|
||||
|
||||
private:
|
||||
|
||||
#if wxUSE_SCROLLBAR
|
||||
// the window scrollbars
|
||||
wxScrollBar *m_scrollbarHorz,
|
||||
*m_scrollbarVert;
|
||||
#endif // wxUSE_SCROLLBAR
|
||||
|
||||
#if wxUSE_MENUS
|
||||
// the current modal event loop for the popup menu we show or NULL
|
||||
static wxEventLoop *ms_evtLoopPopup;
|
||||
|
||||
// the last window over which Alt was pressed (used by OnKeyUp)
|
||||
static wxWindow *ms_winLastAltPress;
|
||||
#endif // wxUSE_MENUS
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxWindow)
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_WINDOW_H_
|
Loading…
Add table
Add a link
Reference in a new issue