first pass of wxUniv merge - nothing works, most parts don't even compile
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10673 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
21
include/wx/univ/app.h
Normal file
21
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$
|
||||
// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows license
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIX_APP_H_
|
||||
#define _WX_UNIX_APP_H_
|
||||
|
||||
class WXDLLEXPORT wxUniversalApp : public wxApp
|
||||
{
|
||||
public:
|
||||
};
|
||||
|
||||
#endif // _WX_UNIX_APP_H_
|
||||
|
76
include/wx/univ/bmpbuttn.h
Normal file
76
include/wx/univ/bmpbuttn.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/bmpbuttn.h
|
||||
// Purpose: wxBitmapButton class for wxUniversal
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 25.08.00
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_BMPBUTTN_H_
|
||||
#define _WX_UNIV_BMPBUTTN_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "univbmpbuttn.h"
|
||||
#endif
|
||||
|
||||
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_
|
||||
|
159
include/wx/univ/button.h
Normal file
159
include/wx/univ/button.h
Normal file
@@ -0,0 +1,159 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/button.h
|
||||
// Purpose: wxButton for wxUniversal
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 15.08.00
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows license
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_BUTTON_H_
|
||||
#define _WX_UNIV_BUTTON_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "univbutton.h"
|
||||
#endif
|
||||
|
||||
class WXDLLEXPORT wxInputHandler;
|
||||
|
||||
#include "wx/bitmap.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// the actions supported by this control
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#define wxACTION_BUTTON_TOGGLE _T("toggle") // press/release the button
|
||||
#define wxACTION_BUTTON_PRESS _T("press") // press the button
|
||||
#define wxACTION_BUTTON_RELEASE _T("release") // release the button
|
||||
#define wxACTION_BUTTON_CLICK _T("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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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
|
||||
void Toggle();
|
||||
virtual void Press();
|
||||
virtual void Release();
|
||||
virtual void Click();
|
||||
|
||||
protected:
|
||||
virtual bool PerformAction(const wxControlAction& action,
|
||||
long numArg = -1,
|
||||
const wxString& strArg = wxEmptyString);
|
||||
virtual wxSize DoGetBestClientSize() const;
|
||||
virtual void DoDraw(wxControlRenderer *renderer);
|
||||
|
||||
virtual bool CanBeHighlighted() const { return TRUE; }
|
||||
|
||||
// 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)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxStdButtonInputHandler: translates SPACE and ENTER keys and the left mouse
|
||||
// click into button press/release actions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxStdButtonInputHandler : public wxStdInputHandler
|
||||
{
|
||||
public:
|
||||
wxStdButtonInputHandler(wxInputHandler *inphand);
|
||||
|
||||
virtual bool HandleKey(wxControl *control,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed);
|
||||
virtual bool HandleMouse(wxControl *control,
|
||||
const wxMouseEvent& event);
|
||||
virtual bool HandleMouseMove(wxControl *control, const wxMouseEvent& event);
|
||||
virtual bool HandleFocus(wxControl *control, const wxFocusEvent& event);
|
||||
virtual bool HandleActivation(wxControl *control, bool activated);
|
||||
|
||||
private:
|
||||
// the window (button) which has capture or NULL and the flag telling if
|
||||
// the mouse is inside the button which captured it or not
|
||||
wxWindow *m_winCapture;
|
||||
bool m_winHasMouse;
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_BUTTON_H_
|
||||
|
161
include/wx/univ/checkbox.h
Normal file
161
include/wx/univ/checkbox.h
Normal file
@@ -0,0 +1,161 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/checkbox.h
|
||||
// Purpose: wxCheckBox declaration
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 07.09.00
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows license
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_CHECKBOX_H_
|
||||
#define _WX_UNIV_CHECKBOX_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "univcheckbox.h"
|
||||
#endif
|
||||
|
||||
#include "wx/button.h" // for wxStdButtonInputHandler
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// the actions supported by wxCheckBox
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#define wxACTION_CHECKBOX_CHECK _T("check") // SetValue(TRUE)
|
||||
#define wxACTION_CHECKBOX_CLEAR _T("clear") // SetValue(FALSE)
|
||||
#define wxACTION_CHECKBOX_TOGGLE _T("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_Unknown,
|
||||
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; }
|
||||
|
||||
protected:
|
||||
virtual bool PerformAction(const wxControlAction& action,
|
||||
long numArg = -1,
|
||||
const wxString& strArg = wxEmptyString);
|
||||
virtual void DoDraw(wxControlRenderer *renderer);
|
||||
virtual wxSize DoGetBestClientSize() const;
|
||||
|
||||
virtual bool CanBeHighlighted() const { return TRUE; }
|
||||
|
||||
// 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)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxStdCheckboxInputHandler: handles the mouse events for the check and radio
|
||||
// boxes (handling the keyboard input is simple, but its handling differs a
|
||||
// lot between GTK and MSW, so a new class should be derived for this)
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxStdCheckboxInputHandler : public wxStdButtonInputHandler
|
||||
{
|
||||
public:
|
||||
wxStdCheckboxInputHandler(wxInputHandler *inphand);
|
||||
|
||||
// we have to override this one as wxStdButtonInputHandler version works
|
||||
// only with the buttons
|
||||
virtual bool HandleActivation(wxControl *control, bool activated);
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_CHECKBOX_H_
|
113
include/wx/univ/checklst.h
Normal file
113
include/wx/univ/checklst.h
Normal file
@@ -0,0 +1,113 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/checklst.h
|
||||
// Purpose: wxCheckListBox class for wxUniversal
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 12.09.00
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_CHECKLST_H_
|
||||
#define _WX_UNIV_CHECKLST_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "univchecklst.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// actions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#define wxACTION_CHECKLISTBOX_TOGGLE _T("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);
|
||||
}
|
||||
|
||||
bool Create(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);
|
||||
|
||||
// implement check list box methods
|
||||
virtual bool IsChecked(size_t item) const;
|
||||
virtual void Check(size_t item, bool check = TRUE);
|
||||
|
||||
// and input handling
|
||||
virtual bool PerformAction(const wxControlAction& action,
|
||||
long numArg = -1l,
|
||||
const wxString& strArg = wxEmptyString);
|
||||
|
||||
// override all methods which add/delete items to update m_checks array as
|
||||
// well
|
||||
virtual void Delete(int n);
|
||||
|
||||
protected:
|
||||
virtual int DoAppend(const wxString& item);
|
||||
virtual void DoInsertItems(const wxArrayString& items, 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)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxStdCheckListBoxInputHandler
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxStdCheckListboxInputHandler : public wxStdListboxInputHandler
|
||||
{
|
||||
public:
|
||||
wxStdCheckListboxInputHandler(wxInputHandler *inphand);
|
||||
|
||||
virtual bool HandleKey(wxControl *control,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed);
|
||||
virtual bool HandleMouse(wxControl *control,
|
||||
const wxMouseEvent& event);
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_CHECKLST_H_
|
||||
|
90
include/wx/univ/colschem.h
Normal file
90
include/wx/univ/colschem.h
Normal file
@@ -0,0 +1,90 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// 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$
|
||||
// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows license
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_COLSCHEM_H_
|
||||
#define _WX_UNIV_COLSCHEM_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "colschem.h"
|
||||
#endif
|
||||
|
||||
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,
|
||||
|
||||
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_
|
307
include/wx/univ/combobox.h
Normal file
307
include/wx/univ/combobox.h
Normal file
@@ -0,0 +1,307 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/combobox.h
|
||||
// Purpose: the universal combobox
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 30.08.00
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*
|
||||
A few words about all the classes defined in this file are probably in
|
||||
order: why do we need extra wxComboControl and wxComboPopup classes?
|
||||
|
||||
This is because a traditional combobox is a combination of a text control
|
||||
(with a button allowing to open the pop down list) with a listbox and
|
||||
wxComboBox class is exactly such control, however we want to also have other
|
||||
combinations - in fact, we want to allow anything at all to be used as pop
|
||||
down list, not just a wxListBox.
|
||||
|
||||
So we define a base wxComboControl which can use any control as pop down
|
||||
list and wxComboBox deriving from it which implements the standard wxWindows
|
||||
combobox API. wxComboControl needs to be told somehow which control to use
|
||||
and this is done by SetPopupControl(). However, we need something more than
|
||||
just a wxControl in this method as, for example, we need to call
|
||||
SetSelection("initial text value") and wxControl doesn't have such method.
|
||||
So we also need a wxComboPopup which is just a very simple interface which
|
||||
must be implemented by a control to be usable as a popup.
|
||||
|
||||
We couldn't derive wxComboPopup from wxControl as this would make it
|
||||
impossible to have a class deriving from both wxListBx and from it, so
|
||||
instead it is just a mix-in.
|
||||
*/
|
||||
|
||||
#ifndef _WX_UNIV_COMBOBOX_H_
|
||||
#define _WX_UNIV_COMBOBOX_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "univcombobox.h"
|
||||
#endif
|
||||
|
||||
class WXDLLEXPORT wxComboControl;
|
||||
class WXDLLEXPORT wxListBox;
|
||||
class WXDLLEXPORT wxPopupComboWindow;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// the actions supported by this control
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// all actions of single line text controls are supported
|
||||
|
||||
// popup/dismiss the choice window
|
||||
#define wxACTION_COMBOBOX_POPUP _T("popup")
|
||||
#define wxACTION_COMBOBOX_DISMISS _T("dismiss")
|
||||
|
||||
// choose the next/prev/specified (by numArg) item
|
||||
#define wxACTION_COMBOBOX_SELECT_NEXT _T("next")
|
||||
#define wxACTION_COMBOBOX_SELECT_PREV _T("prev")
|
||||
#define wxACTION_COMBOBOX_SELECT _T("select")
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxComboPopup is the interface which must be implemented by a control to be
|
||||
// used as a popup by wxComboControl
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxComboPopup
|
||||
{
|
||||
public:
|
||||
wxComboPopup(wxComboControl *combo) { m_combo = combo; }
|
||||
|
||||
// we must have an associated control which is subclassed by the combobox
|
||||
virtual wxControl *GetControl() = 0;
|
||||
|
||||
// called before showing the control to set the initial selection - notice
|
||||
// that the text passed to this method might not correspond to any valid
|
||||
// item (if the user edited it directly), in which case the method should
|
||||
// just return FALSE but not emit any errors
|
||||
virtual bool SetSelection(const wxString& value) = 0;
|
||||
|
||||
// called immediately after the control is shown
|
||||
virtual void OnShow() = 0;
|
||||
|
||||
protected:
|
||||
wxComboControl *m_combo;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxComboControl: a combination of a (single line) text control with a button
|
||||
// opening a popup window which contains the control from which the user can
|
||||
// choose the value directly.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxComboControl : public wxControl
|
||||
{
|
||||
public:
|
||||
// construction
|
||||
wxComboControl()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
wxComboControl(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 = wxComboBoxNameStr)
|
||||
{
|
||||
Init();
|
||||
|
||||
(void)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 = wxComboBoxNameStr);
|
||||
|
||||
virtual ~wxComboControl();
|
||||
|
||||
// a combo control needs a control for popup window it displays
|
||||
void SetPopupControl(wxComboPopup *popup);
|
||||
wxComboPopup *GetPopupControl() const { return m_popup; }
|
||||
|
||||
// show/hide popup window
|
||||
void ShowPopup();
|
||||
void HidePopup();
|
||||
|
||||
// return TRUE if the popup is currently shown
|
||||
bool IsPopupShown() const { return m_isPopupShown; }
|
||||
|
||||
// get the popup window containing the popup control
|
||||
wxPopupComboWindow *GetPopupWindow() const { return m_winPopup; }
|
||||
|
||||
// get the text control which is part of the combobox
|
||||
wxTextCtrl *GetText() const { return m_text; }
|
||||
|
||||
// implementation only from now on
|
||||
// -------------------------------
|
||||
|
||||
// notifications from wxComboPopup (shouldn't be called by anybody else)
|
||||
|
||||
// called when the user selects something in the popup: this normally hides
|
||||
// the popup and sets the text to the new value
|
||||
virtual void OnSelect(const wxString& value);
|
||||
|
||||
// called when the user dismisses the popup
|
||||
virtual void OnDismiss();
|
||||
|
||||
// forward these functions to all subcontrols
|
||||
virtual bool Enable(bool enable = TRUE);
|
||||
virtual bool Show(bool show = TRUE);
|
||||
|
||||
protected:
|
||||
// override the base class virtuals involved into geometry calculations
|
||||
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);
|
||||
|
||||
// we have our own input handler and our own actions
|
||||
virtual bool PerformAction(const wxControlAction& action,
|
||||
long numArg = 0l,
|
||||
const wxString& strArg = wxEmptyString);
|
||||
|
||||
// event handlers
|
||||
void OnKey(wxCommandEvent& event);
|
||||
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
private:
|
||||
// the text control and button we show all the time
|
||||
wxTextCtrl *m_text;
|
||||
wxButton *m_btn;
|
||||
|
||||
// the popup control
|
||||
wxComboPopup *m_popup;
|
||||
|
||||
// and the popup window containing it
|
||||
wxPopupComboWindow *m_winPopup;
|
||||
|
||||
// the height of the combobox popup as calculated in Create()
|
||||
wxCoord m_heightPopup;
|
||||
|
||||
// is the popup window currenty shown?
|
||||
bool m_isPopupShown;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxComboBox: a combination of text control and a listbox
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxComboBox : public wxComboControl, 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);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
|
||||
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 long 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);
|
||||
|
||||
// wxControlWithItems methods
|
||||
virtual void Clear();
|
||||
virtual void Delete(int n);
|
||||
virtual int GetCount() const;
|
||||
virtual wxString GetString(int n) const;
|
||||
virtual void SetString(int n, const wxString& s);
|
||||
virtual int FindString(const wxString& s) const;
|
||||
virtual void Select(int n);
|
||||
virtual int GetSelection() const;
|
||||
void SetSelection(int n) { Select(n); }
|
||||
|
||||
protected:
|
||||
virtual int DoAppend(const wxString& item);
|
||||
virtual void DoSetItemClientData(int n, void* clientData);
|
||||
virtual void* DoGetItemClientData(int n) const;
|
||||
virtual void DoSetItemClientObject(int n, wxClientData* clientData);
|
||||
virtual wxClientData* DoGetItemClientObject(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)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxStdComboBoxInputHandler: allows the user to open/close the combo from kbd
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxStdComboBoxInputHandler : public wxStdInputHandler
|
||||
{
|
||||
public:
|
||||
wxStdComboBoxInputHandler(wxInputHandler *inphand);
|
||||
|
||||
virtual bool HandleKey(wxControl *control,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed);
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_COMBOBOX_H_
|
130
include/wx/univ/control.h
Normal file
130
include/wx/univ/control.h
Normal file
@@ -0,0 +1,130 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/control.h
|
||||
// Purpose: universal wxControl: adds handling of mnemonics
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 14.08.00
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Vadim Zeitlin <vadim@wxwindows.org>
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_CONTROL_H_
|
||||
#define _WX_UNIV_CONTROL_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "control.h"
|
||||
#endif
|
||||
|
||||
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"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// 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 _T("") // no action to perform
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxControl: the base class for all GUI controls
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxControl : public wxControlBase
|
||||
{
|
||||
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 ? _T('\0') : m_label[m_indexAccel];
|
||||
}
|
||||
|
||||
// get the input handler of this control
|
||||
wxInputHandler *GetInputHandler() const { return m_handler; }
|
||||
|
||||
// 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);
|
||||
|
||||
protected:
|
||||
// event handlers
|
||||
void OnMouse(wxMouseEvent& event);
|
||||
void OnKeyDown(wxKeyEvent& event);
|
||||
void OnKeyUp(wxKeyEvent& event);
|
||||
void OnFocus(wxFocusEvent& event);
|
||||
void OnActivate(wxActivateEvent& event);
|
||||
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
// create input handler by name
|
||||
void CreateInputHandler(const wxString& inphandler);
|
||||
|
||||
// input processor (never deleted, the theme deletes it itself)
|
||||
wxInputHandler *m_handler;
|
||||
|
||||
private:
|
||||
// label and accel info
|
||||
wxString m_label;
|
||||
int m_indexAccel;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxControl)
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_CONTROL_H_
|
49
include/wx/univ/frame.h
Normal file
49
include/wx/univ/frame.h
Normal file
@@ -0,0 +1,49 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/frame.h
|
||||
// Purpose: wxFrame class for wxUniversal
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 19.05.01
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_FRAME_H_
|
||||
#define _WX_UNIV_FRAME_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "univframe.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxFrame
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class wxFrame : public wxFrameNative
|
||||
{
|
||||
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);
|
||||
|
||||
virtual wxPoint GetClientAreaOrigin() const;
|
||||
|
||||
protected:
|
||||
void OnSize(wxSizeEvent& event);
|
||||
|
||||
#if wxUSE_MENUS
|
||||
// override to update menu bar position when the frame size changes
|
||||
virtual void PositionMenuBar();
|
||||
#endif // wxUSE_MENUS
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxFrame)
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_FRAME_H_
|
74
include/wx/univ/gauge.h
Normal file
74
include/wx/univ/gauge.h
Normal file
@@ -0,0 +1,74 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/gauge.h
|
||||
// Purpose: wxUniversal wxGauge declaration
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 20.02.01
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "gaugeuniv.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// 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)
|
||||
};
|
117
include/wx/univ/inphand.h
Normal file
117
include/wx/univ/inphand.h
Normal file
@@ -0,0 +1,117 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// 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$
|
||||
// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows license
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_INPHAND_H_
|
||||
#define _WX_UNIV_INPHAND_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "inphand.h"
|
||||
#endif
|
||||
|
||||
#include "wx/control.h" // for wxControlAction(s)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// types of the standard input handlers which can be passed to
|
||||
// wxTheme::GetInputHandler()
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#define wxINP_HANDLER_DEFAULT _T("")
|
||||
#define wxINP_HANDLER_BUTTON _T("button")
|
||||
#define wxINP_HANDLER_CHECKBOX _T("checkbox")
|
||||
#define wxINP_HANDLER_CHECKLISTBOX _T("checklistbox")
|
||||
#define wxINP_HANDLER_COMBOBOX _T("combobox")
|
||||
#define wxINP_HANDLER_LISTBOX _T("listbox")
|
||||
#define wxINP_HANDLER_NOTEBOOK _T("notebook")
|
||||
#define wxINP_HANDLER_RADIOBTN _T("radiobtn")
|
||||
#define wxINP_HANDLER_SCROLLBAR _T("scrollbar")
|
||||
#define wxINP_HANDLER_SLIDER _T("slider")
|
||||
#define wxINP_HANDLER_SPINBTN _T("spinbtn")
|
||||
#define wxINP_HANDLER_TEXTCTRL _T("textctrl")
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxInputHandler: maps the events to the actions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxInputHandler
|
||||
{
|
||||
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(wxControl *control,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed) = 0;
|
||||
|
||||
// map a mouse (click) event to one or more actions
|
||||
virtual bool HandleMouse(wxControl *control,
|
||||
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(wxControl *control,
|
||||
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(wxControl *control, const wxFocusEvent& event);
|
||||
|
||||
// react to the app getting/losing activation
|
||||
//
|
||||
// return TRUE to refresh the control, FALSE otherwise
|
||||
virtual bool HandleActivation(wxControl *control, 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(wxControl *control,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed)
|
||||
{
|
||||
return m_handler ? m_handler->HandleKey(control, event, pressed)
|
||||
: FALSE;
|
||||
}
|
||||
|
||||
virtual bool HandleMouse(wxControl *control,
|
||||
const wxMouseEvent& event)
|
||||
{
|
||||
return m_handler ? m_handler->HandleMouse(control, event) : FALSE;
|
||||
}
|
||||
|
||||
virtual bool HandleMouseMove(wxControl *control, const wxMouseEvent& event)
|
||||
{
|
||||
return m_handler ? m_handler->HandleMouseMove(control, event) : FALSE;
|
||||
}
|
||||
|
||||
virtual bool HandleFocus(wxControl *control, const wxFocusEvent& event)
|
||||
{
|
||||
return m_handler ? m_handler->HandleFocus(control, event) : FALSE;
|
||||
}
|
||||
|
||||
private:
|
||||
wxInputHandler *m_handler;
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_INPHAND_H_
|
333
include/wx/univ/listbox.h
Normal file
333
include/wx/univ/listbox.h
Normal file
@@ -0,0 +1,333 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/listbox.h
|
||||
// Purpose: the universal listbox
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 30.08.00
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_LISTBOX_H_
|
||||
#define _WX_UNIV_LISTBOX_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "univlistbox.h"
|
||||
#endif
|
||||
|
||||
#include "wx/scrolwin.h" // for wxScrollHelper
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// the actions supported by this control
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// change the current item
|
||||
#define wxACTION_LISTBOX_SETFOCUS _T("setfocus") // select the item
|
||||
#define wxACTION_LISTBOX_MOVEDOWN _T("down") // select item below
|
||||
#define wxACTION_LISTBOX_MOVEUP _T("up") // select item above
|
||||
#define wxACTION_LISTBOX_PAGEDOWN _T("pagedown") // go page down
|
||||
#define wxACTION_LISTBOX_PAGEUP _T("pageup") // go page up
|
||||
#define wxACTION_LISTBOX_START _T("start") // go to first item
|
||||
#define wxACTION_LISTBOX_END _T("end") // go to last item
|
||||
#define wxACTION_LISTBOX_FIND _T("find") // find item by 1st letter
|
||||
|
||||
// do something with the current item
|
||||
#define wxACTION_LISTBOX_ACTIVATE _T("activate") // activate (choose)
|
||||
#define wxACTION_LISTBOX_TOGGLE _T("toggle") // togglee selected state
|
||||
#define wxACTION_LISTBOX_SELECT _T("select") // sel this, unsel others
|
||||
#define wxACTION_LISTBOX_SELECTADD _T("selectadd") // add to selection
|
||||
#define wxACTION_LISTBOX_UNSELECT _T("unselect") // unselect
|
||||
#define wxACTION_LISTBOX_ANCHOR _T("selanchor") // anchor selection
|
||||
|
||||
// do something with the selection globally (not for single selection ones)
|
||||
#define wxACTION_LISTBOX_SELECTALL _T("selectall") // select all items
|
||||
#define wxACTION_LISTBOX_UNSELECTALL _T("unselectall") // unselect all items
|
||||
#define wxACTION_LISTBOX_SELTOGGLE _T("togglesel") // invert the selection
|
||||
#define wxACTION_LISTBOX_EXTENDSEL _T("extend") // extend to item
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxListBox: a list of selectable items
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class wxListBox : public wxListBoxBase, public wxScrollHelper
|
||||
{
|
||||
public:
|
||||
// ctors and such
|
||||
wxListBox() { 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 )
|
||||
{
|
||||
Init();
|
||||
|
||||
Create(parent, id, pos, size, n, choices, style, validator, name);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
// implement the listbox interface defined by wxListBoxBase
|
||||
virtual void Clear();
|
||||
virtual void Delete(int n);
|
||||
|
||||
virtual int GetCount() const { return (int)m_strings.GetCount(); }
|
||||
virtual wxString GetString(int n) const { return m_strings[n]; }
|
||||
virtual void SetString(int n, const wxString& s);
|
||||
virtual int FindString(const wxString& s) const
|
||||
{ return m_strings.Index(s); }
|
||||
|
||||
virtual bool IsSelected(int n) const
|
||||
{ return m_selections.Index(n) != wxNOT_FOUND; }
|
||||
virtual void SetSelection(int n, bool select = TRUE);
|
||||
virtual int GetSelection() const;
|
||||
virtual int GetSelections(wxArrayInt& aSelections) const;
|
||||
|
||||
protected:
|
||||
virtual int DoAppend(const wxString& item);
|
||||
virtual void DoInsertItems(const wxArrayString& items, int pos);
|
||||
virtual void DoSetItems(const wxArrayString& items, void **clientData);
|
||||
|
||||
virtual void DoSetFirstItem(int n);
|
||||
|
||||
virtual void DoSetItemClientData(int n, void* clientData);
|
||||
virtual void* DoGetItemClientData(int n) const;
|
||||
virtual void DoSetItemClientObject(int n, wxClientData* clientData);
|
||||
virtual wxClientData* DoGetItemClientObject(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 Select(bool sel = TRUE, int item = -1);
|
||||
|
||||
// more readable wrapper
|
||||
void Unselect(int item) { Select(FALSE, item); }
|
||||
|
||||
// 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);
|
||||
|
||||
// let wxColourScheme choose the right colours for us
|
||||
virtual bool IsContainerWindow() const { return TRUE; }
|
||||
|
||||
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 OnIdle(wxIdleEvent& event);
|
||||
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)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxStdListboxInputHandler: handles mouse and kbd in a single or multi
|
||||
// selection listbox
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxStdListboxInputHandler : public wxStdInputHandler
|
||||
{
|
||||
public:
|
||||
// if pressing the mouse button in a multiselection listbox should toggle
|
||||
// the item under mouse immediately, then specify TRUE as the second
|
||||
// parameter (this is the standard behaviour, under GTK the item is toggled
|
||||
// only when the mouse is released in the multi selection listbox)
|
||||
wxStdListboxInputHandler(wxInputHandler *inphand,
|
||||
bool toggleOnPressAlways = TRUE);
|
||||
|
||||
// base class methods
|
||||
virtual bool HandleKey(wxControl *control,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed);
|
||||
virtual bool HandleMouse(wxControl *control,
|
||||
const wxMouseEvent& event);
|
||||
virtual bool HandleMouseMove(wxControl *control,
|
||||
const wxMouseEvent& event);
|
||||
|
||||
protected:
|
||||
// return the item under mouse, 0 if the mouse is above the listbox or
|
||||
// GetCount() if it is below it
|
||||
int HitTest(const wxListBox *listbox, const wxMouseEvent& event);
|
||||
|
||||
// parts of HitTest(): first finds the pseudo (because not in range) index
|
||||
// of the item and the second one adjusts it if necessary - that is if the
|
||||
// third one returns FALSE
|
||||
int HitTestUnsafe(const wxListBox *listbox, const wxMouseEvent& event);
|
||||
int FixItemIndex(const wxListBox *listbox, int item);
|
||||
bool IsValidIndex(const wxListBox *listbox, int item);
|
||||
|
||||
// init m_btnCapture and m_actionMouse
|
||||
wxControlAction SetupCapture(wxListBox *lbox,
|
||||
const wxMouseEvent& event,
|
||||
int item);
|
||||
|
||||
wxRenderer *m_renderer;
|
||||
|
||||
// the button which initiated the mouse capture (currently 0 or 1)
|
||||
int m_btnCapture;
|
||||
|
||||
// the action to perform when the mouse moves while we capture it
|
||||
wxControlAction m_actionMouse;
|
||||
|
||||
// the ctor parameter toggleOnPressAlways (see comments near it)
|
||||
bool m_toggleOnPressAlways;
|
||||
|
||||
// do we track the mouse outside the window when it is captured?
|
||||
bool m_trackMouseOutside;
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_LISTBOX_H_
|
284
include/wx/univ/menu.h
Normal file
284
include/wx/univ/menu.h
Normal file
@@ -0,0 +1,284 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/menu.h
|
||||
// Purpose: wxMenu and wxMenuBar classes for wxUniversal
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 05.05.01
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_MENU_H_
|
||||
#define _WX_UNIV_MENU_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "univmenu.h"
|
||||
#endif
|
||||
|
||||
#if wxUSE_ACCEL
|
||||
#include "wx/accel.h"
|
||||
#endif // wxUSE_ACCEL
|
||||
|
||||
#include "wx/dynarray.h"
|
||||
|
||||
// fwd declarations
|
||||
class WXDLLEXPORT wxMenuInfo;
|
||||
WX_DECLARE_OBJARRAY(wxMenuInfo, wxMenuInfoArray);
|
||||
|
||||
class wxPopupMenuWindow;
|
||||
|
||||
class WXDLLEXPORT wxRenderer;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxMenu helper classes, used in implementation only
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// used by wxRenderer
|
||||
class WXDLLEXPORT wxMenuGeometryInfo
|
||||
{
|
||||
public:
|
||||
// get the total size of the menu
|
||||
virtual wxSize GetSize() const = 0;
|
||||
|
||||
virtual ~wxMenuGeometryInfo();
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// 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 bool DoAppend(wxMenuItem *item);
|
||||
virtual bool 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();
|
||||
|
||||
// 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
|
||||
|
||||
// it calls out OnDismiss()
|
||||
friend wxPopupMenuWindow;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxMenu)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxMenuBar
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxMenuBar : public wxMenuBarBase
|
||||
{
|
||||
public:
|
||||
// ctors and dtor
|
||||
wxMenuBar(long WXUNUSED(style) = 0) { Init(); }
|
||||
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();
|
||||
|
||||
// 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 wxPopupMenuWindow;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxMenuBar)
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_MENU_H_
|
107
include/wx/univ/menuitem.h
Normal file
107
include/wx/univ/menuitem.h
Normal file
@@ -0,0 +1,107 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/menuitem.h
|
||||
// Purpose: wxMenuItem class for wxUniversal
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 05.05.01
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_MENUITEM_H_
|
||||
#define _WX_UNIV_MENUITEM_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "univmenuitem.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// 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,
|
||||
bool isCheckable = FALSE,
|
||||
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; }
|
||||
|
||||
// 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 != -1, _T("must call SetHeight first!") );
|
||||
|
||||
return m_posY;
|
||||
}
|
||||
|
||||
wxCoord GetHeight() const
|
||||
{
|
||||
wxASSERT_MSG( m_height != -1, _T("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;
|
||||
|
||||
// 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)
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_MENUITEM_H_
|
||||
|
276
include/wx/univ/notebook.h
Normal file
276
include/wx/univ/notebook.h
Normal file
@@ -0,0 +1,276 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/notebook.h
|
||||
// Purpose: universal version of wxNotebook
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 01.02.01
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_NOTEBOOK_H_
|
||||
#define _WX_UNIV_NOTEBOOK_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "univnotebook.h"
|
||||
#endif
|
||||
|
||||
class WXDLLEXPORT wxSpinButton;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// the actions supported by this control
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// change the page: to the next/previous/given one
|
||||
#define wxACTION_NOTEBOOK_NEXT _T("nexttab")
|
||||
#define wxACTION_NOTEBOOK_PREV _T("prevtab")
|
||||
#define wxACTION_NOTEBOOK_GOTO _T("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 = wxNOTEBOOK_NAME)
|
||||
{
|
||||
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 = wxNOTEBOOK_NAME);
|
||||
|
||||
// dtor
|
||||
virtual ~wxNotebook();
|
||||
|
||||
// implement wxNotebookBase pure virtuals
|
||||
// --------------------------------------
|
||||
|
||||
virtual int SetSelection(int nPage);
|
||||
virtual int GetSelection() const { return m_sel; }
|
||||
|
||||
virtual bool SetPageText(int nPage, const wxString& strText);
|
||||
virtual wxString GetPageText(int nPage) const;
|
||||
|
||||
virtual int GetPageImage(int nPage) const;
|
||||
virtual bool SetPageImage(int 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);
|
||||
|
||||
virtual bool DeleteAllPages();
|
||||
|
||||
virtual bool InsertPage(int 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 GetWindowStyle() & wxNB_FIXEDWIDTH != 0; }
|
||||
|
||||
// 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
|
||||
// -----------
|
||||
|
||||
// return the tab at this position or -1 if none
|
||||
int HitTest(const wxPoint& pt) const;
|
||||
|
||||
// input handling
|
||||
// --------------
|
||||
|
||||
virtual bool PerformAction(const wxControlAction& action,
|
||||
long numArg = 0l,
|
||||
const wxString& strArg = wxEmptyString);
|
||||
|
||||
// refresh the currently selected tab
|
||||
void RefreshCurrent();
|
||||
|
||||
protected:
|
||||
virtual wxNotebookPage *DoRemovePage(int 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);
|
||||
|
||||
// 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);
|
||||
|
||||
// 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;
|
||||
|
||||
// change thep age and send events about it (can be vetoed by user code)
|
||||
void ChangePage(int nPage);
|
||||
|
||||
// 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)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxStdNotebookInputHandler: translates SPACE and ENTER keys and the left mouse
|
||||
// click into button press/release actions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxStdNotebookInputHandler : public wxStdInputHandler
|
||||
{
|
||||
public:
|
||||
wxStdNotebookInputHandler(wxInputHandler *inphand);
|
||||
|
||||
virtual bool HandleKey(wxControl *control,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed);
|
||||
virtual bool HandleMouse(wxControl *control,
|
||||
const wxMouseEvent& event);
|
||||
virtual bool HandleMouseMove(wxControl *control, const wxMouseEvent& event);
|
||||
virtual bool HandleFocus(wxControl *control, const wxFocusEvent& event);
|
||||
virtual bool HandleActivation(wxControl *control, bool activated);
|
||||
|
||||
protected:
|
||||
void HandleFocusChange(wxControl *control);
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_NOTEBOOK_H_
|
||||
|
140
include/wx/univ/radiobox.h
Normal file
140
include/wx/univ/radiobox.h
Normal file
@@ -0,0 +1,140 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/radiobox.h
|
||||
// Purpose: wxRadioBox declaration
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 11.09.00
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows license
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_RADIOBOX_H_
|
||||
#define _WX_UNIV_RADIOBOX_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "univradiobox.h"
|
||||
#endif
|
||||
|
||||
class WXDLLEXPORT wxRadioButton;
|
||||
|
||||
#include "wx/statbox.h"
|
||||
#include "wx/dynarray.h"
|
||||
|
||||
WX_DEFINE_ARRAY(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);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
virtual ~wxRadioBox();
|
||||
|
||||
// implement wxRadioBox interface
|
||||
virtual void SetSelection(int n);
|
||||
virtual int GetSelection() const;
|
||||
|
||||
virtual int GetCount() const { return m_buttons.GetCount(); }
|
||||
virtual int GetColumnCount() const { return m_numCols; }
|
||||
virtual int GetRowCount() const { return m_numRows; }
|
||||
|
||||
virtual wxString GetString(int n) const;
|
||||
virtual void SetString(int n, const wxString& label);
|
||||
|
||||
virtual void Enable(int n, bool enable = TRUE);
|
||||
virtual void Show(int n, bool show = TRUE);
|
||||
|
||||
// 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);
|
||||
|
||||
// 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();
|
||||
|
||||
// check that the index is valid
|
||||
bool IsValid(int n) const { return n >= 0 && n < GetCount(); }
|
||||
|
||||
// sets m_majorDim and calculate m_numCols and m_numRows
|
||||
void SetMajorDim(int majorDim);
|
||||
|
||||
// calculate the max size of all buttons
|
||||
wxSize GetMaxButtonSize() const;
|
||||
|
||||
// the currently selected radio button or -1
|
||||
int m_selection;
|
||||
|
||||
// the parameters defining the button layout: majorDim meaning depends on
|
||||
// the style and is the (max) number of columns if it includes
|
||||
// wxRA_SPECIFY_COLS and is the (max) number of rows if it includes
|
||||
// wxRA_SPECIFY_ROWS - the number of rows and columns is calculated from
|
||||
// it
|
||||
int m_majorDim,
|
||||
m_numCols,
|
||||
m_numRows;
|
||||
|
||||
// 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_
|
80
include/wx/univ/radiobut.h
Normal file
80
include/wx/univ/radiobut.h
Normal file
@@ -0,0 +1,80 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/radiobut.h
|
||||
// Purpose: wxRadioButton declaration
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 10.09.00
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows license
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_RADIOBUT_H_
|
||||
#define _WX_UNIV_RADIOBUT_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "univradiobut.h"
|
||||
#endif
|
||||
|
||||
#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_
|
704
include/wx/univ/renderer.h
Normal file
704
include/wx/univ/renderer.h
Normal file
@@ -0,0 +1,704 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/renderer.h
|
||||
// Purpose: wxRenderer class declaration
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 06.08.00
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows license
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*
|
||||
wxRenderer class is used to draw all wxWindows 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)
|
||||
*/
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "renderer.h"
|
||||
#endif
|
||||
|
||||
#ifndef _WX_UNIV_RENDERER_H_
|
||||
#define _WX_UNIV_RENDERER_H_
|
||||
|
||||
class WXDLLEXPORT wxDC;
|
||||
class WXDLLEXPORT wxCheckListBox;
|
||||
class WXDLLEXPORT wxListBox;
|
||||
class WXDLLEXPORT wxMenu;
|
||||
class WXDLLEXPORT wxScrollBar;
|
||||
class WXDLLEXPORT wxTextCtrl;
|
||||
class WXDLLEXPORT wxWindow;
|
||||
|
||||
#include "wx/string.h"
|
||||
#include "wx/gdicmn.h"
|
||||
#include "wx/scrolbar.h" // for wxScrollBar::Element
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/menu.h" // for wxMenuGeometryInfo
|
||||
#endif // WX_PRECOMP
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxRenderer: abstract renderers interface
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxRenderer
|
||||
{
|
||||
public:
|
||||
// drawing functions
|
||||
// -----------------
|
||||
|
||||
// draw the controls background
|
||||
virtual void DrawBackground(wxDC& dc,
|
||||
const wxColour& col,
|
||||
const wxRect& rect,
|
||||
int flags) = 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 accomodate 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;
|
||||
|
||||
// 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;
|
||||
|
||||
// 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;
|
||||
|
||||
// draw the slider shaft
|
||||
virtual void DrawSliderShaft(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
wxOrientation orient,
|
||||
int flags = 0,
|
||||
wxRect *rectShaft = NULL) = 0;
|
||||
|
||||
// draw the slider thumb
|
||||
virtual void DrawSliderThumb(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
wxOrientation orient,
|
||||
int flags = 0) = 0;
|
||||
|
||||
// draw the slider ticks
|
||||
virtual void DrawSliderTicks(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
const wxSize& sizeThumb,
|
||||
wxOrientation orient,
|
||||
int start,
|
||||
int end,
|
||||
int step = 1,
|
||||
int flags = 0) = 0;
|
||||
|
||||
// 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;
|
||||
|
||||
// misc functions
|
||||
// --------------
|
||||
|
||||
// return the bitmaps to use for combobox button
|
||||
virtual void GetComboBitmaps(wxBitmap *bmpNormal,
|
||||
wxBitmap *bmpPressed,
|
||||
wxBitmap *bmpDisabled) = 0;
|
||||
|
||||
// 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;
|
||||
|
||||
// get the size of a scrollbar arrow
|
||||
virtual wxSize GetScrollbarArrowSize() const = 0;
|
||||
|
||||
// gets the bounding box for a scrollbar element for the given (by default
|
||||
// - current) thumb position
|
||||
virtual wxRect GetScrollbarRect(const wxScrollBar *scrollbar,
|
||||
wxScrollBar::Element elem,
|
||||
int thumbPos = -1) const = 0;
|
||||
|
||||
// returns the size of the scrollbar shaft excluding the arrows
|
||||
virtual wxCoord GetScrollbarSize(const wxScrollBar *scrollbar) = 0;
|
||||
|
||||
// returns one of wxHT_SCROLLBAR_XXX constants
|
||||
virtual wxHitTest HitTestScrollbar(const wxScrollBar *scrollbar,
|
||||
const wxPoint& pt) const = 0;
|
||||
|
||||
// translate the scrollbar position (in logical units) into physical
|
||||
// coordinate (in pixels) and the other way round
|
||||
virtual wxCoord ScrollbarToPixel(const wxScrollBar *scrollbar,
|
||||
int thumbPos = -1) = 0;
|
||||
virtual int PixelToScrollbar(const wxScrollBar *scrollbar,
|
||||
wxCoord coord) = 0;
|
||||
|
||||
// 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;
|
||||
|
||||
// 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) = 0;
|
||||
|
||||
// extra space is for line indicators
|
||||
virtual wxRect GetTextClientArea(const wxTextCtrl *text,
|
||||
const wxRect& rectTotal,
|
||||
wxCoord *extraSpaceBeyond) = 0;
|
||||
|
||||
// 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;
|
||||
|
||||
// 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,
|
||||
wxOrientation orient) const = 0;
|
||||
|
||||
// get the size of the slider thumb for the given total slider rect
|
||||
virtual wxSize GetSliderThumbSize(const wxRect& rect,
|
||||
wxOrientation orient) const = 0;
|
||||
|
||||
// get the size of one progress bar step (in horz and vertical directions)
|
||||
virtual wxSize GetProgressBarStep() const = 0;
|
||||
|
||||
// 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;
|
||||
|
||||
// virtual dtor for any base class
|
||||
virtual ~wxRenderer();
|
||||
|
||||
protected:
|
||||
// draw a frame around rectFrame rectangle but not touching the rectLabel
|
||||
// one: this is used by DrawFrame()
|
||||
void StandardDrawFrame(wxDC& dc,
|
||||
const wxRect& rectFrame,
|
||||
const wxRect& rectLabel);
|
||||
|
||||
// standard text line drawing: just use DrawText() and highlight the
|
||||
// selected part
|
||||
static void StandardDrawTextLine(wxDC& dc,
|
||||
const wxString& text,
|
||||
const wxRect& rect,
|
||||
int selStart, int selEnd,
|
||||
int flags);
|
||||
|
||||
// standard scrollbar hit testing: this assumes that it only has 2 arrows
|
||||
// and a thumb, so the themes which have more complicated scrollbars (e.g.
|
||||
// BeOS) can't use this method
|
||||
static wxRect StandardGetScrollbarRect(const wxScrollBar *scrollbar,
|
||||
wxScrollBar::Element elem,
|
||||
int thumbPos,
|
||||
const wxSize& sizeArrow);
|
||||
static wxHitTest StandardHitTestScrollbar(const wxScrollBar *scrollbar,
|
||||
const wxPoint& pt,
|
||||
const wxSize& sizeArrow);
|
||||
static wxCoord StandardScrollbarToPixel(const wxScrollBar *scrollbar,
|
||||
int thumbPos,
|
||||
const wxSize& sizeArrow);
|
||||
static int StandardPixelToScrollbar(const wxScrollBar *scrollbar,
|
||||
wxCoord coord,
|
||||
const wxSize& sizeArrow);
|
||||
static wxCoord StandardScrollBarSize(const wxScrollBar *scrollbar,
|
||||
const wxSize& sizeArrow);
|
||||
static void StandardScrollBarThumbSize(wxCoord lenBar,
|
||||
int thumbPos,
|
||||
int thumbSize,
|
||||
int range,
|
||||
wxCoord *thumbStart,
|
||||
wxCoord *thumbEnd);
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// 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)
|
||||
{ m_renderer->DrawBackground(dc, col, 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); }
|
||||
virtual void DrawTextLine(wxDC& dc,
|
||||
const wxString& text,
|
||||
const wxRect& rect,
|
||||
int selStart = -1,
|
||||
int selEnd = -1)
|
||||
{ m_renderer->DrawTextLine(dc, text, rect, selStart, selEnd); }
|
||||
virtual void DrawLineWrapMark(wxDC& dc, const wxRect& rect)
|
||||
{ m_renderer->DrawLineWrapMark(dc, rect); }
|
||||
|
||||
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); }
|
||||
|
||||
virtual void DrawSliderShaft(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
wxOrientation orient,
|
||||
int flags = 0,
|
||||
wxRect *rectShaft = NULL)
|
||||
{ m_renderer->DrawSliderShaft(dc, rect, orient, flags, rectShaft); }
|
||||
virtual void DrawSliderThumb(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
wxOrientation orient,
|
||||
int flags = 0)
|
||||
{ m_renderer->DrawSliderThumb(dc, rect, orient, flags); }
|
||||
virtual void DrawSliderTicks(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
const wxSize& sizeThumb,
|
||||
wxOrientation orient,
|
||||
int start,
|
||||
int end,
|
||||
int step = 1,
|
||||
int flags = 0)
|
||||
{ m_renderer->DrawSliderTicks(dc, rect, sizeThumb, orient,
|
||||
start, end, start, flags); }
|
||||
|
||||
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); }
|
||||
|
||||
virtual void GetComboBitmaps(wxBitmap *bmpNormal,
|
||||
wxBitmap *bmpPressed,
|
||||
wxBitmap *bmpDisabled)
|
||||
{ m_renderer->GetComboBitmaps(bmpNormal, bmpPressed, bmpDisabled); }
|
||||
|
||||
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(); }
|
||||
|
||||
virtual wxSize GetScrollbarArrowSize() const
|
||||
{ return m_renderer->GetScrollbarArrowSize(); }
|
||||
virtual wxRect GetScrollbarRect(const wxScrollBar *scrollbar,
|
||||
wxScrollBar::Element elem,
|
||||
int thumbPos = -1) const
|
||||
{ return m_renderer->GetScrollbarRect(scrollbar, elem, thumbPos); }
|
||||
virtual wxCoord GetScrollbarSize(const wxScrollBar *scrollbar)
|
||||
{ return m_renderer->GetScrollbarSize(scrollbar); }
|
||||
virtual wxHitTest HitTestScrollbar(const wxScrollBar *scrollbar,
|
||||
const wxPoint& pt) const
|
||||
{ return m_renderer->HitTestScrollbar(scrollbar, pt); }
|
||||
virtual wxCoord ScrollbarToPixel(const wxScrollBar *scrollbar,
|
||||
int thumbPos = -1)
|
||||
{ return m_renderer->ScrollbarToPixel(scrollbar, thumbPos); }
|
||||
virtual int PixelToScrollbar(const wxScrollBar *scrollbar,
|
||||
wxCoord coord)
|
||||
{ return m_renderer->PixelToScrollbar(scrollbar, coord); }
|
||||
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(); }
|
||||
|
||||
virtual wxRect GetTextTotalArea(const wxTextCtrl *text, const wxRect& rect)
|
||||
{ return m_renderer->GetTextTotalArea(text, rect); }
|
||||
virtual wxRect GetTextClientArea(const wxTextCtrl *text,
|
||||
const wxRect& rect,
|
||||
wxCoord *extraSpaceBeyond)
|
||||
{ return m_renderer->GetTextClientArea(text, rect, extraSpaceBeyond); }
|
||||
|
||||
virtual wxSize GetTabIndent() const { return m_renderer->GetTabIndent(); }
|
||||
virtual wxSize GetTabPadding() const { return m_renderer->GetTabPadding(); }
|
||||
|
||||
virtual wxCoord GetSliderDim() const
|
||||
{ return m_renderer->GetSliderDim(); }
|
||||
virtual wxCoord GetSliderTickLen() const
|
||||
{ return m_renderer->GetSliderTickLen(); }
|
||||
virtual wxRect GetSliderShaftRect(const wxRect& rect,
|
||||
wxOrientation orient) const
|
||||
{ return GetSliderShaftRect(rect, orient); }
|
||||
virtual wxSize GetSliderThumbSize(const wxRect& rect,
|
||||
wxOrientation orient) const
|
||||
{ return m_renderer->GetSliderThumbSize(rect, orient); }
|
||||
virtual wxSize GetProgressBarStep() const
|
||||
{ return m_renderer->GetProgressBarStep(); }
|
||||
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); }
|
||||
|
||||
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:
|
||||
// common part of DrawItems() and DrawCheckItems()
|
||||
void DoDrawItems(const wxListBox *listbox,
|
||||
size_t itemFirst, size_t itemLast,
|
||||
bool isCheckLbox = FALSE);
|
||||
|
||||
wxWindow *m_window;
|
||||
wxRenderer *m_renderer;
|
||||
wxDC& m_dc;
|
||||
wxRect m_rect;
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_RENDERER_H_
|
||||
|
113
include/wx/univ/scrarrow.h
Normal file
113
include/wx/univ/scrarrow.h
Normal file
@@ -0,0 +1,113 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/scrarrow.h
|
||||
// Purpose: wxScrollArrows class
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 22.01.01
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_SCRARROW_H_
|
||||
#define _WX_UNIV_SCRARROW_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "univscrarrow.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// 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::HitTest()
|
||||
// says that the mosue 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:
|
||||
// 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 HitTest(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_
|
243
include/wx/univ/scrolbar.h
Normal file
243
include/wx/univ/scrolbar.h
Normal file
@@ -0,0 +1,243 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/scrolbar.h
|
||||
// Purpose: wxScrollBar for wxUniversal
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 20.08.00
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows license
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_SCROLBAR_H_
|
||||
#define _WX_UNIV_SCROLBAR_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "univscrolbar.h"
|
||||
#endif
|
||||
|
||||
class WXDLLEXPORT wxScrollTimer;
|
||||
|
||||
#include "wx/univ/scrarrow.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// the actions supported by this control
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// scroll the bar
|
||||
#define wxACTION_SCROLL_START _T("start") // to the beginning
|
||||
#define wxACTION_SCROLL_END _T("end") // to the end
|
||||
#define wxACTION_SCROLL_LINE_UP _T("lineup") // one line up/left
|
||||
#define wxACTION_SCROLL_PAGE_UP _T("pageup") // one page up/left
|
||||
#define wxACTION_SCROLL_LINE_DOWN _T("linedown") // one line down/right
|
||||
#define wxACTION_SCROLL_PAGE_DOWN _T("pagedown") // one page down/right
|
||||
|
||||
// the scrollbar thumb may be dragged
|
||||
#define wxACTION_SCROLL_THUMB_DRAG _T("thumbdrag")
|
||||
#define wxACTION_SCROLL_THUMB_MOVE _T("thumbmove")
|
||||
#define wxACTION_SCROLL_THUMB_RELEASE _T("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();
|
||||
void ScrollLines(int nLines);
|
||||
void ScrollPages(int nPages);
|
||||
|
||||
virtual bool PerformAction(const wxControlAction& action,
|
||||
long numArg = 0,
|
||||
const wxString& strArg = wxEmptyString);
|
||||
|
||||
// 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 HitTest(const wxPoint& pt) const;
|
||||
|
||||
// for wxControlRenderer::DrawScrollbar() only
|
||||
const wxScrollArrows& GetArrows() const { return m_arrows; }
|
||||
|
||||
protected:
|
||||
virtual wxSize DoGetBestClientSize() const;
|
||||
virtual void DoDraw(wxControlRenderer *renderer);
|
||||
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
|
||||
|
||||
// event handlers
|
||||
void OnIdle(wxIdleEvent& event);
|
||||
|
||||
// SetThumbPosition() helper
|
||||
void DoSetThumb(int thumbPos);
|
||||
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
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;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxScrollBar)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// common scrollbar input handler: it manages clicks on the standard scrollbar
|
||||
// elements (line arrows, bar, thumb)
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
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(wxControl *control,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed);
|
||||
virtual bool HandleMouse(wxControl *control,
|
||||
const wxMouseEvent& event);
|
||||
virtual bool HandleMouseMove(wxControl *control, 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:
|
||||
// the methods which must be overridden in the derived class
|
||||
|
||||
// return TRUE if the mouse button can be used to activate scrollbar, FALSE
|
||||
// if not (only left mouse button can do it under Windows, any button under
|
||||
// GTK+)
|
||||
virtual bool IsAllowedButton(int button) = 0;
|
||||
|
||||
// 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_
|
||||
|
142
include/wx/univ/scrthumb.h
Normal file
142
include/wx/univ/scrthumb.h
Normal file
@@ -0,0 +1,142 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/scrthumb.h
|
||||
// Purpose: wxScrollThumb class
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 12.02.01
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_SCRTHUMB_H_
|
||||
#define _WX_UNIV_SCRTHUMB_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "univscrthumb.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// 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:
|
||||
// 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_
|
41
include/wx/univ/scrtimer.h
Normal file
41
include/wx/univ/scrtimer.h
Normal file
@@ -0,0 +1,41 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// 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$
|
||||
// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// NB: this class is implemented in scrolbar.cpp
|
||||
|
||||
#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;
|
||||
};
|
||||
|
160
include/wx/univ/setup.h
Normal file
160
include/wx/univ/setup.h
Normal file
@@ -0,0 +1,160 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/setup.h
|
||||
// Purpose: configuration settings for wxUniversal/MSW
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 14.08.00
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows license
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_SETUP_H_
|
||||
#define _WX_UNIV_SETUP_H_
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// undef everything
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#define wxUSE_GUI 1
|
||||
#define WXWIN_COMPATIBILITY 0
|
||||
#define wxICON_IS_BITMAP 0
|
||||
#define wxFONT_SIZE_COMPATIBILITY 0
|
||||
#define wxDIALOG_UNIT_COMPATIBILITY 0
|
||||
#define wxUSE_DEBUG_CONTEXT 0
|
||||
#define wxUSE_MEMORY_TRACING 0
|
||||
#define wxUSE_GLOBAL_MEMORY_OPERATORS 0
|
||||
#define wxUSE_DEBUG_NEW_ALWAYS 0
|
||||
#define wxUSE_ON_FATAL_EXCEPTION 0
|
||||
|
||||
#define wxUSE_UNICODE 0
|
||||
#define wxUSE_WCHAR_T 0
|
||||
#define wxUSE_LOG 1
|
||||
#define wxUSE_THREADS 0
|
||||
#define wxUSE_STREAMS 0
|
||||
#define wxUSE_STD_IOSTREAM 0
|
||||
#define wxUSE_SERIAL 0
|
||||
#define wxUSE_LONGLONG 1
|
||||
#define wxUSE_TIMER 1
|
||||
#define wxUSE_STOPWATCH 1
|
||||
#define wxUSE_TIMEDATE 0
|
||||
#define wxUSE_DATETIME 0
|
||||
#define wxUSE_CONFIG 0
|
||||
#define wxUSE_CONFIG_NATIVE 0
|
||||
#define wxUSE_DIALUP_MANAGER 0
|
||||
#define wxUSE_DYNLIB_CLASS 0
|
||||
#define wxUSE_SOCKETS 0
|
||||
#define wxUSE_FILESYSTEM 0
|
||||
#define wxUSE_FS_ZIP 0
|
||||
#define wxUSE_FS_INET 0
|
||||
#define wxUSE_ZIPSTREAM 0
|
||||
#define wxUSE_ZLIB 0
|
||||
#define wxUSE_FILESYSTEM 0
|
||||
#define wxUSE_FS_ZIP 0
|
||||
#define wxUSE_FS_INET 0
|
||||
#define wxUSE_ZIPSTREAM 0
|
||||
#define wxUSE_ZLIB 0
|
||||
#define wxUSE_APPLE_IEEE 0
|
||||
#define wxUSE_FILE 0
|
||||
#define wxUSE_FFILE 1
|
||||
#define wxUSE_TEXTFILE 0
|
||||
#define wxUSE_INTL 0
|
||||
#define wxUSE_MENUS 1
|
||||
#define wxUSE_TOOLBAR 0
|
||||
#define wxUSE_TOOLBAR_NATIVE 0
|
||||
#define wxUSE_TOOLBAR_SIMPLE 0
|
||||
#define wxUSE_NOTEBOOK 1
|
||||
#define wxUSE_FONTMAP 0
|
||||
#define wxUSE_MIMETYPE 0
|
||||
|
||||
#define wxUSE_CONTROLS 1
|
||||
#define wxUSE_POPUPWIN 1
|
||||
#define wxUSE_BUTTON 1
|
||||
#define wxUSE_BMPBUTTON 1
|
||||
#define wxUSE_CARET 1
|
||||
#define wxUSE_CHECKBOX 1
|
||||
#define wxUSE_CHECKLISTBOX 1
|
||||
#define wxUSE_CHOICE 0
|
||||
#define wxUSE_COMBOBOX 1
|
||||
#define wxUSE_GAUGE 1
|
||||
#define wxUSE_LISTBOX 1
|
||||
#define wxUSE_LISTCTRL 0
|
||||
#define wxUSE_RADIOBOX 1
|
||||
#define wxUSE_RADIOBTN 1
|
||||
#define wxUSE_SASH 0
|
||||
#define wxUSE_SCROLLBAR 1
|
||||
#define wxUSE_SLIDER 1
|
||||
#define wxUSE_SPINBTN 1
|
||||
#define wxUSE_SPINCTRL 1
|
||||
#define wxUSE_STATBOX 1
|
||||
#define wxUSE_STATLINE 1
|
||||
#define wxUSE_STATTEXT 1
|
||||
#define wxUSE_STATBMP 1
|
||||
#define wxUSE_STATUSBAR 0
|
||||
#define wxUSE_TEXTCTRL 1
|
||||
#define wxUSE_TOOLTIPS 0
|
||||
#define wxUSE_TREECTRL 0
|
||||
|
||||
#define wxUSE_NATIVE_STATUSBAR 0
|
||||
#define wxUSE_BUTTONBAR 0
|
||||
#define wxUSE_GRID 0
|
||||
#define wxUSE_NEW_GRID 0
|
||||
#define wxUSE_VALIDATORS 0
|
||||
#define wxUSE_ACCEL 1
|
||||
#define wxUSE_GENERIC_DIALOGS_IN_MSW 0
|
||||
#define wxUSE_COMMON_DIALOGS 0
|
||||
#define wxUSE_TEXTDLG 0
|
||||
#define wxUSE_PROGRESSDLG 0
|
||||
#define wxUSE_BUSYINFO 0
|
||||
#define wxUSE_DIRDLG 0
|
||||
#define wxUSE_FONTDLG 0
|
||||
#define wxUSE_FILEDLG 0
|
||||
#define wxUSE_TEXTDLG 0
|
||||
#define wxUSE_CHOICEDLG 0
|
||||
#define wxUSE_NUMBERDLG 0
|
||||
#define wxUSE_STARTUP_TIPS 0
|
||||
|
||||
#define wxUSE_METAFILE 0
|
||||
#define wxUSE_ENH_METAFILE 0
|
||||
#define wxUSE_WIN_METAFILES_ALWAYS 0
|
||||
#define wxUSE_DOC_VIEW_ARCHITECTURE 0
|
||||
#define wxUSE_MDI_ARCHITECTURE 0
|
||||
#define wxUSE_PRINTING_ARCHITECTURE 0
|
||||
#define wxUSE_HTML 0
|
||||
#define wxUSE_PLOT 0
|
||||
#define wxUSE_GLCANVAS 0
|
||||
#define wxUSE_TREELAYOUT 0
|
||||
#define wxUSE_IPC 0
|
||||
#define wxUSE_HELP 0
|
||||
#define wxUSE_MS_HTML_HELP 0
|
||||
#define wxUSE_RESOURCES 0
|
||||
#define wxUSE_CONSTRAINTS 1
|
||||
#define wxUSE_CLIPBOARD 1
|
||||
#define wxUSE_DATAOBJ 1
|
||||
#define wxUSE_SPLINES 0
|
||||
#define wxUSE_DRAG_AND_DROP 0
|
||||
#define wxUSE_XPM_IN_MSW 1
|
||||
#define wxUSE_IMAGE_LOADING_IN_MSW 1
|
||||
#define wxUSE_RESOURCE_LOADING_IN_MSW 0
|
||||
#define wxUSE_WX_RESOURCES 0
|
||||
#define wxUSE_POSTSCRIPT 0
|
||||
#define wxUSE_AFM_FOR_POSTSCRIPT 0
|
||||
#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 0
|
||||
#define wxUSE_ODBC 0
|
||||
#define wxODBC_FWD_ONLY_CURSORS 0
|
||||
#define wxODBC_BACKWARD_COMPATABILITY 0
|
||||
#define REMOVE_UNUSED_ARG 1
|
||||
#define wxUSE_IOSTREAMH 0
|
||||
#define wxUSE_LIBPNG 0
|
||||
#define wxUSE_LIBJPEG 0
|
||||
#define wxUSE_LIBTIFF 0
|
||||
#define wxUSE_GIF 0
|
||||
#define wxUSE_PNM 0
|
||||
#define wxUSE_PCX 0
|
||||
#define wxUSE_MFC 0
|
||||
#define wxUSE_OLE 0
|
||||
#define wxUSE_CTL3D 0
|
||||
#define wxUSE_ITSY_BITSY 0
|
||||
#define wxUSE_DYNAMIC_CLASSES 1
|
||||
|
||||
#endif // _WX_UNIV_SETUP_H_
|
245
include/wx/univ/slider.h
Normal file
245
include/wx/univ/slider.h
Normal file
@@ -0,0 +1,245 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/slider.h
|
||||
// Purpose: wxSlider control for wxUniversal
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 09.02.01
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "univslider.h"
|
||||
#endif
|
||||
|
||||
#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 _T("start") // to the beginning
|
||||
#define wxACTION_SLIDER_END _T("end") // to the end
|
||||
#define wxACTION_SLIDER_LINE_UP _T("lineup") // one line up/left
|
||||
#define wxACTION_SLIDER_PAGE_UP _T("pageup") // one page up/left
|
||||
#define wxACTION_SLIDER_LINE_DOWN _T("linedown") // one line down/right
|
||||
#define wxACTION_SLIDER_PAGE_DOWN _T("pagedown") // one page down/right
|
||||
#define wxACTION_SLIDER_PAGE_CHANGE _T("pagechange")// change page by numArg
|
||||
|
||||
#define wxACTION_SLIDER_THUMB_DRAG _T("thumbdrag")
|
||||
#define wxACTION_SLIDER_THUMB_MOVE _T("thumbmove")
|
||||
#define wxACTION_SLIDER_THUMB_RELEASE _T("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; }
|
||||
|
||||
// do we have ticks?
|
||||
bool HasTicks() const { return (GetWindowStyle() & wxSL_TICKS) != 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 wxStdSliderButtonInputHandler
|
||||
wxScrollThumb& GetThumb() { return m_thumb; }
|
||||
|
||||
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; }
|
||||
|
||||
virtual bool PerformAction(const wxControlAction& action,
|
||||
long numArg = 0,
|
||||
const wxString& strArg = wxEmptyString);
|
||||
|
||||
// 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)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxStdSliderButtonInputHandler: default slider input handling
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxStdSliderButtonInputHandler : public wxStdInputHandler
|
||||
{
|
||||
public:
|
||||
// default ctor
|
||||
wxStdSliderButtonInputHandler(wxInputHandler *inphand)
|
||||
: wxStdInputHandler(inphand)
|
||||
{
|
||||
}
|
||||
|
||||
// base class methods
|
||||
virtual bool HandleKey(wxControl *control,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed);
|
||||
virtual bool HandleMouse(wxControl *control,
|
||||
const wxMouseEvent& event);
|
||||
virtual bool HandleMouseMove(wxControl *control,
|
||||
const wxMouseEvent& event);
|
||||
|
||||
virtual bool HandleFocus(wxControl *control, const wxFocusEvent& event);
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_SLIDER_H_
|
120
include/wx/univ/spinbutt.h
Normal file
120
include/wx/univ/spinbutt.h
Normal file
@@ -0,0 +1,120 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/spinbutt.h
|
||||
// Purpose: universal version of wxSpinButton
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 21.01.01
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_SPINBUTT_H_
|
||||
#define _WX_UNIV_SPINBUTT_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "univspinbutt.h"
|
||||
#endif
|
||||
|
||||
#include "wx/univ/scrarrow.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxSpinButton
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// actions supported by this control
|
||||
#define wxACTION_SPIN_INC _T("inc")
|
||||
#define wxACTION_SPIN_DEC _T("dec")
|
||||
|
||||
class WXDLLEXPORT wxSpinButton : public wxSpinButtonBase,
|
||||
public wxControlWithArrows
|
||||
{
|
||||
public:
|
||||
wxSpinButton();
|
||||
wxSpinButton(wxWindow *parent,
|
||||
wxWindowID id = -1,
|
||||
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 = -1,
|
||||
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 HitTest(const wxPoint& pt) const;
|
||||
|
||||
// for wxStdSpinButtonInputHandler
|
||||
const wxScrollArrows& GetArrows() { return m_arrows; }
|
||||
|
||||
protected:
|
||||
virtual wxSize DoGetBestClientSize() const;
|
||||
virtual void DoDraw(wxControlRenderer *renderer);
|
||||
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
|
||||
|
||||
virtual bool PerformAction(const wxControlAction& action,
|
||||
long numArg = 0,
|
||||
const wxString& strArg = wxEmptyString);
|
||||
|
||||
// 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(wxControl *control,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed);
|
||||
virtual bool HandleMouse(wxControl *control,
|
||||
const wxMouseEvent& event);
|
||||
virtual bool HandleMouseMove(wxControl *control,
|
||||
const wxMouseEvent& event);
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_SPINBUTT_H_
|
||||
|
75
include/wx/univ/statbmp.h
Normal file
75
include/wx/univ/statbmp.h
Normal file
@@ -0,0 +1,75 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/statbmp.h
|
||||
// Purpose: wxStaticBitmap class for wxUniversal
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 25.08.00
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_STATBMP_H_
|
||||
#define _WX_UNIV_STATBMP_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "univstatbmp.h"
|
||||
#endif
|
||||
|
||||
#include "wx/bitmap.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxStaticBitmap
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class wxStaticBitmap : public wxStaticBitmapBase
|
||||
{
|
||||
public:
|
||||
wxStaticBitmap()
|
||||
{
|
||||
}
|
||||
|
||||
wxStaticBitmap(wxWindow *parent,
|
||||
const wxBitmap& label,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0)
|
||||
{
|
||||
Create(parent, -1, 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;
|
||||
|
||||
private:
|
||||
virtual void DoDraw(wxControlRenderer *renderer);
|
||||
|
||||
// the bitmap which we show
|
||||
wxBitmap m_bitmap;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxStaticBitmap)
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_STATBMP_H_
|
65
include/wx/univ/statbox.h
Normal file
65
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$
|
||||
// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows license
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_STATBOX_H_
|
||||
#define _WX_UNIV_STATBOX_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "univstatbox.h"
|
||||
#endif
|
||||
|
||||
class WXDLLEXPORT wxStaticBox : public wxStaticBoxBase
|
||||
{
|
||||
public:
|
||||
wxStaticBox() { }
|
||||
|
||||
wxStaticBox(wxWindow *parent,
|
||||
const wxString& label,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize)
|
||||
{
|
||||
Create(parent, -1, 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;
|
||||
|
||||
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_
|
60
include/wx/univ/statline.h
Normal file
60
include/wx/univ/statline.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/statline.h
|
||||
// Purpose: wxStaticLine class for wxUniversal
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 28.06.99
|
||||
// Version: $Id$
|
||||
// Copyright: (c) 1999 Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "univstatline.h"
|
||||
#endif
|
||||
|
||||
#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, -1, pos,
|
||||
style & wxLI_VERTICAL ? wxSize(-1, length)
|
||||
: wxSize(length, -1),
|
||||
style);
|
||||
}
|
||||
|
||||
wxStaticLine(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint &pos = wxDefaultPosition,
|
||||
const wxSize &size = wxDefaultSize,
|
||||
long style = wxLI_HORIZONTAL,
|
||||
const wxString &name = wxStaticTextNameStr )
|
||||
{
|
||||
Create(parent, id, pos, size, style, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint &pos = wxDefaultPosition,
|
||||
const wxSize &size = wxDefaultSize,
|
||||
long style = wxLI_HORIZONTAL,
|
||||
const wxString &name = wxStaticTextNameStr );
|
||||
|
||||
protected:
|
||||
virtual void DoDraw(wxControlRenderer *renderer);
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxStaticLine)
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_STATLINE_H_
|
||||
|
64
include/wx/univ/stattext.h
Normal file
64
include/wx/univ/stattext.h
Normal file
@@ -0,0 +1,64 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/stattext.h
|
||||
// Purpose: wxStaticText
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 14.08.00
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Vadim Zeitlin
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_STATTEXT_H_
|
||||
#define _WX_UNIV_STATTEXT_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "univstattext.h"
|
||||
#endif
|
||||
|
||||
class WXDLLEXPORT wxStaticText : public wxStaticTextBase
|
||||
{
|
||||
public:
|
||||
// usual ctor
|
||||
wxStaticText(wxWindow *parent,
|
||||
const wxString& label,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize)
|
||||
{
|
||||
Create(parent, -1, 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);
|
||||
|
||||
protected:
|
||||
// calculate the optimal size for the label
|
||||
virtual wxSize DoGetBestClientSize() const;
|
||||
|
||||
// draw the control
|
||||
virtual void DoDraw(wxControlRenderer *renderer);
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_STATTEXT_H_
|
583
include/wx/univ/textctrl.h
Normal file
583
include/wx/univ/textctrl.h
Normal file
@@ -0,0 +1,583 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/textctrl.h
|
||||
// Purpose: wxTextCtrl class
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 15.09.00
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_TEXTCTRL_H_
|
||||
#define _WX_UNIV_TEXTCTRL_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "univtextctrl.h"
|
||||
#endif
|
||||
|
||||
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 _T("goto") // to pos in numArg
|
||||
#define wxACTION_TEXT_FIRST _T("first") // go to pos 0
|
||||
#define wxACTION_TEXT_LAST _T("last") // go to last pos
|
||||
#define wxACTION_TEXT_HOME _T("home")
|
||||
#define wxACTION_TEXT_END _T("end")
|
||||
#define wxACTION_TEXT_LEFT _T("left")
|
||||
#define wxACTION_TEXT_RIGHT _T("right")
|
||||
#define wxACTION_TEXT_UP _T("up")
|
||||
#define wxACTION_TEXT_DOWN _T("down")
|
||||
#define wxACTION_TEXT_WORD_LEFT _T("wordleft")
|
||||
#define wxACTION_TEXT_WORD_RIGHT _T("wordright")
|
||||
#define wxACTION_TEXT_PAGE_UP _T("pageup")
|
||||
#define wxACTION_TEXT_PAGE_DOWN _T("pagedown")
|
||||
|
||||
// clipboard operations
|
||||
#define wxACTION_TEXT_COPY _T("copy")
|
||||
#define wxACTION_TEXT_CUT _T("cut")
|
||||
#define wxACTION_TEXT_PASTE _T("paste")
|
||||
|
||||
// insert text at the cursor position: the text is in strArg of PerformAction
|
||||
#define wxACTION_TEXT_INSERT _T("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 _T("sel")
|
||||
#define wxACTION_TEXT_PREFIX_DEL _T("del")
|
||||
|
||||
// mouse selection
|
||||
#define wxACTION_TEXT_ANCHOR_SEL _T("anchorsel")
|
||||
#define wxACTION_TEXT_EXTEND_SEL _T("extendsel")
|
||||
#define wxACTION_TEXT_SEL_WORD _T("wordsel")
|
||||
#define wxACTION_TEXT_SEL_LINE _T("linesel")
|
||||
|
||||
// undo or redo
|
||||
#define wxACTION_TEXT_UNDO _T("undo")
|
||||
#define wxACTION_TEXT_REDO _T("redo")
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxTextCtrl types
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// wxTextPos is the position in the text
|
||||
typedef long wxTextPos;
|
||||
|
||||
// wxTextCoord is the line or row number (which should have been unsigned but
|
||||
// is long for backwards compatibility)
|
||||
typedef long wxTextCoord;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxTextCtrl::HitTest return values
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// the point asked is ...
|
||||
enum wxTextCtrlHitTestResult
|
||||
{
|
||||
wxTE_HT_BEFORE = -1, // either to the left or upper
|
||||
wxTE_HT_ON_TEXT, // directly on
|
||||
wxTE_HT_BELOW, // below [the last line]
|
||||
wxTE_HT_BEYOND // after [the end of line]
|
||||
};
|
||||
// ... the character returned
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxTextCtrl
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxTextCtrl : public wxTextCtrlBase, public wxScrollHelper
|
||||
{
|
||||
public:
|
||||
// creation
|
||||
// --------
|
||||
|
||||
wxTextCtrl() { 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)
|
||||
{
|
||||
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 void SetValue(const wxString& value);
|
||||
|
||||
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);
|
||||
|
||||
// clears the dirty flag
|
||||
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;
|
||||
|
||||
// find the character at this position, return 0 if the character is
|
||||
// really there, -1 if the point is before the beginning of the text/line
|
||||
// and the returned character is the first one to follow it or +1 if it the
|
||||
// position is beyond the end of line/text and the returned character is
|
||||
// the last one
|
||||
//
|
||||
// NB: pt is in device coords (not adjusted for the client area origin nor
|
||||
// for the scrolling)
|
||||
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;
|
||||
|
||||
// set the right colours and border
|
||||
virtual bool IsContainerWindow() const { return TRUE; }
|
||||
virtual wxBorder GetDefaultBorder() const { return wxBORDER_SUNKEN; }
|
||||
|
||||
// perform an action
|
||||
virtual bool PerformAction(const wxControlAction& action,
|
||||
long numArg = -1,
|
||||
const wxString& strArg = wxEmptyString);
|
||||
|
||||
// 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 IsSingleLine() const { return !(GetWindowStyle() & wxTE_MULTILINE); }
|
||||
bool IsPassword() const { return (GetWindowStyle() & wxTE_PASSWORD) != 0; }
|
||||
bool WrapLines() const
|
||||
{ return !IsSingleLine() && !(GetWindowStyle() & wxHSCROLL); }
|
||||
|
||||
// only for wxStdTextCtrlInputHandler
|
||||
void RefreshSelection();
|
||||
|
||||
protected:
|
||||
// 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;
|
||||
|
||||
// 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, _T("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 OnIdle(wxIdleEvent& event);
|
||||
void OnChar(wxKeyEvent& event);
|
||||
void OnSize(wxSizeEvent& event);
|
||||
|
||||
// overrdie wxScrollHelper method to prevent (auto)scrolling beyond the end
|
||||
// of line
|
||||
virtual bool SendAutoScrollEvents(wxScrollWinEvent& event) const;
|
||||
|
||||
// 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;
|
||||
|
||||
// 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)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxStdTextCtrlInputHandler: this control handles only the mouse/kbd actions
|
||||
// common to Win32 and GTK, platform-specific things are implemented elsewhere
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxStdTextCtrlInputHandler : public wxStdInputHandler
|
||||
{
|
||||
public:
|
||||
wxStdTextCtrlInputHandler(wxInputHandler *inphand);
|
||||
|
||||
virtual bool HandleKey(wxControl *control,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed);
|
||||
virtual bool HandleMouse(wxControl *control,
|
||||
const wxMouseEvent& event);
|
||||
virtual bool HandleMouseMove(wxControl *control,
|
||||
const wxMouseEvent& event);
|
||||
virtual bool HandleFocus(wxControl *control, const wxFocusEvent& event);
|
||||
|
||||
protected:
|
||||
// get the position of the mouse click
|
||||
static wxTextPos HitTest(const wxTextCtrl *text, const wxPoint& pos);
|
||||
|
||||
// capture data
|
||||
wxTextCtrl *m_winCapture;
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_TEXTCTRL_H_
|
||||
|
127
include/wx/univ/theme.h
Normal file
127
include/wx/univ/theme.h
Normal file
@@ -0,0 +1,127 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// 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$
|
||||
// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows license
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_THEME_H_
|
||||
#define _WX_UNIV_THEME_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "theme.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxTheme
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxRenderer;
|
||||
class WXDLLEXPORT wxColourScheme;
|
||||
class WXDLLEXPORT wxInputHandler;
|
||||
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 input handler of the given type
|
||||
virtual wxInputHandler *GetInputHandler(const wxString& handlerType) = 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 wxThemeInfo;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// 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) \
|
||||
extern 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) \
|
||||
bool wxThemeUse##themename = TRUE; \
|
||||
wxTheme *wxCtorFor##themename() { return new classname; } \
|
||||
wxThemeInfo classname::ms_info##themename(wxCtorFor##themename, \
|
||||
#themename, themedesc)
|
||||
|
||||
#endif // _WX_UNIV_THEME_H_
|
||||
|
292
include/wx/univ/window.h
Normal file
292
include/wx/univ/window.h
Normal file
@@ -0,0 +1,292 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// 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$
|
||||
// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows license
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_WINDOW_H_
|
||||
#define _WX_UNIV_WINDOW_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "univwindow.h"
|
||||
#endif
|
||||
|
||||
#include "wx/bitmap.h" // for m_bitmapBg
|
||||
|
||||
class WXDLLEXPORT wxControlRenderer;
|
||||
class WXDLLEXPORT wxEventLoop;
|
||||
class WXDLLEXPORT wxMenu;
|
||||
class WXDLLEXPORT wxMenuBar;
|
||||
class WXDLLEXPORT wxRenderer;
|
||||
class WXDLLEXPORT wxScrollBar;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// control state flags used in wxRenderer and wxColourScheme
|
||||
enum
|
||||
{
|
||||
wxCONTROL_DISABLED = 0x00000001, // control is disabled
|
||||
wxCONTROL_FOCUSED = 0x00000002, // currently has keyboard focus
|
||||
wxCONTROL_PRESSED = 0x00000004, // (button) is pressed
|
||||
wxCONTROL_ISDEFAULT = 0x00000008, // only applies to the buttons
|
||||
wxCONTROL_ISSUBMENU = wxCONTROL_ISDEFAULT, // only for menu items
|
||||
wxCONTROL_CURRENT = 0x00000010, // mouse is currently over the control
|
||||
wxCONTROL_SELECTED = 0x00000020, // selected item in e.g. listbox
|
||||
wxCONTROL_CHECKED = 0x00000040, // (check/radio button) is checked
|
||||
wxCONTROL_CHECKABLE = 0x00000080, // (menu) item can be checked
|
||||
|
||||
wxCONTROL_FLAGS_MASK = 0x000000ff,
|
||||
|
||||
// this is a pseudo flag not used directly by wxRenderer but rather by some
|
||||
// controls internally
|
||||
wxCONTROL_DIRTY = 0x80000000
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxWindow
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxWindow : public wxWindowNative
|
||||
{
|
||||
public:
|
||||
// ctors and creatie 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);
|
||||
|
||||
// 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
|
||||
virtual bool DoPopupMenu(wxMenu *menu, int x, int y);
|
||||
|
||||
// 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);
|
||||
|
||||
// get the scrollbar (may be NULL) for the given orientation
|
||||
wxScrollBar *GetScrollbar(int orient) const
|
||||
{
|
||||
return orient & wxVERTICAL ? m_scrollbarVert : m_scrollbarHorz;
|
||||
}
|
||||
|
||||
// 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 a container window which contains the other items:
|
||||
// e.g, a listbox, listctrl, treectrl, ... and FALSE if it is a monolithic
|
||||
// control (e.g. a button, checkbox, ...)
|
||||
virtual bool IsContainerWindow() 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 UseBgCol() const { return m_hasBgCol; }
|
||||
bool UseFgCol() const { return m_hasFgCol; }
|
||||
bool UseFont() const { return m_hasFont; }
|
||||
|
||||
// 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);
|
||||
|
||||
// remember that the font/colour was changed
|
||||
virtual bool SetBackgroundColour(const wxColour& colour);
|
||||
virtual bool SetForegroundColour(const wxColour& colour);
|
||||
virtual bool SetFont(const wxFont& font);
|
||||
|
||||
// our Capture/ReleaseMouse() maintains the stack of windows which had
|
||||
// captured the mouse and when ReleaseMouse() is called, the mouse freed
|
||||
// only if the stack is empty, otherwise it is captured back by the window
|
||||
// on top of the stack
|
||||
virtual void CaptureMouse();
|
||||
virtual void ReleaseMouse();
|
||||
|
||||
protected:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
// overridden base class virtuals
|
||||
|
||||
// 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(wxPaintEvent& 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;
|
||||
|
||||
// more flags
|
||||
bool m_isCurrent:1; // is the mouse currently inside the window?
|
||||
bool m_hasBgCol:1; // was the bg colour explicitly changed by user?
|
||||
bool m_hasFgCol:1; // fg
|
||||
bool m_hasFont:1; // font
|
||||
|
||||
private:
|
||||
// the window scrollbars
|
||||
wxScrollBar *m_scrollbarHorz,
|
||||
*m_scrollbarVert;
|
||||
|
||||
// the stack of windows which have captured the mouse
|
||||
static struct WXDLLEXPORT wxWindowNext *ms_winCaptureNext;
|
||||
|
||||
#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_
|
||||
|
Reference in New Issue
Block a user