\section{KDate\-Table Class Reference}
\label{classKDateTable}\index{KDateTable@{KDateTable}}
Date selection table.  


{\tt \#include $<$kdatetbl.h$>$}

Inheritance diagram for KDate\-Table:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=52pt]{classKDateTable__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KDate\-Table:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=88pt]{classKDateTable__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Types}
\begin{CompactItemize}
\item 
enum {\bf Background\-Mode} \{ {\bf No\-Bg\-Mode} = 0, 
{\bf Rectangle\-Mode}, 
{\bf Circle\-Mode}
 \}
\end{CompactItemize}
\subsection*{Signals}
\begin{CompactItemize}
\item 
void {\bf date\-Changed} ({\bf QDate})
\item 
void {\bf date\-Changed} (const {\bf QDate} \&cur, const {\bf QDate} \&old)
\item 
void {\bf table\-Clicked} ()
\item 
void {\bf about\-To\-Show\-Context\-Menu} ({\bf KPopup\-Menu} $\ast$menu, const {\bf QDate} \&date)
\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KDate\-Table} ({\bf QWidget} $\ast$parent=0, {\bf QDate} date={\bf QDate::current\-Date}(), const char $\ast$name=0, WFlags f=0)
\item 
{\bf KDate\-Table} ({\bf QWidget} $\ast$parent, const char $\ast$name, WFlags f=0)
\item 
{\bf $\sim$KDate\-Table} ()
\item 
virtual {\bf QSize} {\bf size\-Hint} () const 
\item 
void {\bf set\-Font\-Size} (int size)
\item 
bool {\bf set\-Date} (const {\bf QDate} \&)
\item 
const {\bf QDate} \& {\bf get\-Date} () const \label{classKDateTable_a6}

\item 
void {\bf set\-Popup\-Menu\-Enabled} (bool enable)
\item 
bool {\bf popup\-Menu\-Enabled} () const 
\item 
void {\bf set\-Custom\-Date\-Painting} (const {\bf QDate} \&date, const {\bf QColor} \&fg\-Color, Background\-Mode bg\-Mode=No\-Bg\-Mode, const {\bf QColor} \&bg\-Color={\bf QColor}())
\item 
void {\bf unset\-Custom\-Date\-Painting} (const {\bf QDate} \&date)
\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
int {\bf pos\-From\-Date} (const {\bf QDate} \&date)
\item 
{\bf QDate} {\bf date\-From\-Pos} (int pos)
\item 
virtual void {\bf paint\-Cell} ({\bf QPainter} $\ast$, int, int)
\item 
virtual void {\bf viewport\-Resize\-Event} ({\bf QResize\-Event} $\ast$)
\item 
virtual void {\bf contents\-Mouse\-Press\-Event} ({\bf QMouse\-Event} $\ast$)
\item 
virtual void {\bf wheel\-Event} ({\bf QWheel\-Event} $\ast$e)\label{classKDateTable_b5}

\item 
virtual void {\bf key\-Press\-Event} ({\bf QKey\-Event} $\ast$e)\label{classKDateTable_b6}

\item 
virtual void {\bf focus\-In\-Event} ({\bf QFocus\-Event} $\ast$e)\label{classKDateTable_b7}

\item 
virtual void {\bf focus\-Out\-Event} ({\bf QFocus\-Event} $\ast$e)\label{classKDateTable_b8}

\item 
virtual void {\bf virtual\_\-hook} (int id, void $\ast$data)\label{classKDateTable_b9}

\end{CompactItemize}
\subsection*{Protected Attributes}
\begin{CompactItemize}
\item 
int {\bf fontsize}
\item 
int {\bf firstday}
\item 
int {\bf numdays}
\item 
int {\bf num\-Days\-Prev\-Month}
\item 
bool {\bf unused\_\-has\-Selection}
\item 
{\bf QRect} {\bf max\-Cell}
\end{CompactItemize}
\subsection*{Properties}
\begin{CompactItemize}
\item 
{\bf QDate} {\bf date}
\item 
bool {\bf popup\-Menu}\label{classKDateTable_01}

\end{CompactItemize}


\subsection{Detailed Description}
Date selection table. 

This is a support class for the {\bf KDate\-Picker}{\rm (p.\,\pageref{classKDatePicker})} class. It just draws the calender table without titles, but could theoretically be used as a standalone.

When a date is selected by the user, it emits a signal: date\-Selected(QDate) 



Definition at line 254 of file kdatetbl.h.

\subsection{Constructor \& Destructor Documentation}
\index{KDateTable@{KDate\-Table}!KDateTable@{KDateTable}}
\index{KDateTable@{KDateTable}!KDateTable@{KDate\-Table}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KDate\-Table::KDate\-Table ({\bf QWidget} $\ast$ {\em parent} = {\tt 0}, {\bf QDate} {\em date} = {\tt {\bf QDate::current\-Date}()}, const char $\ast$ {\em name} = {\tt 0}, WFlags {\em f} = {\tt 0})}\label{classKDateTable_a0}


The constructor. 



Definition at line 116 of file kdatetbl.cpp.

References QDate::current\-Date(), endl(), QDate::is\-Valid(), kd\-Debug(), set\-Date(), set\-Font\-Size(), QGrid\-View::set\-Num\-Cols(), and QGrid\-View::set\-Num\-Rows().\index{KDateTable@{KDate\-Table}!KDateTable@{KDateTable}}
\index{KDateTable@{KDateTable}!KDateTable@{KDate\-Table}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KDate\-Table::KDate\-Table ({\bf QWidget} $\ast$ {\em parent}, const char $\ast$ {\em name}, WFlags {\em f} = {\tt 0})}\label{classKDateTable_a1}


The constructor. 

\begin{Desc}
\item[Since:]3.4 \end{Desc}


Definition at line 136 of file kdatetbl.cpp.

References set\-Date(), set\-Font\-Size(), QGrid\-View::set\-Num\-Cols(), and QGrid\-View::set\-Num\-Rows().\index{KDateTable@{KDate\-Table}!~KDateTable@{$\sim$KDateTable}}
\index{~KDateTable@{$\sim$KDateTable}!KDateTable@{KDate\-Table}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KDate\-Table::$\sim${\bf KDate\-Table} ()}\label{classKDateTable_a2}


The destructor. 



Definition at line 151 of file kdatetbl.cpp.

\subsection{Member Function Documentation}
\index{KDateTable@{KDate\-Table}!sizeHint@{sizeHint}}
\index{sizeHint@{sizeHint}!KDateTable@{KDate\-Table}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QSize} KDate\-Table::size\-Hint () const\hspace{0.3cm}{\tt  [virtual]}}\label{classKDateTable_a3}


Returns a recommended size for the widget. 

To save some time, the size of the largest used cell content is calculated in each {\bf paint\-Cell()}{\rm (p.\,\pageref{classKDateTable_b2})} call, since all calculations have to be done there anyway. The size is stored in max\-Cell. The {\bf size\-Hint()}{\rm (p.\,\pageref{classKDateTable_a3})} simply returns a multiple of max\-Cell. 

Definition at line 548 of file kdatetbl.cpp.

References endl(), QRect::height(), kd\-Debug(), max\-Cell, QGrid\-View::num\-Cols(), QGrid\-View::num\-Rows(), and QRect::width().\index{KDateTable@{KDate\-Table}!setFontSize@{setFontSize}}
\index{setFontSize@{setFontSize}!KDateTable@{KDate\-Table}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KDate\-Table::set\-Font\-Size (int {\em size})}\label{classKDateTable_a4}


Set the font size of the date table. 



Definition at line 408 of file kdatetbl.cpp.

References QFont\-Metrics::bounding\-Rect(), fontsize, QRect::height(), max\-Cell, QRect::set\-Height(), QRect::set\-Width(), and QRect::width().

Referenced by KDate\-Table(), and KDate\-Picker::set\-Font\-Size().\index{KDateTable@{KDate\-Table}!setDate@{setDate}}
\index{setDate@{setDate}!KDateTable@{KDate\-Table}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KDate\-Table::set\-Date (const {\bf QDate} \&)}\label{classKDateTable_a5}


Select and display this date. 



Definition at line 494 of file kdatetbl.cpp.

References KCalendar\-System::add\-Months(), KLocale::calendar(), date, date\-Changed(), QDate::day\-Of\-Week(), KCalendar\-System::days\-In\-Month(), endl(), firstday, kd\-Debug(), KGlobal::locale(), KCalendar\-System::month(), numdays, num\-Days\-Prev\-Month, KCalendar\-System::set\-YMD(), and KCalendar\-System::year().

Referenced by contents\-Mouse\-Press\-Event(), KDate\-Table(), and KDate\-Picker::set\-Date().\index{KDateTable@{KDate\-Table}!setPopupMenuEnabled@{setPopupMenuEnabled}}
\index{setPopupMenuEnabled@{setPopupMenuEnabled}!KDateTable@{KDate\-Table}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KDate\-Table::set\-Popup\-Menu\-Enabled (bool {\em enable})}\label{classKDateTable_a7}


Enables a popup menu when right clicking on a date. 

When it's enabled, this object emits a about\-To\-Show\-Context\-Menu signal where you can fill in the menu items.

\begin{Desc}
\item[Since:]3.2 \end{Desc}


Definition at line 560 of file kdatetbl.cpp.\index{KDateTable@{KDate\-Table}!popupMenuEnabled@{popupMenuEnabled}}
\index{popupMenuEnabled@{popupMenuEnabled}!KDateTable@{KDate\-Table}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KDate\-Table::popup\-Menu\-Enabled () const}\label{classKDateTable_a8}


Returns if the popup menu is enabled or not. 



Definition at line 565 of file kdatetbl.cpp.\index{KDateTable@{KDate\-Table}!setCustomDatePainting@{setCustomDatePainting}}
\index{setCustomDatePainting@{setCustomDatePainting}!KDateTable@{KDate\-Table}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KDate\-Table::set\-Custom\-Date\-Painting (const {\bf QDate} \& {\em date}, const {\bf QColor} \& {\em fg\-Color}, Background\-Mode {\em bg\-Mode} = {\tt NoBgMode}, const {\bf QColor} \& {\em bg\-Color} = {\tt {\bf QColor}()})}\label{classKDateTable_a9}


Makes a given date be painted with a given foreground\-Color, and background (a rectangle, or a circle/ellipse) in a given color. 

\begin{Desc}
\item[Since:]3.2 \end{Desc}


Definition at line 570 of file kdatetbl.cpp.

References date, QDate::to\-String(), and unset\-Custom\-Date\-Painting().\index{KDateTable@{KDate\-Table}!unsetCustomDatePainting@{unsetCustomDatePainting}}
\index{unsetCustomDatePainting@{unsetCustomDatePainting}!KDateTable@{KDate\-Table}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KDate\-Table::unset\-Custom\-Date\-Painting (const {\bf QDate} \& {\em date})}\label{classKDateTable_a10}


Unsets the custom painting of a date so that the date is painted as usual. 

\begin{Desc}
\item[Since:]3.2 \end{Desc}


Definition at line 588 of file kdatetbl.cpp.

References date, and QDate::to\-String().

Referenced by set\-Custom\-Date\-Painting().\index{KDateTable@{KDate\-Table}!posFromDate@{posFromDate}}
\index{posFromDate@{posFromDate}!KDateTable@{KDate\-Table}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KDate\-Table::pos\-From\-Date (const {\bf QDate} \& {\em date})\hspace{0.3cm}{\tt  [protected]}}\label{classKDateTable_b0}


calculate the position of the cell in the matrix for the given date. 

The result is the 0-based index. 

Definition at line 168 of file kdatetbl.cpp.

References KLocale::calendar(), KCalendar\-System::day(), firstday, KGlobal::locale(), and KLocale::week\-Start\-Day().

Referenced by contents\-Mouse\-Press\-Event().\index{KDateTable@{KDate\-Table}!dateFromPos@{dateFromPos}}
\index{dateFromPos@{dateFromPos}!KDateTable@{KDate\-Table}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QDate} KDate\-Table::date\-From\-Pos (int {\em pos})\hspace{0.3cm}{\tt  [protected]}}\label{classKDateTable_b1}


calculate the date that is displayed at a given cell in the matrix. 

pos is the 0-based index in the matrix. Inverse function to pos\-For\-Date(). 

Definition at line 180 of file kdatetbl.cpp.

References KCalendar\-System::add\-Days(), KLocale::calendar(), date, firstday, KGlobal::locale(), KCalendar\-System::month(), KCalendar\-System::set\-YMD(), KLocale::week\-Start\-Day(), and KCalendar\-System::year().

Referenced by contents\-Mouse\-Press\-Event(), and paint\-Cell().\index{KDateTable@{KDate\-Table}!paintCell@{paintCell}}
\index{paintCell@{paintCell}!KDateTable@{KDate\-Table}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KDate\-Table::paint\-Cell ({\bf QPainter} $\ast$, int, int)\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKDateTable_b2}


Paint a cell. 



Reimplemented from {\bf QGrid\-View}.

Definition at line 196 of file kdatetbl.cpp.

References KLocale::calendar(), KCalendar\-System::calendar\-Name(), QGrid\-View::cell\-Height(), QGrid\-View::cell\-Width(), date, date\-From\-Pos(), KCalendar\-System::day(), KCalendar\-System::day\-String(), firstday, KGlobal\-Settings::general\-Font(), QRect::height(), KGlobal::locale(), max\-Cell, KCalendar\-System::month(), QFont::set\-Bold(), QRect::set\-Height(), QRect::set\-Width(), QDate::to\-String(), KCalendar\-System::week\-Day\-Name(), KCalendar\-System::week\-Day\-Of\-Pray(), KLocale::week\-Start\-Day(), and QRect::width().\index{KDateTable@{KDate\-Table}!viewportResizeEvent@{viewportResizeEvent}}
\index{viewportResizeEvent@{viewportResizeEvent}!KDateTable@{KDate\-Table}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KDate\-Table::viewport\-Resize\-Event ({\bf QResize\-Event} $\ast$)\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKDateTable_b3}


Handle the resize events. 



Definition at line 399 of file kdatetbl.cpp.

References QGrid\-View::set\-Cell\-Height(), and QGrid\-View::set\-Cell\-Width().\index{KDateTable@{KDate\-Table}!contentsMousePressEvent@{contentsMousePressEvent}}
\index{contentsMousePressEvent@{contentsMousePressEvent}!KDateTable@{KDate\-Table}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KDate\-Table::contents\-Mouse\-Press\-Event ({\bf QMouse\-Event} $\ast$)\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKDateTable_b4}


React on mouse clicks that select a date. 



Definition at line 439 of file kdatetbl.cpp.

References about\-To\-Show\-Context\-Menu(), KNotify\-Client::beep(), QGrid\-View::column\-At(), date, date\-From\-Pos(), KPopup\-Menu::insert\-Title(), QPopup\-Menu::popup(), pos\-From\-Date(), QGrid\-View::row\-At(), set\-Date(), table\-Clicked(), QGrid\-View::update\-Cell(), QPoint::x(), and QPoint::y().\index{KDateTable@{KDate\-Table}!dateChanged@{dateChanged}}
\index{dateChanged@{dateChanged}!KDateTable@{KDate\-Table}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KDate\-Table::date\-Changed ({\bf QDate})\hspace{0.3cm}{\tt  [signal]}}\label{classKDateTable_l0}


The selected date changed. 



Referenced by set\-Date().\index{KDateTable@{KDate\-Table}!dateChanged@{dateChanged}}
\index{dateChanged@{dateChanged}!KDateTable@{KDate\-Table}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KDate\-Table::date\-Changed (const {\bf QDate} \& {\em cur}, const {\bf QDate} \& {\em old})\hspace{0.3cm}{\tt  [signal]}}\label{classKDateTable_l1}


This function behaves essentially like the one above. 

The selected date changed. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cur}]The current date \item[{\em old}]The date before the date was changed \end{description}
\end{Desc}
\index{KDateTable@{KDate\-Table}!tableClicked@{tableClicked}}
\index{tableClicked@{tableClicked}!KDateTable@{KDate\-Table}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KDate\-Table::table\-Clicked ()\hspace{0.3cm}{\tt  [signal]}}\label{classKDateTable_l2}


A date has been selected by clicking on the table. 



Referenced by contents\-Mouse\-Press\-Event().\index{KDateTable@{KDate\-Table}!aboutToShowContextMenu@{aboutToShowContextMenu}}
\index{aboutToShowContextMenu@{aboutToShowContextMenu}!KDateTable@{KDate\-Table}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KDate\-Table::about\-To\-Show\-Context\-Menu ({\bf KPopup\-Menu} $\ast$ {\em menu}, const {\bf QDate} \& {\em date})\hspace{0.3cm}{\tt  [signal]}}\label{classKDateTable_l3}


A popup menu for a given date is about to be shown (as when the user right clicks on that date and the popup menu is enabled). 

Connect the slot where you fill the menu to this signal.

\begin{Desc}
\item[Since:]3.2 \end{Desc}


Referenced by contents\-Mouse\-Press\-Event().

\subsection{Member Data Documentation}
\index{KDateTable@{KDate\-Table}!fontsize@{fontsize}}
\index{fontsize@{fontsize}!KDateTable@{KDate\-Table}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int {\bf KDate\-Table::fontsize}\hspace{0.3cm}{\tt  [protected]}}\label{classKDateTable_p0}


The font size of the displayed text. 



Definition at line 362 of file kdatetbl.h.

Referenced by set\-Font\-Size().\index{KDateTable@{KDate\-Table}!firstday@{firstday}}
\index{firstday@{firstday}!KDateTable@{KDate\-Table}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int {\bf KDate\-Table::firstday}\hspace{0.3cm}{\tt  [protected]}}\label{classKDateTable_p1}


The day of the first day in the month [1..7]. 



Definition at line 370 of file kdatetbl.h.

Referenced by date\-From\-Pos(), paint\-Cell(), pos\-From\-Date(), and set\-Date().\index{KDateTable@{KDate\-Table}!numdays@{numdays}}
\index{numdays@{numdays}!KDateTable@{KDate\-Table}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int {\bf KDate\-Table::numdays}\hspace{0.3cm}{\tt  [protected]}}\label{classKDateTable_p2}


The number of days in the current month. 



Definition at line 374 of file kdatetbl.h.

Referenced by set\-Date().\index{KDateTable@{KDate\-Table}!numDaysPrevMonth@{numDaysPrevMonth}}
\index{numDaysPrevMonth@{numDaysPrevMonth}!KDateTable@{KDate\-Table}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int {\bf KDate\-Table::num\-Days\-Prev\-Month}\hspace{0.3cm}{\tt  [protected]}}\label{classKDateTable_p3}


The number of days in the previous month. 



Definition at line 378 of file kdatetbl.h.

Referenced by set\-Date().\index{KDateTable@{KDate\-Table}!unused_hasSelection@{unused\_\-hasSelection}}
\index{unused_hasSelection@{unused\_\-hasSelection}!KDateTable@{KDate\-Table}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool {\bf KDate\-Table::unused\_\-has\-Selection}\hspace{0.3cm}{\tt  [protected]}}\label{classKDateTable_p4}


unused \#\#\# remove in {\bf KDE} 4.0 



Definition at line 383 of file kdatetbl.h.\index{KDateTable@{KDate\-Table}!maxCell@{maxCell}}
\index{maxCell@{maxCell}!KDateTable@{KDate\-Table}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QRect} {\bf KDate\-Table::max\-Cell}\hspace{0.3cm}{\tt  [protected]}}\label{classKDateTable_p5}


Save the size of the largest used cell content. 



Definition at line 387 of file kdatetbl.h.

Referenced by paint\-Cell(), set\-Font\-Size(), and size\-Hint().

\subsection{Property Documentation}
\index{KDateTable@{KDate\-Table}!date@{date}}
\index{date@{date}!KDateTable@{KDate\-Table}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QDate} KDate\-Table::date\hspace{0.3cm}{\tt  [read, write]}}\label{classKDateTable_00}


The currently selected date. 



Definition at line 257 of file kdatetbl.h.

Referenced by contents\-Mouse\-Press\-Event(), date\-From\-Pos(), paint\-Cell(), set\-Custom\-Date\-Painting(), set\-Date(), and unset\-Custom\-Date\-Painting().

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
kdatetbl.h\item 
kdatetbl.cpp\end{CompactItemize}
