// headers
// ----------------------------------------------------------------------------
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
- #pragma implementation "calctrl.h"
-#endif
-
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
// the combobox doesn't report its height correctly (it returns the
// height including the drop down list) so don't use it
height += m_spinYear->GetBestSize().y;
- }
- wxCoord w2= m_comboMonth->GetBestSize().x + HORZ_MARGIN + GetCharWidth()*6;
- if (width < w2)
- width=w2;
+
+ wxCoord w2 = m_comboMonth->GetBestSize().x + HORZ_MARGIN + GetCharWidth()*6;
+ if (width < w2)
+ width = w2;
+ }
if ( !HasFlag(wxBORDER_NONE) )
{
dc.SetFont(GetFont());
- // determine the column width (we assume that the weekday names are always
- // wider (in any language) than the numbers)
+ // determine the column width (weekday names are not necessarily wider
+ // than the numbers (in some languages), so let's not assume that they are)
m_widthCol = 0;
+ for ( int day = 10; day <= 31; day++)
+ {
+ wxCoord width;
+ dc.GetTextExtent(wxString::Format(wxT("%d"), day), &width, &m_heightRow);
+ if ( width > m_widthCol )
+ {
+ // 1.5 times the width gives nice margins even if the weekday
+ // names are short
+ m_widthCol = width+width/2;
+ }
+ }
wxDateTime::WeekDay wd;
for ( wd = wxDateTime::Sun; wd < wxDateTime::Inv_WeekDay; wxNextWDay(wd) )
{
dc.SetTextForeground(*wxBLACK);
dc.SetBrush(wxBrush(m_colHeaderBg, wxSOLID));
dc.SetPen(wxPen(m_colHeaderBg, 1, wxSOLID));
- dc.DrawRectangle(x0, y, GetClientSize().x, m_heightRow);
+ dc.DrawRectangle(0, y, GetClientSize().x, m_heightRow);
// Get extent of month-name + year
wxCoord monthw, monthh;
dc.DrawRectangle(0, y, GetClientSize().x, m_heightRow);
bool startOnMonday = (GetWindowStyle() & wxCAL_MONDAY_FIRST) != 0;
- for ( size_t wd = 0; wd < 7; wd++ )
+ for ( int wd = 0; wd < 7; wd++ )
{
size_t n;
if ( startOnMonday )
wxLogDebug("painting week %d at y = %d\n", nWeek, y);
#endif
- for ( size_t wd = 0; wd < 7; wd++ )
+ for ( int wd = 0; wd < 7; wd++ )
{
if ( IsDateShown(date) )
{
if ( ( (tw - fw) == 1 ) && ( td < fd ) )
{
// special case: interval 7 days or less not in same week
- // split in two seperate intervals
+ // split in two separate intervals
wxDateTime tfd = fromdate + wxDateSpan::Days(7-fd);
wxDateTime ftd = tfd + wxDateSpan::Day();
#if DEBUG_PAINT
- wxLogDebug("Highlight: Seperate segments");
+ wxLogDebug("Highlight: Separate segments");
#endif
- // draw seperately
+ // draw separately
HighlightRange(pDC, fromdate, tfd, pPen, pBrush);
HighlightRange(pDC, ftd, todate, pPen, pBrush);
}
case wxCAL_HITTEST_HEADER:
{
- wxCalendarEvent event(this, wxEVT_CALENDAR_WEEKDAY_CLICKED);
- event.m_wday = wday;
- (void)GetEventHandler()->ProcessEvent(event);
+ wxCalendarEvent eventWd(this, wxEVT_CALENDAR_WEEKDAY_CLICKED);
+ eventWd.m_wday = wday;
+ (void)GetEventHandler()->ProcessEvent(eventWd);
}
break;
}
#endif // wxUSE_CALENDARCTRL
-