kalarm/lib

#include <timeperiod.h>

Inherits TQHBox.

Public Types

enum  Units { MINUTES , HOURS_MINUTES , DAYS , WEEKS }
 

Signals

void valueChanged (int minutes)
 

Public Member Functions

 TimePeriod (bool allowMinute, TQWidget *parent, const char *name=0)
 
bool isReadOnly () const
 
virtual void setReadOnly (bool readOnly)
 
int minutes () const
 
void setMinutes (int minutes, bool dateOnly, Units defaultUnits)
 
void setDateOnly (bool dateOnly)
 
void setMaximum (int hourmin, int days)
 
void setSelectOnStep (bool select)
 
void setFocusOnCount ()
 
void setWhatsThis (const TQString &units, const TQString &dayWeek, const TQString &hourMin=TQString())
 

Static Public Member Functions

static TQString i18n_minutes ()
 
static TQString i18n_Minutes ()
 
static TQString i18n_hours_mins ()
 
static TQString i18n_Hours_Mins ()
 
static TQString i18n_days ()
 
static TQString i18n_Days ()
 
static TQString i18n_weeks ()
 
static TQString i18n_Weeks ()
 

Detailed Description

Time period entry widget.

The TimePeriod class provides a widget for entering a time period as a number of weeks, days, hours and minutes, or minutes.

It displays a combo box to select the time units (weeks, days, hours and minutes, or minutes) alongside a spin box to enter the number of units. The type of spin box displayed alters according to the units selection: day, week and minute values are entered in a normal spin box, while hours and minutes are entered in a time spin box (with two pairs of spin buttons, one for hours and one for minutes).

The widget may be set as read-only. This has the same effect as disabling it, except that its appearance is unchanged.

Author
David Jarvie softw.nosp@m.are@.nosp@m.astro.nosp@m.jar..nosp@m.org.u.nosp@m.k

Definition at line 50 of file timeperiod.h.

Member Enumeration Documentation

◆ Units

Units for the time period.

  • MINUTES - the time period is entered as a number of minutes.
  • HOURS_MINUTES - the time period is entered as an hours/minutes value.
  • DAYS - the time period is entered as a number of days.
  • WEEKS - the time period is entered as a number of weeks.

Definition at line 61 of file timeperiod.h.

Constructor & Destructor Documentation

◆ TimePeriod()

TimePeriod::TimePeriod ( bool  allowMinute,
TQWidget *  parent,
const char *  name = 0 
)

Constructor.

Parameters
allowMinuteSet false to prevent hours/minutes or minutes from being allowed as units; only days and weeks can ever be used, regardless of other method calls. Set true to allow minutes, hours/minutes, days or weeks as units.
parentThe parent object of this widget.
nameThe name of this widget.

Definition at line 53 of file timeperiod.cpp.

Member Function Documentation

◆ isReadOnly()

bool TimePeriod::isReadOnly ( ) const
inline

Returns true if the widget is read only.

Definition at line 73 of file timeperiod.h.

◆ minutes()

int TimePeriod::minutes ( ) const

Gets the entered time period expressed in minutes.

Definition at line 151 of file timeperiod.cpp.

◆ setDateOnly()

void TimePeriod::setDateOnly ( bool  dateOnly)
inline

Enables or disables minutes and hours/minutes units in the combo box.

To disable minutes and hours/minutes, set dateOnly true; to enable minutes and hours/minutes, set dateOnly false. But note that minutes and hours/minutes cannot be enabled if it was disallowed in the constructor.

Definition at line 92 of file timeperiod.h.

◆ setFocusOnCount()

void TimePeriod::setFocusOnCount ( )

Sets the input focus to the count field.

Definition at line 121 of file timeperiod.cpp.

◆ setMaximum()

void TimePeriod::setMaximum ( int  hourmin,
int  days 
)

Sets the maximum values for the minutes and hours/minutes, and days/weeks spin boxes.

Set hourmin = 0 to leave the minutes and hours/minutes maximum unchanged.

Definition at line 130 of file timeperiod.cpp.

◆ setMinutes()

void TimePeriod::setMinutes ( int  minutes,
bool  dateOnly,
TimePeriod::Units  defaultUnits 
)

Initialises the time period value.

Parameters
minutesThe value of the time period to set, expressed as a number of minutes.
dateOnlyTrue to restrict the units available in the combo box to days or weeks.
defaultUnitsThe units to display initially in the combo box.

Definition at line 170 of file timeperiod.cpp.

◆ setReadOnly()

void TimePeriod::setReadOnly ( bool  readOnly)
virtual

Sets whether the widget is read-only for the user.

If read-only, the time period cannot be edited and the units combo box is inactive.

Parameters
readOnlyTrue to set the widget read-only, false to set it read-write.

Definition at line 97 of file timeperiod.cpp.

◆ setSelectOnStep()

void TimePeriod::setSelectOnStep ( bool  select)

Sets whether the editor text is to be selected whenever spin buttons are clicked.

The default is to select it.

Definition at line 112 of file timeperiod.cpp.

◆ setWhatsThis()

void TimePeriod::setWhatsThis ( const TQString &  units,
const TQString &  dayWeek,
const TQString &  hourMin = TQString() 
)

Sets separate WhatsThis texts for the count spin boxes and the units combo box.

If hourMin is omitted, both spin boxes are set to the same WhatsThis text.

Definition at line 379 of file timeperiod.cpp.

◆ valueChanged

void TimePeriod::valueChanged ( int  minutes)
signal

This signal is emitted whenever the value held in the widget changes.

Parameters
minutesThe current value of the time period, expressed in minutes.

The documentation for this class was generated from the following files: