1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359
|
/*
* This file is part of gtkD.
*
* gtkD is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version, with
* some exceptions, please read the COPYING file.
*
* gtkD is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with gtkD; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
*/
// generated automatically - do not change
// find conversion definition on APILookup.txt
// implement new conversion functionalities on the wrap.utils pakage
module gtk.Calendar;
private import glib.ConstructionException;
private import gobject.ObjectG;
private import gobject.Signals;
private import gtk.Widget;
private import gtk.c.functions;
public import gtk.c.types;
public import gtkc.gtktypes;
private import std.algorithm;
/**
* #GtkCalendar is a widget that displays a Gregorian calendar, one month
* at a time. It can be created with gtk_calendar_new().
*
* The month and year currently displayed can be altered with
* gtk_calendar_select_month(). The exact day can be selected from the
* displayed month using gtk_calendar_select_day().
*
* To place a visual marker on a particular day, use gtk_calendar_mark_day()
* and to remove the marker, gtk_calendar_unmark_day(). Alternative, all
* marks can be cleared with gtk_calendar_clear_marks().
*
* The way in which the calendar itself is displayed can be altered using
* gtk_calendar_set_display_options().
*
* The selected date can be retrieved from a #GtkCalendar using
* gtk_calendar_get_date().
*
* Users should be aware that, although the Gregorian calendar is the
* legal calendar in most countries, it was adopted progressively
* between 1582 and 1929. Display before these dates is likely to be
* historically incorrect.
*/
public class Calendar : Widget
{
/** the main Gtk struct */
protected GtkCalendar* gtkCalendar;
/** Get the main Gtk struct */
public GtkCalendar* getCalendarStruct(bool transferOwnership = false)
{
if (transferOwnership)
ownedRef = false;
return gtkCalendar;
}
/** the main Gtk struct as a void* */
protected override void* getStruct()
{
return cast(void*)gtkCalendar;
}
/**
* Sets our main struct and passes it to the parent class.
*/
public this (GtkCalendar* gtkCalendar, bool ownedRef = false)
{
this.gtkCalendar = gtkCalendar;
super(cast(GtkWidget*)gtkCalendar, ownedRef);
}
/** */
public static GType getType()
{
return gtk_calendar_get_type();
}
/**
* Creates a new calendar, with the current date being selected.
*
* Returns: a newly #GtkCalendar widget
*
* Throws: ConstructionException GTK+ fails to create the object.
*/
public this()
{
auto p = gtk_calendar_new();
if(p is null)
{
throw new ConstructionException("null returned by new");
}
this(cast(GtkCalendar*) p);
}
/**
* Remove all visual markers.
*/
public void clearMarks()
{
gtk_calendar_clear_marks(gtkCalendar);
}
/**
* Obtains the selected date from a #GtkCalendar.
*
* Params:
* year = location to store the year as a decimal
* number (e.g. 2011), or %NULL
* month = location to store the month number
* (between 0 and 11), or %NULL
* day = location to store the day number (between
* 1 and 31), or %NULL
*/
public void getDate(out uint year, out uint month, out uint day)
{
gtk_calendar_get_date(gtkCalendar, &year, &month, &day);
}
/**
* Returns if the @day of the @calendar is already marked.
*
* Params:
* day = the day number between 1 and 31.
*
* Returns: whether the day is marked.
*
* Since: 3.0
*/
public bool getDayIsMarked(uint day)
{
return gtk_calendar_get_day_is_marked(gtkCalendar, day) != 0;
}
/**
* Queries the height of detail cells, in rows.
* See #GtkCalendar:detail-width-chars.
*
* Returns: The height of detail cells, in rows.
*
* Since: 2.14
*/
public int getDetailHeightRows()
{
return gtk_calendar_get_detail_height_rows(gtkCalendar);
}
/**
* Queries the width of detail cells, in characters.
* See #GtkCalendar:detail-width-chars.
*
* Returns: The width of detail cells, in characters.
*
* Since: 2.14
*/
public int getDetailWidthChars()
{
return gtk_calendar_get_detail_width_chars(gtkCalendar);
}
/**
* Returns the current display options of @calendar.
*
* Returns: the display options.
*
* Since: 2.4
*/
public GtkCalendarDisplayOptions getDisplayOptions()
{
return gtk_calendar_get_display_options(gtkCalendar);
}
/**
* Places a visual marker on a particular day.
*
* Params:
* day = the day number to mark between 1 and 31.
*/
public void markDay(uint day)
{
gtk_calendar_mark_day(gtkCalendar, day);
}
/**
* Selects a day from the current month.
*
* Params:
* day = the day number between 1 and 31, or 0 to unselect
* the currently selected day.
*/
public void selectDay(uint day)
{
gtk_calendar_select_day(gtkCalendar, day);
}
/**
* Shifts the calendar to a different month.
*
* Params:
* month = a month number between 0 and 11.
* year = the year the month is in.
*/
public void selectMonth(uint month, uint year)
{
gtk_calendar_select_month(gtkCalendar, month, year);
}
/**
* Installs a function which provides Pango markup with detail information
* for each day. Examples for such details are holidays or appointments. That
* information is shown below each day when #GtkCalendar:show-details is set.
* A tooltip containing with full detail information is provided, if the entire
* text should not fit into the details area, or if #GtkCalendar:show-details
* is not set.
*
* The size of the details area can be restricted by setting the
* #GtkCalendar:detail-width-chars and #GtkCalendar:detail-height-rows
* properties.
*
* Params:
* func = a function providing details for each day.
* data = data to pass to @func invokations.
* destroy = a function for releasing @data.
*
* Since: 2.14
*/
public void setDetailFunc(GtkCalendarDetailFunc func, void* data, GDestroyNotify destroy)
{
gtk_calendar_set_detail_func(gtkCalendar, func, data, destroy);
}
/**
* Updates the height of detail cells.
* See #GtkCalendar:detail-height-rows.
*
* Params:
* rows = detail height in rows.
*
* Since: 2.14
*/
public void setDetailHeightRows(int rows)
{
gtk_calendar_set_detail_height_rows(gtkCalendar, rows);
}
/**
* Updates the width of detail cells.
* See #GtkCalendar:detail-width-chars.
*
* Params:
* chars = detail width in characters.
*
* Since: 2.14
*/
public void setDetailWidthChars(int chars)
{
gtk_calendar_set_detail_width_chars(gtkCalendar, chars);
}
/**
* Sets display options (whether to display the heading and the month
* headings).
*
* Params:
* flags = the display options to set
*
* Since: 2.4
*/
public void setDisplayOptions(GtkCalendarDisplayOptions flags)
{
gtk_calendar_set_display_options(gtkCalendar, flags);
}
/**
* Removes the visual marker from a particular day.
*
* Params:
* day = the day number to unmark between 1 and 31.
*/
public void unmarkDay(uint day)
{
gtk_calendar_unmark_day(gtkCalendar, day);
}
/**
* Emitted when the user selects a day.
*/
gulong addOnDaySelected(void delegate(Calendar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
return Signals.connect(this, "day-selected", dlg, connectFlags ^ ConnectFlags.SWAPPED);
}
/**
* Emitted when the user double-clicks a day.
*/
gulong addOnDaySelectedDoubleClick(void delegate(Calendar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
return Signals.connect(this, "day-selected-double-click", dlg, connectFlags ^ ConnectFlags.SWAPPED);
}
/**
* Emitted when the user clicks a button to change the selected month on a
* calendar.
*/
gulong addOnMonthChanged(void delegate(Calendar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
return Signals.connect(this, "month-changed", dlg, connectFlags ^ ConnectFlags.SWAPPED);
}
/**
* Emitted when the user switched to the next month.
*/
gulong addOnNextMonth(void delegate(Calendar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
return Signals.connect(this, "next-month", dlg, connectFlags ^ ConnectFlags.SWAPPED);
}
/**
* Emitted when user switched to the next year.
*/
gulong addOnNextYear(void delegate(Calendar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
return Signals.connect(this, "next-year", dlg, connectFlags ^ ConnectFlags.SWAPPED);
}
/**
* Emitted when the user switched to the previous month.
*/
gulong addOnPrevMonth(void delegate(Calendar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
return Signals.connect(this, "prev-month", dlg, connectFlags ^ ConnectFlags.SWAPPED);
}
/**
* Emitted when user switched to the previous year.
*/
gulong addOnPrevYear(void delegate(Calendar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
return Signals.connect(this, "prev-year", dlg, connectFlags ^ ConnectFlags.SWAPPED);
}
}
|