当前位置: 首页>>代码示例>>C++>>正文


C++ GTK_CALENDAR函数代码示例

本文整理汇总了C++中GTK_CALENDAR函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_CALENDAR函数的具体用法?C++ GTK_CALENDAR怎么用?C++ GTK_CALENDAR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GTK_CALENDAR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: gtk_dateentry_calendar_getfrom

/*
** store the calendar date to GDate, update our gtkentry
*/
static void gtk_dateentry_calendar_getfrom(GtkWidget * calendar, GtkDateEntry * dateentry)
{
guint year, month, day;

	DB( g_print(" (dateentry) get from calendar\n") );

	gtk_calendar_get_date (GTK_CALENDAR (dateentry->calendar), &year, &month, &day);
	g_date_set_dmy (dateentry->date, day, month + 1, year);
	gtk_dateentry_datetoentry(dateentry);
}
开发者ID:hdd,项目名称:homebank,代码行数:13,代码来源:gtkdateentry.c

示例2: update_calendar

static void
update_calendar (TpawCalendarButton *self)
{
  if (self->priv->calendar == NULL)
    return;

  gtk_calendar_clear_marks (GTK_CALENDAR (self->priv->calendar));

  if (self->priv->date == NULL)
    return;

  gtk_calendar_select_day (GTK_CALENDAR (self->priv->calendar),
      g_date_get_day (self->priv->date));
  gtk_calendar_select_month (GTK_CALENDAR (self->priv->calendar),
      g_date_get_month (self->priv->date) - 1,
      g_date_get_year (self->priv->date));
  gtk_calendar_mark_day (GTK_CALENDAR (self->priv->calendar),
      g_date_get_day (self->priv->date));
}
开发者ID:GNOME,项目名称:telepathy-account-widgets,代码行数:19,代码来源:tpaw-calendar-button.c

示例3: seahorse_gpgme_expires_new

void
seahorse_gpgme_expires_new (SeahorseGpgmeSubkey *subkey, GtkWindow *parent)
{
	SeahorseWidget *swidget;
	GtkWidget *date, *expire;
	gulong expires;
	gchar *title;
	const gchar *label;
	
	g_return_if_fail (subkey != NULL && SEAHORSE_IS_GPGME_SUBKEY (subkey));

	swidget = seahorse_widget_new_allow_multiple ("expires", parent);
	g_return_if_fail (swidget != NULL);
	g_object_set_data_full (G_OBJECT (swidget), "subkey", 
	                        g_object_ref (subkey), g_object_unref);
	
	date = GTK_WIDGET (seahorse_widget_get_widget (swidget, "calendar"));
	g_return_if_fail (date != NULL);

	expire = GTK_WIDGET (seahorse_widget_get_widget (swidget, "expire"));
	expires = seahorse_pgp_subkey_get_expires (SEAHORSE_PGP_SUBKEY (subkey)); 
	if (!expires) {
		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (expire), TRUE);
		gtk_widget_set_sensitive (date, FALSE);
	} else {
		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (expire), FALSE);
		gtk_widget_set_sensitive (date, TRUE);
	}
    
	if (expires) {
		struct tm t;
		time_t time = (time_t)expires;
		if (gmtime_r (&time, &t)) {
			gtk_calendar_select_month (GTK_CALENDAR (date), t.tm_mon, t.tm_year + 1900);
			gtk_calendar_select_day (GTK_CALENDAR (date), t.tm_mday);
		}
	}
	
	label = seahorse_pgp_subkey_get_description (SEAHORSE_PGP_SUBKEY (subkey));
	title = g_strdup_printf (_("Expiry: %s"), label);
	gtk_window_set_title (GTK_WINDOW (seahorse_widget_get_widget (swidget, swidget->name)), title);
	g_free (title);
}
开发者ID:nobled,项目名称:seahorse,代码行数:43,代码来源:seahorse-gpgme-expires.c

示例4: GetCalendar

static	void
GetCalendar(
	GtkWidget			*widget,
	_Calendar			*data)
{
ENTER_FUNC;
	gtk_calendar_get_date(GTK_CALENDAR(widget), 
		&(data->year),&(data->month),&(data->day));
LEAVE_FUNC;
}
开发者ID:authorNari,项目名称:panda,代码行数:10,代码来源:widgetOPS.c

示例5: on_calendar1_day_selected

void on_calendar1_day_selected( GtkWidget *widget, struct _properties *properties )
{
  g_print("on_calendar1_day_selected()\n");

  guint day, month, year;
  gtk_calendar_get_date (GTK_CALENDAR(properties->GtkInfo.calendar1), &year, &month, &day);

  int daysaway = date_to_days_away(day,month+1,year-2000);

  g_print("daysaway = %d, day = %d, month = %d, year = %d\n", daysaway, day, month, year);

  if(daysaway < 0)
  {
    properties->data.t[properties->calendarSelected] = 0;
    gtk_label_set_text(GTK_LABEL(properties->GtkInfo.labelCalendar),"Please select date greater than current");

  } else
  {
    time(&properties->starttime);

    int dummy;
    int hour;
    int minute;
    int seconds;

    switch(properties->calendarSelected)
    {
    case 0:
      decimal_date_to_real_dates(properties->data.t[properties->calendarSelected] - properties->data.te, &dummy, &dummy, &dummy, &hour, &minute, &seconds);
      break;

    case 1:
      decimal_date_to_real_dates(properties->data.t[properties->calendarSelected] - properties->data.te2, &dummy, &dummy, &dummy, &hour, &minute, &seconds);
      break;

    case 2:
      decimal_date_to_real_dates(properties->data.t[properties->calendarSelected] - properties->data.te3, &dummy, &dummy, &dummy, &hour, &minute, &seconds);
      break;

    default:
      g_print("on_calendar1_day_selected(): Bad calendarSelected switch\n");
      break;
    }

    properties->data.t[properties->calendarSelected] = adjust_to_current_time_forward( (double) --daysaway / (double) 365, 0.0 );

    double k = (double) (
                 ( (double)(hour)*(double)60*(double)60) +
                 (double)(minute*60) + (double)seconds);

    properties->data.t[properties->calendarSelected] += (double) ( (k) /(double)86400)/(double)365;
    gtk_label_set_text(GTK_LABEL(properties->GtkInfo.labelCalendar),"");
  }
}
开发者ID:mmizutani,项目名称:optionmatrix,代码行数:54,代码来源:gtk_calendar.cpp

示例6: selecionadata

void selecionadata(GtkWidget *widget,gpointer *entry){
gint ano,mes,dia;
char data[11];
gtk_calendar_get_date(GTK_CALENDAR(calendar),&ano,&mes,&dia);
mes ++;
//g_print("%d/%d/%d",dia,mes,ano);
//gtk_entry_set_text
sprintf(data,"%d/%d/%d",dia,mes,ano);
gtk_entry_set_text(GTK_ENTRY(entry),data);

}
开发者ID:uelei,项目名称:pbc,代码行数:11,代码来源:data.c

示例7: day_selected

static void
day_selected(GtkWidget *cal, calendar_data *cdata) {
	/* don't close it when the day change was caused by a month change! */
	if (!cdata->closehack) {
		guint *date = cdata->date;
		gtk_calendar_get_date(GTK_CALENDAR(cal), &date[0], &date[1], &date[2]);
		date[1]++; /* month was zero-based. */
		gtk_widget_destroy(cdata->win);
	}
	cdata->closehack = FALSE;
}
开发者ID:andy-shev,项目名称:LogJam,代码行数:11,代码来源:popcalendar.c

示例8: clip_GTK_CALENDARTHAW

/* Defrosts a calendar; all the changes made since
 * the last gtk_calendar_freeze() are displayed. */
int
clip_GTK_CALENDARTHAW(ClipMachine * ClipMachineMemory)
{
   C_widget *ccal = _fetch_cw_arg(ClipMachineMemory);

   CHECKCWID(ccal, GTK_IS_CALENDAR);
   gtk_calendar_thaw(GTK_CALENDAR(ccal->widget));
   return 0;
 err:
   return 1;
}
开发者ID:amery,项目名称:clip-angelo,代码行数:13,代码来源:calendar.c

示例9: calendar_day_selected_double_click

void calendar_day_selected_double_click( GtkWidget    *widget,
                                         CalendarData *data )
{
  struct tm tm;
  char buffer[256] = "day_selected_double_click: ";

  calendar_date_to_string (data, buffer+27, 256-27);
  calendar_set_signal_strings (buffer, data);

  memset (&tm, 0, sizeof (tm));
  gtk_calendar_get_date (GTK_CALENDAR(data->window),
			 &tm.tm_year, &tm.tm_mon, &tm.tm_mday);
  tm.tm_year -= TM_YEAR_BASE;

  if(GTK_CALENDAR(data->window)->marked_date[tm.tm_mday-1] == 0) {
    gtk_calendar_mark_day(GTK_CALENDAR(data->window),tm.tm_mday);
  } else { 
    gtk_calendar_unmark_day(GTK_CALENDAR(data->window),tm.tm_mday);
  }
}
开发者ID:omork,项目名称:mythryl,代码行数:20,代码来源:calendar.c

示例10: main

int main(int argc, char** argv)
{
    GtkWidget *window;
    GtkWidget *calendar;

    gtk_init(&argc, &argv);
    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
    g_signal_connect(GTK_OBJECT(window), "destroy", G_CALLBACK(gtk_main_quit), NULL);

    calendar = gtk_calendar_new();
    gtk_calendar_display_options(GTK_CALENDAR(calendar), GTK_CALENDAR_SHOW_HEADING|GTK_CALENDAR_SHOW_DAY_NAMES|
	    GTK_CALENDAR_SHOW_WEEK_NUMBERS|GTK_CALENDAR_WEEK_START_MONDAY);
    gtk_calendar_select_month(GTK_CALENDAR(calendar),8,1985);
    gtk_calendar_select_day(GTK_CALENDAR(calendar),8);
    gtk_container_add(GTK_CONTAINER(window), calendar);

    gtk_widget_show_all(window);
    gtk_main();
}
开发者ID:zhoujianchun,项目名称:gtk-pro,代码行数:20,代码来源:calendar_show_2.c

示例11: clip_GTK_CALENDARCLEARMARKS

int
clip_GTK_CALENDARCLEARMARKS(ClipMachine * ClipMachineMemory)
{
   C_widget *ccal = _fetch_cw_arg(ClipMachineMemory);

   CHECKCWID(ccal, GTK_IS_CALENDAR);
   gtk_calendar_clear_marks(GTK_CALENDAR(ccal->widget));
   return 0;
 err:
   return 1;
}
开发者ID:amery,项目名称:clip-angelo,代码行数:11,代码来源:calendar.c

示例12: create_simple_calendar_item

static GtkWidget* create_simple_calendar_item(GtkWidget** calendar_out)
{
    GtkWidget* menu_item = gtk_menu_item_new();
    GtkWidget* calendar = *calendar_out = gtk_calendar_new();
    gtk_calendar_set_display_options(GTK_CALENDAR(calendar),
                                     GTK_CALENDAR_SHOW_HEADING | GTK_CALENDAR_NO_MONTH_CHANGE |
                                     GTK_CALENDAR_SHOW_DAY_NAMES | GTK_CALENDAR_SHOW_DETAILS);
    gtk_widget_set_sensitive(menu_item, FALSE);
    gtk_container_add(GTK_CONTAINER(menu_item), calendar);
    return menu_item;
}
开发者ID:Generator,项目名称:lightdm-another-gtk-greeter,代码行数:11,代码来源:indicator_clock.c

示例13: gtk_dialog_new_with_buttons

/**
 * a_dialog_get_date:
 *
 * Returns: a date as a string - always in ISO8601 format (YYYY-MM-DD)
 *  This string can be NULL (especially when the dialog is cancelled)
 *  Free the string after use
 */
gchar *a_dialog_get_date ( GtkWindow *parent, const gchar *title )
{
  GtkWidget *dialog = gtk_dialog_new_with_buttons ( title,
                                                    parent,
                                                    GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
                                                    GTK_STOCK_CANCEL,
                                                    GTK_RESPONSE_REJECT,
                                                    GTK_STOCK_OK,
                                                    GTK_RESPONSE_ACCEPT,
                                                    NULL);
  GtkWidget *cal = gtk_calendar_new ();
  GtkWidget *today = gtk_button_new_with_label ( _("Today") );

  static guint year = 0;
  static guint month = 0;
  static guint day = 0;

  if ( year != 0 ) {
    // restore the last selected date
    gtk_calendar_select_month ( GTK_CALENDAR(cal), month, year );
    gtk_calendar_select_day ( GTK_CALENDAR(cal), day );
  }

  gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), today, FALSE, FALSE, 0);
  gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), cal, FALSE, FALSE, 0);

  g_signal_connect_swapped ( G_OBJECT(today), "clicked", G_CALLBACK(today_clicked), cal );

  gtk_widget_show_all ( dialog );

  gtk_dialog_set_default_response ( GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT );

  gchar *date_str = NULL;
  if ( gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT )
  {
    gtk_calendar_get_date ( GTK_CALENDAR(cal), &year, &month, &day );
    date_str = g_strdup_printf ( "%d-%02d-%02d", year, month+1, day );
  }
  gtk_widget_destroy ( dialog );
  return date_str;
}
开发者ID:AurelienTT,项目名称:viking,代码行数:48,代码来源:dialog.c

示例14: calendar_set_flags

void calendar_set_flags( CalendarData *calendar )
{
  gint i;
  gint options=0;
  for (i=0;i<5;i++) 
    if (calendar->settings[i])
      {
	options=options + (1<<i);
      }
  if (calendar->window)
    gtk_calendar_display_options (GTK_CALENDAR (calendar->window), options);
}
开发者ID:omork,项目名称:mythryl,代码行数:12,代码来源:calendar.c

示例15: on_visibility_notify

static gboolean on_visibility_notify(GtkWidget* widget,
                                     GdkEvent* event,
                                     gpointer data)
{
    GDateTime* datetime = g_date_time_new_now_local();
    if(!datetime)
    {
        gtk_menu_item_set_label(GTK_MENU_ITEM(greeter.ui.clock.date_widget), "[date]");
        g_signal_handler_disconnect(greeter.ui.clock.date_widget, visibility_notify_id);
        return TRUE;
    }
    gchar* str = g_date_time_format(datetime, config.clock.date_format);
    gtk_menu_item_set_label(GTK_MENU_ITEM(greeter.ui.clock.date_widget), str);
    gtk_calendar_select_month(GTK_CALENDAR(greeter.ui.clock.calendar_widget),
                              g_date_time_get_month(datetime) - 1,
                              g_date_time_get_year(datetime));
    gtk_calendar_select_day(GTK_CALENDAR(greeter.ui.clock.calendar_widget), g_date_time_get_day_of_month(datetime));
    g_free(str);
    g_date_time_unref(datetime);
    return TRUE;
}
开发者ID:Generator,项目名称:lightdm-another-gtk-greeter,代码行数:21,代码来源:indicator_clock.c


注:本文中的GTK_CALENDAR函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。