switching to XML DocBook
[dia.git] / app / diapagelayout.h
blobe80440b5ea7c7c73f34c4b7f7925df946c9362d4
1 /* Dia -- an diagram creation/manipulation program
2 * Copyright (C) 1998, 1999 Alexander Larsson
4 * diapagelayout.[ch] -- a page settings widget for dia.
5 * Copyright (C) 1999 James Henstridge
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 #ifndef DIAPAGELAYOUT_H
23 #define DIAPAGELAYOUT_H
25 #include <gtk/gtk.h>
27 #define DIA_PAGE_LAYOUT(obj) GTK_CHECK_CAST(obj, dia_page_layout_get_type(), DiaPageLayout)
28 #define DIA_PAGE_LAYOUT_CLASS(klass) GTK_CHECK_CLASS_CAST(klass, dia_page_layout_get_type(), DiaPageLayoutClass)
29 #define DIA_IS_PAGE_LAYOUT(obj) GTK_CHECK_TYPE(obj, dia_page_layout_get_type())
31 typedef struct _DiaPageLayout DiaPageLayout;
32 typedef struct _DiaPageLayoutClass DiaPageLayoutClass;
34 typedef enum {
35 DIA_PAGE_ORIENT_PORTRAIT,
36 DIA_PAGE_ORIENT_LANDSCAPE
37 } DiaPageOrientation;
39 struct _DiaPageLayout {
40 GtkTable parent;
42 /*<private>*/
43 GtkWidget *paper_size, *paper_label;
44 GtkWidget *orient_portrait, *orient_landscape;
45 GtkWidget *tmargin, *bmargin, *lmargin, *rmargin;
46 GtkWidget *scale, *fitto;
47 GtkWidget *scaling, *fitw, *fith;
49 GtkWidget *darea;
51 GdkGC *gc;
52 GdkColor white, black, blue;
53 gint papernum; /* index into page_metrics array */
55 /* position of paper preview */
56 gint x, y, width, height;
58 gboolean block_changed;
61 struct _DiaPageLayoutClass {
62 GtkTableClass parent_class;
64 void (*changed)(DiaPageLayout *pl);
67 GtkType dia_page_layout_get_type (void);
68 GtkWidget *dia_page_layout_new (void);
70 const gchar *dia_page_layout_get_paper (DiaPageLayout *pl);
71 void dia_page_layout_set_paper (DiaPageLayout *pl,
72 const gchar *paper);
73 void dia_page_layout_get_margins (DiaPageLayout *pl,
74 gfloat *tmargin, gfloat *bmargin,
75 gfloat *lmargin, gfloat *rmargin);
76 void dia_page_layout_set_margins (DiaPageLayout *pl,
77 gfloat tmargin, gfloat bmargin,
78 gfloat lmargin, gfloat rmargin);
79 DiaPageOrientation dia_page_layout_get_orientation (DiaPageLayout *pl);
80 void dia_page_layout_set_orientation (DiaPageLayout *pl,
81 DiaPageOrientation orient);
82 gboolean dia_page_layout_get_fitto (DiaPageLayout *self);
83 void dia_page_layout_set_fitto (DiaPageLayout *self,
84 gboolean fitto);
85 gfloat dia_page_layout_get_scaling (DiaPageLayout *self);
86 void dia_page_layout_set_scaling (DiaPageLayout *self,
87 gfloat scaling);
88 void dia_page_layout_get_fit_dims(DiaPageLayout *self,
89 gint *w, gint *h);
90 void dia_page_layout_set_fit_dims(DiaPageLayout *self,
91 gint w, gint h);
94 void dia_page_layout_get_effective_area (DiaPageLayout *self,
95 gfloat *width,
96 gfloat *height);
98 /* get paper sizes and default margins ... */
99 void dia_page_layout_get_paper_size (const gchar *paper,
100 gfloat *width, gfloat *height);
101 void dia_page_layout_get_default_margins (const gchar *paper,
102 gfloat *tmargin, gfloat *bmargin,
103 gfloat *lmargin, gfloat *rmargin);
105 #endif