Layout fixes due to measuring with the wrong font. Also added
GetDefaultAttributes and switched everything to use GetXXX instead of m_XXX. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28111 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
6d450e1a20
commit
ab473127c6
@ -162,6 +162,12 @@ public:
|
|||||||
virtual bool Enable(bool enable = true);
|
virtual bool Enable(bool enable = true);
|
||||||
virtual bool Show(bool show = true);
|
virtual bool Show(bool show = true);
|
||||||
|
|
||||||
|
virtual wxVisualAttributes GetDefaultAttributes() const
|
||||||
|
{ return GetClassDefaultAttributes(GetWindowVariant()); }
|
||||||
|
|
||||||
|
static wxVisualAttributes
|
||||||
|
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// common part of all ctors
|
// common part of all ctors
|
||||||
void Init();
|
void Init();
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include "wx/settings.h"
|
#include "wx/settings.h"
|
||||||
#include "wx/brush.h"
|
#include "wx/brush.h"
|
||||||
#include "wx/combobox.h"
|
#include "wx/combobox.h"
|
||||||
|
#include "wx/listbox"
|
||||||
#include "wx/stattext.h"
|
#include "wx/stattext.h"
|
||||||
#include "wx/textctrl.h"
|
#include "wx/textctrl.h"
|
||||||
#endif //WX_PRECOMP
|
#endif //WX_PRECOMP
|
||||||
@ -306,29 +307,12 @@ bool wxCalendarCtrl::Create(wxWindow *parent,
|
|||||||
|
|
||||||
ShowCurrentControls();
|
ShowCurrentControls();
|
||||||
|
|
||||||
wxSize sizeReal;
|
|
||||||
if ( size.x == wxDefaultSize.x || size.y == wxDefaultSize.y )
|
|
||||||
{
|
|
||||||
sizeReal = DoGetBestSize();
|
|
||||||
if ( size.x != wxDefaultSize.x )
|
|
||||||
sizeReal.x = size.x;
|
|
||||||
if ( size.y != wxDefaultSize.y )
|
|
||||||
sizeReal.y = size.y;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sizeReal = size;
|
|
||||||
}
|
|
||||||
|
|
||||||
// we need to set the position as well because the main control position
|
// we need to set the position as well because the main control position
|
||||||
// is not the same as the one specified in pos if we have the controls
|
// is not the same as the one specified in pos if we have the controls
|
||||||
// above it
|
// above it
|
||||||
SetSize(pos.x, pos.y, sizeReal.x, sizeReal.y);
|
SetBestSize(size);
|
||||||
|
SetPosition(pos);
|
||||||
SetForegroundColour(*wxBLACK);
|
|
||||||
SetBackgroundColour(*wxWHITE);
|
|
||||||
SetFont(*wxSWISS_FONT);
|
|
||||||
|
|
||||||
SetHolidayAttrs();
|
SetHolidayAttrs();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -805,7 +789,9 @@ wxSize wxCalendarCtrl::DoGetBestSize() const
|
|||||||
width += 4;
|
width += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
return wxSize(width, height);
|
wxSize best(width, height);
|
||||||
|
CacheBestSize(best);
|
||||||
|
return best;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxCalendarCtrl::DoSetSize(int x, int y,
|
void wxCalendarCtrl::DoSetSize(int x, int y,
|
||||||
@ -904,12 +890,9 @@ void wxCalendarCtrl::DoGetSize(int *width, int *height) const
|
|||||||
|
|
||||||
void wxCalendarCtrl::RecalcGeometry()
|
void wxCalendarCtrl::RecalcGeometry()
|
||||||
{
|
{
|
||||||
if ( m_widthCol != 0 )
|
|
||||||
return;
|
|
||||||
|
|
||||||
wxClientDC dc(this);
|
wxClientDC dc(this);
|
||||||
|
|
||||||
dc.SetFont(m_font);
|
dc.SetFont(GetFont());
|
||||||
|
|
||||||
// determine the column width (we assume that the weekday names are always
|
// determine the column width (we assume that the weekday names are always
|
||||||
// wider (in any language) than the numbers)
|
// wider (in any language) than the numbers)
|
||||||
@ -940,7 +923,7 @@ void wxCalendarCtrl::OnPaint(wxPaintEvent& WXUNUSED(event))
|
|||||||
{
|
{
|
||||||
wxPaintDC dc(this);
|
wxPaintDC dc(this);
|
||||||
|
|
||||||
dc.SetFont(m_font);
|
dc.SetFont(GetFont());
|
||||||
|
|
||||||
RecalcGeometry();
|
RecalcGeometry();
|
||||||
|
|
||||||
@ -1158,7 +1141,7 @@ void wxCalendarCtrl::OnPaint(wxPaintEvent& WXUNUSED(event))
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
colBorder = m_foregroundColour;
|
colBorder = GetForegroundColour();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPen pen(colBorder, 1, wxSOLID);
|
wxPen pen(colBorder, 1, wxSOLID);
|
||||||
@ -1184,13 +1167,13 @@ void wxCalendarCtrl::OnPaint(wxPaintEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
if ( changedColours )
|
if ( changedColours )
|
||||||
{
|
{
|
||||||
dc.SetTextForeground(m_foregroundColour);
|
dc.SetTextForeground(GetForegroundColour());
|
||||||
dc.SetTextBackground(m_backgroundColour);
|
dc.SetTextBackground(GetBackgroundColour());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( changedFont )
|
if ( changedFont )
|
||||||
{
|
{
|
||||||
dc.SetFont(m_font);
|
dc.SetFont(GetFont());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//else: just don't draw it
|
//else: just don't draw it
|
||||||
@ -1824,6 +1807,16 @@ void wxCalendarCtrl::ResetHolidayAttrs()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//static
|
||||||
|
wxVisualAttributes
|
||||||
|
wxCalendarCtrl::GetClassDefaultAttributes(wxWindowVariant variant)
|
||||||
|
{
|
||||||
|
// Use the same color scheme as wxListBox
|
||||||
|
return wxListBox::GetClassDefaultAttributes(variant);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxCalendarEvent
|
// wxCalendarEvent
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user