Merge in from trunk r67662 to r64801
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/SOC2011_WEBVIEW@68402 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
81
include/wx/gtk/anybutton.h
Normal file
81
include/wx/gtk/anybutton.h
Normal file
@@ -0,0 +1,81 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/gtk/anybutton.h
|
||||
// Purpose: wxGTK wxAnyButton class declaration
|
||||
// Author: Robert Roebling
|
||||
// Created: 1998-05-20 (extracted from button.h)
|
||||
// Id: $Id: anybutton.h 67066 2011-02-27 12:48:30Z VZ $
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_GTK_ANYBUTTON_H_
|
||||
#define _WX_GTK_ANYBUTTON_H_
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxAnyButton
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxAnyButton : public wxAnyButtonBase
|
||||
{
|
||||
public:
|
||||
wxAnyButton()
|
||||
{
|
||||
m_isCurrent =
|
||||
m_isPressed = false;
|
||||
}
|
||||
|
||||
virtual bool Enable( bool enable = true );
|
||||
|
||||
// implementation
|
||||
// --------------
|
||||
|
||||
static wxVisualAttributes
|
||||
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
|
||||
|
||||
// called from GTK callbacks: they update the button state and call
|
||||
// GTKUpdateBitmap()
|
||||
void GTKMouseEnters();
|
||||
void GTKMouseLeaves();
|
||||
void GTKPressed();
|
||||
void GTKReleased();
|
||||
|
||||
protected:
|
||||
virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
|
||||
|
||||
virtual wxBitmap DoGetBitmap(State which) const;
|
||||
virtual void DoSetBitmap(const wxBitmap& bitmap, State which);
|
||||
virtual void DoSetBitmapPosition(wxDirection dir);
|
||||
|
||||
private:
|
||||
typedef wxAnyButtonBase base_type;
|
||||
|
||||
// focus event handler: calls GTKUpdateBitmap()
|
||||
void GTKOnFocus(wxFocusEvent& event);
|
||||
|
||||
// update the bitmap to correspond to the current button state
|
||||
void GTKUpdateBitmap();
|
||||
|
||||
// return the current button state from m_isXXX flags (which means that it
|
||||
// might not correspond to the real current state as e.g. m_isCurrent will
|
||||
// never be true if we don't have a valid current bitmap)
|
||||
State GTKGetCurrentState() const;
|
||||
|
||||
// show the given bitmap (must be valid)
|
||||
void GTKDoShowBitmap(const wxBitmap& bitmap);
|
||||
|
||||
|
||||
// the bitmaps for the different state of the buttons, all of them may be
|
||||
// invalid and the button only shows a bitmap at all if State_Normal bitmap
|
||||
// is valid
|
||||
wxBitmap m_bitmaps[State_Max];
|
||||
|
||||
// true iff mouse is currently over the button
|
||||
bool m_isCurrent;
|
||||
|
||||
// true iff the button is in pressed state
|
||||
bool m_isPressed;
|
||||
|
||||
wxDECLARE_NO_COPY_CLASS(wxAnyButton);
|
||||
};
|
||||
|
||||
#endif // _WX_GTK_ANYBUTTON_H_
|
||||
@@ -17,7 +17,7 @@
|
||||
class WXDLLIMPEXP_CORE wxButton : public wxButtonBase
|
||||
{
|
||||
public:
|
||||
wxButton() { Init(); }
|
||||
wxButton() {}
|
||||
wxButton(wxWindow *parent, wxWindowID id,
|
||||
const wxString& label = wxEmptyString,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
@@ -25,8 +25,6 @@ public:
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxButtonNameStr)
|
||||
{
|
||||
Init();
|
||||
|
||||
Create(parent, id, label, pos, size, style, validator, name);
|
||||
}
|
||||
|
||||
@@ -39,7 +37,6 @@ public:
|
||||
|
||||
virtual wxWindow *SetDefault();
|
||||
virtual void SetLabel( const wxString &label );
|
||||
virtual bool Enable( bool enable = true );
|
||||
|
||||
// implementation
|
||||
// --------------
|
||||
@@ -61,12 +58,6 @@ protected:
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
virtual void DoApplyWidgetStyle(GtkRcStyle *style);
|
||||
|
||||
virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
|
||||
|
||||
virtual wxBitmap DoGetBitmap(State which) const;
|
||||
virtual void DoSetBitmap(const wxBitmap& bitmap, State which);
|
||||
virtual void DoSetBitmapPosition(wxDirection dir);
|
||||
|
||||
#if wxUSE_MARKUP
|
||||
virtual bool DoSetLabelMarkup(const wxString& markup);
|
||||
#endif // wxUSE_MARKUP
|
||||
@@ -74,42 +65,9 @@ protected:
|
||||
private:
|
||||
typedef wxButtonBase base_type;
|
||||
|
||||
// common part of all ctors
|
||||
void Init()
|
||||
{
|
||||
m_isCurrent =
|
||||
m_isPressed = false;
|
||||
}
|
||||
|
||||
// focus event handler: calls GTKUpdateBitmap()
|
||||
void GTKOnFocus(wxFocusEvent& event);
|
||||
|
||||
// update the bitmap to correspond to the current button state
|
||||
void GTKUpdateBitmap();
|
||||
|
||||
// return the current button state from m_isXXX flags (which means that it
|
||||
// might not correspond to the real current state as e.g. m_isCurrent will
|
||||
// never be true if we don't have a valid current bitmap)
|
||||
State GTKGetCurrentState() const;
|
||||
|
||||
// show the given bitmap (must be valid)
|
||||
void GTKDoShowBitmap(const wxBitmap& bitmap);
|
||||
|
||||
// Return the GtkLabel used by this button.
|
||||
GtkLabel *GTKGetLabel() const;
|
||||
|
||||
|
||||
// the bitmaps for the different state of the buttons, all of them may be
|
||||
// invalid and the button only shows a bitmap at all if State_Normal bitmap
|
||||
// is valid
|
||||
wxBitmap m_bitmaps[State_Max];
|
||||
|
||||
// true iff mouse is currently over the button
|
||||
bool m_isCurrent;
|
||||
|
||||
// true iff the button is in pressed state
|
||||
bool m_isPressed;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxButton)
|
||||
};
|
||||
|
||||
|
||||
@@ -38,15 +38,31 @@ public:
|
||||
virtual bool SetDate(const wxDateTime& date);
|
||||
virtual wxDateTime GetDate() const;
|
||||
|
||||
virtual bool SetDateRange(const wxDateTime& lowerdate = wxDefaultDateTime,
|
||||
const wxDateTime& upperdate = wxDefaultDateTime);
|
||||
virtual bool GetDateRange(wxDateTime *lowerdate, wxDateTime *upperdate) const;
|
||||
|
||||
virtual bool EnableMonthChange(bool enable = true);
|
||||
|
||||
virtual void Mark(size_t day, bool mark);
|
||||
|
||||
// implementation
|
||||
// --------------
|
||||
wxDateTime m_selectedDate;
|
||||
|
||||
void GTKGenerateEvent(wxEventType type);
|
||||
|
||||
private:
|
||||
bool IsInValidRange(const wxDateTime& dt) const;
|
||||
|
||||
// Range of the dates that can be selected by user, either or both may be
|
||||
// invalid to indicate that no corresponding restriction is set.
|
||||
wxDateTime m_validStart,
|
||||
m_validEnd;
|
||||
|
||||
// Last known selected date, may be different from the real selection in
|
||||
// the control while a handler for day-selected is running.
|
||||
wxDateTime m_selectedDate;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxGtkCalendarCtrl)
|
||||
wxDECLARE_NO_COPY_CLASS(wxGtkCalendarCtrl);
|
||||
};
|
||||
|
||||
@@ -159,6 +159,10 @@ public:
|
||||
virtual wxRect GetItemRect( const wxDataViewItem &item,
|
||||
const wxDataViewColumn *column = NULL ) const;
|
||||
|
||||
virtual bool SetRowHeight( int rowHeight );
|
||||
|
||||
virtual void StartEditor( const wxDataViewItem & item, unsigned int column );
|
||||
|
||||
virtual void Expand( const wxDataViewItem & item );
|
||||
virtual void Collapse( const wxDataViewItem & item );
|
||||
virtual bool IsExpanded( const wxDataViewItem & item ) const;
|
||||
@@ -180,6 +184,8 @@ public:
|
||||
|
||||
virtual void OnInternalIdle();
|
||||
|
||||
int GTKGetUniformRowHeight() const { return m_uniformRowHeight; }
|
||||
|
||||
protected:
|
||||
virtual void DoSetExpanderColumn();
|
||||
virtual void DoSetIndent();
|
||||
@@ -207,6 +213,11 @@ private:
|
||||
wxDataViewColumnList m_cols;
|
||||
wxDataViewItem m_ensureVisibleDefered;
|
||||
|
||||
// By default this is set to -1 and the height of the rows is determined by
|
||||
// GetRect() methods of the renderers but this can be set to a positive
|
||||
// value to force the height of all rows to the given value.
|
||||
int m_uniformRowHeight;
|
||||
|
||||
virtual void AddChildGTK(wxWindowGTK* child);
|
||||
void GtkEnableSelectionEvents();
|
||||
void GtkDisableSelectionEvents();
|
||||
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
|
||||
GtkCellRenderer* GetGtkHandle() { return m_renderer; }
|
||||
void GtkInitHandlers();
|
||||
void GtkUpdateAlignment();
|
||||
void GtkUpdateAlignment() { GtkApplyAlignment(m_renderer); }
|
||||
|
||||
// should be overridden to return true if the renderer supports properties
|
||||
// corresponding to wxDataViewItemAttr field, see wxGtkTreeCellDataFunc()
|
||||
@@ -85,6 +85,9 @@ protected:
|
||||
const wxDataViewItem& item,
|
||||
unsigned col);
|
||||
|
||||
// Apply our effective alignment (i.e. m_alignment if specified or the
|
||||
// associated column alignment by default) to the given renderer.
|
||||
void GtkApplyAlignment(GtkCellRenderer *renderer);
|
||||
|
||||
GtkCellRenderer *m_renderer;
|
||||
int m_alignment;
|
||||
|
||||
@@ -147,6 +147,10 @@ protected:
|
||||
bool Init(wxDataViewCellMode mode, int align);
|
||||
|
||||
private:
|
||||
// Called from GtkGetTextRenderer() to really create the renderer if
|
||||
// necessary.
|
||||
void GtkInitTextRenderer();
|
||||
|
||||
wxDC *m_dc;
|
||||
|
||||
GtkCellRendererText *m_text_renderer;
|
||||
@@ -185,9 +189,17 @@ public:
|
||||
virtual wxSize GetSize() const;
|
||||
|
||||
private:
|
||||
void GTKSetLabel();
|
||||
|
||||
wxString m_label;
|
||||
int m_value;
|
||||
|
||||
#if !wxUSE_UNICODE
|
||||
// Flag used to indicate that we need to set the label because we were
|
||||
// unable to do it in the ctor (see comments there).
|
||||
bool m_needsToSetLabel;
|
||||
#endif // !wxUSE_UNICODE
|
||||
|
||||
protected:
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer)
|
||||
};
|
||||
|
||||
@@ -101,7 +101,6 @@ private:
|
||||
// common part of Append (if pos == -1) and Insert
|
||||
bool GtkAppend(wxMenuItem *item, int pos=-1);
|
||||
|
||||
GtkWidget *m_prevRadio;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxMenu)
|
||||
};
|
||||
|
||||
@@ -52,13 +52,13 @@ extern const gchar *wx_pango_version_check(int major, int minor, int micro);
|
||||
// helper: use the encoding of the given font if it's valid
|
||||
inline wxCharBuffer wxConvertToGTK(const wxString& s, const wxFont& font)
|
||||
{
|
||||
return wxConvertToGTK(s, font.Ok() ? font.GetEncoding()
|
||||
return wxConvertToGTK(s, font.IsOk() ? font.GetEncoding()
|
||||
: wxFONTENCODING_SYSTEM);
|
||||
}
|
||||
|
||||
inline wxCharBuffer wxConvertFromGTK(const wxString& s, const wxFont& font)
|
||||
{
|
||||
return wxConvertFromGTK(s, font.Ok() ? font.GetEncoding()
|
||||
return wxConvertFromGTK(s, font.IsOk() ? font.GetEncoding()
|
||||
: wxFONTENCODING_SYSTEM);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,67 +22,6 @@
|
||||
class WXDLLIMPEXP_FWD_CORE wxToggleButton;
|
||||
class WXDLLIMPEXP_FWD_CORE wxToggleBitmapButton;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxBitmapToggleButton
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxBitmapToggleButton: public wxToggleButtonBase
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
wxBitmapToggleButton() {}
|
||||
wxBitmapToggleButton(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxBitmap& label,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxCheckBoxNameStr)
|
||||
{
|
||||
Create(parent, id, label, pos, size, style, validator, name);
|
||||
}
|
||||
|
||||
// Create the control
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxBitmap& label,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxCheckBoxNameStr);
|
||||
|
||||
// Get/set the value
|
||||
void SetValue(bool state);
|
||||
bool GetValue() const;
|
||||
|
||||
// Set the label
|
||||
virtual void SetLabel(const wxString& label) { wxControl::SetLabel(label); }
|
||||
virtual void SetLabel(const wxBitmap& label);
|
||||
bool Enable(bool enable = true);
|
||||
|
||||
static wxVisualAttributes
|
||||
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
|
||||
|
||||
// implementation
|
||||
wxBitmap m_bitmap;
|
||||
|
||||
void OnSetBitmap();
|
||||
|
||||
protected:
|
||||
void GTKDisableEvents();
|
||||
void GTKEnableEvents();
|
||||
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
virtual void DoApplyWidgetStyle(GtkRcStyle *style);
|
||||
virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
|
||||
|
||||
private:
|
||||
typedef wxToggleButtonBase base_type;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxBitmapToggleButton)
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxToggleButton
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -119,7 +58,6 @@ public:
|
||||
|
||||
// Set the label
|
||||
void SetLabel(const wxString& label);
|
||||
bool Enable(bool enable = true);
|
||||
|
||||
static wxVisualAttributes
|
||||
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
|
||||
@@ -130,13 +68,61 @@ protected:
|
||||
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
virtual void DoApplyWidgetStyle(GtkRcStyle *style);
|
||||
virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
|
||||
|
||||
#if wxUSE_MARKUP
|
||||
virtual bool DoSetLabelMarkup(const wxString& markup);
|
||||
#endif // wxUSE_MARKUP
|
||||
|
||||
private:
|
||||
typedef wxToggleButtonBase base_type;
|
||||
|
||||
// Return the GtkLabel used by this toggle button.
|
||||
GtkLabel *GTKGetLabel() const;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxToggleButton)
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxBitmapToggleButton
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxBitmapToggleButton: public wxToggleButton
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
wxBitmapToggleButton() {}
|
||||
wxBitmapToggleButton(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxBitmap& label,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxCheckBoxNameStr)
|
||||
{
|
||||
Create(parent, id, label, pos, size, style, validator, name);
|
||||
}
|
||||
|
||||
// Create the control
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxBitmap& label,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxCheckBoxNameStr);
|
||||
|
||||
// deprecated synonym for SetBitmapLabel()
|
||||
wxDEPRECATED_INLINE( void SetLabel(const wxBitmap& bitmap),
|
||||
SetBitmapLabel(bitmap); )
|
||||
// prevent virtual function hiding
|
||||
virtual void SetLabel(const wxString& label) { wxToggleButton::SetLabel(label); }
|
||||
|
||||
private:
|
||||
typedef wxToggleButtonBase base_type;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxBitmapToggleButton)
|
||||
};
|
||||
|
||||
#endif // _WX_GTK_TOGGLEBUTTON_H_
|
||||
|
||||
|
||||
Reference in New Issue
Block a user