1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-indent-level: 8 -*- */
2 /* this file is part of evince, a gnome document viewer
6 * Lukas Bezdicka <255993@mail.muni.cz>
8 * Evince is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * Evince is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28 #include <glib/gi18n.h>
32 #include "ev-presentation-timer.h"
34 struct _EvPresentationTimerPrivate
40 #define EV_PRESENTATION_TIMER_GET_PRIVATE(object) \
41 (G_TYPE_INSTANCE_GET_PRIVATE ((object), EV_TYPE_PRESENTATION_TIMER, EvPresentationTimerPrivate))
43 G_DEFINE_TYPE (EvPresentationTimer, ev_presentation_timer, GTK_TYPE_DRAWING_AREA);
47 ev_presentation_timer_draw(GtkWidget *timer, cairo_t *cr)
49 EvPresentationTimer *ev_timer = EV_PRESENTATION_TIMER(timer);
50 GtkAllocation allocation;
51 gtk_widget_get_allocation (timer, &allocation);
52 //cairo_translate(cr,allocation.x,allocation.y);
53 cairo_set_source_rgb (cr, 0, 0, 0);
54 cairo_select_font_face (cr, "Sans", CAIRO_FONT_SLANT_NORMAL,
55 CAIRO_FONT_WEIGHT_NORMAL);
56 cairo_set_font_size (cr, 40);
57 guint pos = (allocation.width/ev_timer->priv->pages)*ev_timer->priv->page;
58 cairo_move_to (cr, pos, 40);
59 cairo_show_text (cr, "Disziplin ist Macht.");
66 ev_presentation_timer_set_pages (EvPresentationTimer *ev_timer, guint pages)
68 ev_timer->priv->pages = pages;
72 ev_presentation_timer_set_page (EvPresentationTimer *ev_timer, guint page)
74 ev_timer->priv->page = page;
75 gtk_widget_queue_draw(GTK_WIDGET(ev_timer));
79 ev_presentation_timer_init (EvPresentationTimer *ev_timer)
81 ev_timer->priv = EV_PRESENTATION_TIMER_GET_PRIVATE (ev_timer);
82 ev_timer->priv->page = 0;
83 ev_timer->priv->pages = 0;
87 ev_presentation_timer_class_init (EvPresentationTimerClass *klass)
89 GObjectClass *object_class = G_OBJECT_CLASS (klass);
90 GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
91 //GtkDrawingAreaClass *drawing_area_class = GTK_DRAWING_AREA_CLASS (klass);
92 g_type_class_add_private (object_class, sizeof (EvPresentationTimerPrivate));
93 widget_class->draw = ev_presentation_timer_draw;
95 /*object_class->finalize = ev_presentation_timer_finalize;*/
99 ev_presentation_timer_new (void)
101 EvPresentationTimer *ev_timer;
103 ev_timer = g_object_new (EV_TYPE_PRESENTATION_TIMER, NULL);
104 return GTK_WIDGET (ev_timer);