Contents of /trunk/src/portrait.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 288 - (show annotations)
Mon Jun 7 19:19:50 2010 UTC (13 years, 11 months ago) by harbaum
File MIME type: text/plain
File size: 1440 byte(s)
GPS focus enable, portrait support and some attribute icon work
1 /*
2 * Copyright (C) 2010 Till Harbaum <till@harbaum.org>.
3 *
4 * This file is part of GPXView.
5 *
6 * GPXView is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * GPXView is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with GPXView. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #include <gtk/gtk.h>
21 #include "portrait.h"
22
23 static gboolean is_portrait(void) {
24 GdkScreen *screen = gdk_screen_get_default();
25 return (gdk_screen_get_width(screen) < gdk_screen_get_height(screen));
26 }
27
28 static
29 void on_orientation_changed(GdkScreen *screen, gpointer userdata) {
30 printf("screen size changed\n");
31
32 // adjust vbox/hbox
33
34 }
35
36 GtkWidget *portrait_box_new(gboolean homogeneous, gint spacing) {
37 GtkWidget *box = is_portrait()?
38 gtk_vbox_new(homogeneous, spacing):
39 gtk_hbox_new(homogeneous, spacing);
40
41 /* this box needs to be re-arranged for portrait mode */
42 g_signal_connect(gdk_screen_get_default(), "size-changed",
43 G_CALLBACK(on_orientation_changed), box);
44
45 return box;
46 }