You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /* GTK - The GIMP Toolkit
  2. * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2 of the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with this library; if not, write to the
  16. * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  17. * Boston, MA 02111-1307, USA.
  18. */
  19. /*
  20. * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
  21. * file for a list of people on the GTK+ Team. See the ChangeLog
  22. * files for a list of changes. These files are distributed with
  23. * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
  24. */
  25. /*
  26. * NOTE this widget is considered too specialized/little-used for
  27. * GTK+, and will in the future be moved to some other package. If
  28. * your application needs this widget, feel free to use it, as the
  29. * widget does work and is useful in some applications; it's just not
  30. * of general interest. However, we are not accepting new features for
  31. * the widget, and it will eventually move out of the GTK+
  32. * distribution.
  33. */
  34. #if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
  35. #error "Only <gtk/gtk.h> can be included directly."
  36. #endif
  37. #ifndef __GTK_RULER_H__
  38. #define __GTK_RULER_H__
  39. #include <gtk/gtkwidget.h>
  40. G_BEGIN_DECLS
  41. #define GTK_TYPE_RULER (gtk_ruler_get_type ())
  42. #define GTK_RULER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_RULER, GtkRuler))
  43. #define GTK_RULER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_RULER, GtkRulerClass))
  44. #define GTK_IS_RULER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_RULER))
  45. #define GTK_IS_RULER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_RULER))
  46. #define GTK_RULER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_RULER, GtkRulerClass))
  47. typedef struct _GtkRuler GtkRuler;
  48. typedef struct _GtkRulerClass GtkRulerClass;
  49. typedef struct _GtkRulerMetric GtkRulerMetric;
  50. /* All distances below are in 1/72nd's of an inch. (According to
  51. * Adobe that's a point, but points are really 1/72.27 in.)
  52. */
  53. struct _GtkRuler
  54. {
  55. GtkWidget widget;
  56. GdkPixmap *GSEAL (backing_store);
  57. GdkGC *GSEAL (non_gr_exp_gc); /* unused */
  58. GtkRulerMetric *GSEAL (metric);
  59. gint GSEAL (xsrc);
  60. gint GSEAL (ysrc);
  61. gint GSEAL (slider_size);
  62. /* The upper limit of the ruler (in points) */
  63. gdouble GSEAL (lower);
  64. /* The lower limit of the ruler */
  65. gdouble GSEAL (upper);
  66. /* The position of the mark on the ruler */
  67. gdouble GSEAL (position);
  68. /* The maximum size of the ruler */
  69. gdouble GSEAL (max_size);
  70. };
  71. struct _GtkRulerClass
  72. {
  73. GtkWidgetClass parent_class;
  74. void (* draw_ticks) (GtkRuler *ruler);
  75. void (* draw_pos) (GtkRuler *ruler);
  76. /* Padding for future expansion */
  77. void (*_gtk_reserved1) (void);
  78. void (*_gtk_reserved2) (void);
  79. void (*_gtk_reserved3) (void);
  80. void (*_gtk_reserved4) (void);
  81. };
  82. struct _GtkRulerMetric
  83. {
  84. gchar *metric_name;
  85. gchar *abbrev;
  86. /* This should be points_per_unit. This is the size of the unit
  87. * in 1/72nd's of an inch and has nothing to do with screen pixels */
  88. gdouble pixels_per_unit;
  89. gdouble ruler_scale[10];
  90. gint subdivide[5]; /* five possible modes of subdivision */
  91. };
  92. GType gtk_ruler_get_type (void) G_GNUC_CONST;
  93. void gtk_ruler_set_metric (GtkRuler *ruler,
  94. GtkMetricType metric);
  95. GtkMetricType gtk_ruler_get_metric (GtkRuler *ruler);
  96. void gtk_ruler_set_range (GtkRuler *ruler,
  97. gdouble lower,
  98. gdouble upper,
  99. gdouble position,
  100. gdouble max_size);
  101. void gtk_ruler_get_range (GtkRuler *ruler,
  102. gdouble *lower,
  103. gdouble *upper,
  104. gdouble *position,
  105. gdouble *max_size);
  106. void gtk_ruler_draw_ticks (GtkRuler *ruler);
  107. void gtk_ruler_draw_pos (GtkRuler *ruler);
  108. G_END_DECLS
  109. #endif /* __GTK_RULER_H__ */