Mercurial > dwindows
comparison gtk/dw.c @ 591:98a667881e44
Add dw_calendar_new()
author | mhessling@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Fri, 22 Sep 2006 06:04:55 +0000 |
parents | 2111cdb6c451 |
children | 840b43f3976b |
comparison
equal
deleted
inserted
replaced
590:2111cdb6c451 | 591:98a667881e44 |
---|---|
9371 return *percent; | 9371 return *percent; |
9372 return 0.0; | 9372 return 0.0; |
9373 } | 9373 } |
9374 | 9374 |
9375 /* | 9375 /* |
9376 * Creates a calnedar window (widget) with given parameters. | |
9377 * Parameters: | |
9378 * type: Value can be DW_VERT or DW_HORZ. | |
9379 * topleft: Handle to the window to be top or left. | |
9380 * bottomright: Handle to the window to be bottom or right. | |
9381 * Classname: SysMonthCal32 | |
9382 * Returns: | |
9383 * A handle to a calendar window or NULL on failure. | |
9384 */ | |
9385 HWND dw_calendar_new(unsigned long id) | |
9386 { | |
9387 GtkCalendar *tmp; | |
9388 int _locked_by_me = FALSE; | |
9389 GtkCalendarDisplayOptions flags; | |
9390 | |
9391 DW_MUTEX_LOCK; | |
9392 tmp = gtk_calendar_new(); | |
9393 gtk_widget_show(tmp); | |
9394 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_id", (gpointer)id); | |
9395 /* select today */ | |
9396 flags = GTK_CALENDAR_WEEK_START_MONDAY|GTK_CALENDAR_SHOW_HEADING|GTK_CALENDAR_SHOW_DAY_NAMES; | |
9397 gtk_calendar_display_options(tmp,flags); | |
9398 gtk_calendar_select_month(tmp,11,2005); | |
9399 gtk_calendar_select_day(tmp, 12); | |
9400 | |
9401 DW_MUTEX_UNLOCK; | |
9402 return tmp; | |
9403 } | |
9404 | |
9405 /* | |
9406 * Sets the current date of a calendar | |
9407 * Parameters: | |
9408 * handle: The handle to the calendar returned by dw_calendar_new(). | |
9409 * year... | |
9410 */ | |
9411 void dw_calendar_set_date(HWND handle, int year, int month, int day) | |
9412 { | |
9413 int _locked_by_me = FALSE; | |
9414 | |
9415 DW_MUTEX_LOCK; | |
9416 if(GTK_IS_CALENDAR(handle)) | |
9417 { | |
9418 gtk_calendar_select_month(GTK_CALENDAR(handle),month-1,year); | |
9419 gtk_calendar_select_day(GTK_CALENDAR(handle), day); | |
9420 } | |
9421 DW_MUTEX_UNLOCK; | |
9422 return; | |
9423 } | |
9424 | |
9425 /* | |
9426 * Gets the position of a splitbar (pecentage). | |
9427 * Parameters: | |
9428 * handle: The handle to the splitbar returned by dw_splitbar_new(). | |
9429 */ | |
9430 void dw_calendar_get_date(HWND handle, int *year, int *month, int *day) | |
9431 { | |
9432 int _locked_by_me = FALSE; | |
9433 | |
9434 DW_MUTEX_LOCK; | |
9435 if(GTK_IS_CALENDAR(handle)) | |
9436 { | |
9437 gtk_calendar_get_date(GTK_CALENDAR(handle),year,month,day); | |
9438 } | |
9439 DW_MUTEX_UNLOCK; | |
9440 return; | |
9441 } | |
9442 | |
9443 /* | |
9376 * Pack windows (widgets) into a box from the start (or top). | 9444 * Pack windows (widgets) into a box from the start (or top). |
9377 * Parameters: | 9445 * Parameters: |
9378 * box: Window handle of the box to be packed into. | 9446 * box: Window handle of the box to be packed into. |
9379 * item: Window handle of the item to be back. | 9447 * item: Window handle of the item to be back. |
9380 * width: Width in pixels of the item or -1 to be self determined. | 9448 * width: Width in pixels of the item or -1 to be self determined. |