您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

173 行
6.3 KiB

  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. #if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
  26. #error "Only <gtk/gtk.h> can be included directly."
  27. #endif
  28. #ifndef __GTK_PROGRESS_BAR_H__
  29. #define __GTK_PROGRESS_BAR_H__
  30. #include <gtk/gtkprogress.h>
  31. G_BEGIN_DECLS
  32. #define GTK_TYPE_PROGRESS_BAR (gtk_progress_bar_get_type ())
  33. #define GTK_PROGRESS_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_PROGRESS_BAR, GtkProgressBar))
  34. #define GTK_PROGRESS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_PROGRESS_BAR, GtkProgressBarClass))
  35. #define GTK_IS_PROGRESS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_PROGRESS_BAR))
  36. #define GTK_IS_PROGRESS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_PROGRESS_BAR))
  37. #define GTK_PROGRESS_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_PROGRESS_BAR, GtkProgressBarClass))
  38. typedef struct _GtkProgressBar GtkProgressBar;
  39. typedef struct _GtkProgressBarClass GtkProgressBarClass;
  40. typedef enum
  41. {
  42. GTK_PROGRESS_CONTINUOUS,
  43. GTK_PROGRESS_DISCRETE
  44. } GtkProgressBarStyle;
  45. typedef enum
  46. {
  47. GTK_PROGRESS_LEFT_TO_RIGHT,
  48. GTK_PROGRESS_RIGHT_TO_LEFT,
  49. GTK_PROGRESS_BOTTOM_TO_TOP,
  50. GTK_PROGRESS_TOP_TO_BOTTOM
  51. } GtkProgressBarOrientation;
  52. struct _GtkProgressBar
  53. {
  54. GtkProgress progress;
  55. GtkProgressBarStyle GSEAL (bar_style);
  56. GtkProgressBarOrientation GSEAL (orientation);
  57. guint GSEAL (blocks);
  58. gint GSEAL (in_block);
  59. gint GSEAL (activity_pos);
  60. guint GSEAL (activity_step);
  61. guint GSEAL (activity_blocks);
  62. gdouble GSEAL (pulse_fraction);
  63. guint GSEAL (activity_dir) : 1;
  64. guint GSEAL (ellipsize) : 3;
  65. guint GSEAL (dirty) : 1;
  66. };
  67. struct _GtkProgressBarClass
  68. {
  69. GtkProgressClass parent_class;
  70. /* Padding for future expansion */
  71. void (*_gtk_reserved1) (void);
  72. void (*_gtk_reserved2) (void);
  73. void (*_gtk_reserved3) (void);
  74. void (*_gtk_reserved4) (void);
  75. };
  76. GType gtk_progress_bar_get_type (void) G_GNUC_CONST;
  77. GtkWidget* gtk_progress_bar_new (void);
  78. /*
  79. * GtkProgress/GtkProgressBar had serious problems in GTK 1.2.
  80. *
  81. * - Only 3 or 4 functions are really needed for 95% of progress
  82. * interfaces; GtkProgress[Bar] had about 25 functions, and
  83. * didn't even include these 3 or 4.
  84. * - In activity mode, the API involves setting the adjustment
  85. * to any random value, just to have the side effect of
  86. * calling the progress bar update function - the adjustment
  87. * is totally ignored in activity mode
  88. * - You set the activity step as a pixel value, which means to
  89. * set the activity step you basically need to connect to
  90. * size_allocate
  91. * - There are ctree_set_expander_style()-functions, to randomly
  92. * change look-and-feel for no good reason
  93. * - The split between GtkProgress and GtkProgressBar makes no sense
  94. * to me whatsoever.
  95. *
  96. * This was a big wart on GTK and made people waste lots of time,
  97. * both learning and using the interface.
  98. *
  99. * So, I have added what I feel is the correct API, and marked all the
  100. * rest deprecated. However, the changes are 100% backward-compatible and
  101. * should break no existing code.
  102. *
  103. * The following 9 functions are the new programming interface.
  104. */
  105. void gtk_progress_bar_pulse (GtkProgressBar *pbar);
  106. void gtk_progress_bar_set_text (GtkProgressBar *pbar,
  107. const gchar *text);
  108. void gtk_progress_bar_set_fraction (GtkProgressBar *pbar,
  109. gdouble fraction);
  110. void gtk_progress_bar_set_pulse_step (GtkProgressBar *pbar,
  111. gdouble fraction);
  112. void gtk_progress_bar_set_orientation (GtkProgressBar *pbar,
  113. GtkProgressBarOrientation orientation);
  114. G_CONST_RETURN gchar* gtk_progress_bar_get_text (GtkProgressBar *pbar);
  115. gdouble gtk_progress_bar_get_fraction (GtkProgressBar *pbar);
  116. gdouble gtk_progress_bar_get_pulse_step (GtkProgressBar *pbar);
  117. GtkProgressBarOrientation gtk_progress_bar_get_orientation (GtkProgressBar *pbar);
  118. void gtk_progress_bar_set_ellipsize (GtkProgressBar *pbar,
  119. PangoEllipsizeMode mode);
  120. PangoEllipsizeMode gtk_progress_bar_get_ellipsize (GtkProgressBar *pbar);
  121. #ifndef GTK_DISABLE_DEPRECATED
  122. /* Everything below here is deprecated */
  123. GtkWidget* gtk_progress_bar_new_with_adjustment (GtkAdjustment *adjustment);
  124. void gtk_progress_bar_set_bar_style (GtkProgressBar *pbar,
  125. GtkProgressBarStyle style);
  126. void gtk_progress_bar_set_discrete_blocks (GtkProgressBar *pbar,
  127. guint blocks);
  128. /* set_activity_step() is not only deprecated, it doesn't even work.
  129. * (Of course, it wasn't usable anyway, you had to set it from a size_allocate
  130. * handler or something)
  131. */
  132. void gtk_progress_bar_set_activity_step (GtkProgressBar *pbar,
  133. guint step);
  134. void gtk_progress_bar_set_activity_blocks (GtkProgressBar *pbar,
  135. guint blocks);
  136. void gtk_progress_bar_update (GtkProgressBar *pbar,
  137. gdouble percentage);
  138. #endif /* GTK_DISABLE_DEPRECATED */
  139. G_END_DECLS
  140. #endif /* __GTK_PROGRESS_BAR_H__ */