static gboolean gnc_date_cell_enter (BasicCell *bcell, int *cursor_position, int *start_selection, int *end_selection) { DateCell *cell = (DateCell *) bcell; PopBox *box = bcell->gui_private; gnc_item_edit_set_popup (box->item_edit, GNOME_CANVAS_ITEM (box->date_picker), get_popup_height, NULL, popup_set_focus, NULL, NULL, NULL); block_picker_signals (cell); gnc_date_picker_set_date (box->date_picker, box->date.tm_mday, box->date.tm_mon, box->date.tm_year + 1900); unblock_picker_signals (cell); date_picker_connect_signals ((DateCell *) bcell); *start_selection = 0; *end_selection = -1; return TRUE; }
static void gnc_date_cell_move (BasicCell *bcell) { PopBox *box = bcell->gui_private; date_picker_disconnect_signals ((DateCell *) bcell); gnc_item_edit_set_popup (box->item_edit, NULL, NULL, NULL, NULL, NULL, NULL, NULL); box->calendar_popped = FALSE; }
static void gnc_date_cell_leave (BasicCell *bcell) { Timespec ts; PopBox *box = bcell->gui_private; date_picker_disconnect_signals ((DateCell *) bcell); gnc_item_edit_set_popup (box->item_edit, NULL, NULL, NULL, NULL, NULL, NULL, NULL); box->calendar_popped = FALSE; /* Refresh the date to expand any shortcuts. */ gnc_date_cell_get_date ((DateCell *)bcell, &ts); gnc_date_cell_set_value_secs ((DateCell *)bcell, ts.tv_sec); }
void gnc_item_edit_configure (GncItemEdit *item_edit) { GnucashSheet *sheet = item_edit->sheet; GnucashCursor *cursor; gfloat xalign; cursor = GNUCASH_CURSOR(sheet->cursor); item_edit->virt_loc.vcell_loc.virt_row = cursor->row; item_edit->virt_loc.vcell_loc.virt_col = cursor->col; item_edit->style = gnucash_sheet_get_style (sheet, item_edit->virt_loc.vcell_loc); item_edit->virt_loc.phys_row_offset = cursor->cell.row; item_edit->virt_loc.phys_col_offset = cursor->cell.col; switch (gnc_table_get_align (sheet->table, item_edit->virt_loc)) { default: case CELL_ALIGN_LEFT: xalign = 0; break; case CELL_ALIGN_RIGHT: xalign = 1; break; case CELL_ALIGN_CENTER: xalign = 0.5; break; } gtk_entry_set_alignment(GTK_ENTRY(item_edit->editor), xalign); if (!gnc_table_is_popup (sheet->table, item_edit->virt_loc)) gnc_item_edit_set_popup (item_edit, NULL, NULL, NULL, NULL, NULL, NULL, NULL); g_idle_add_full (G_PRIORITY_HIGH_IDLE, (GSourceFunc) gnc_item_edit_update, item_edit, NULL); }