1// included by gtk2.pas 2 3{$IFDEF read_forward_definitions} 4{$ENDIF read_forward_definitions} 5 6//------------------------------------------------------------------------------ 7 8{$IFDEF read_interface_types} 9 PGtkProgressBarStyle = ^TGtkProgressBarStyle; 10 TGtkProgressBarStyle = ( 11 GTK_PROGRESS_CONTINUOUS, 12 GTK_PROGRESS_DISCRETE 13 ); 14 15 PGtkProgressBarOrientation = ^TGtkProgressBarOrientation; 16 TGtkProgressBarOrientation = ( 17 GTK_PROGRESS_LEFT_TO_RIGHT, 18 GTK_PROGRESS_RIGHT_TO_LEFT, 19 GTK_PROGRESS_BOTTOM_TO_TOP, 20 GTK_PROGRESS_TOP_TO_BOTTOM 21 ); 22 23 PGtkProgressBar = ^TGtkProgressBar; 24 TGtkProgressBar = record 25 progress : TGtkProgress; 26 bar_style : TGtkProgressBarStyle; 27 orientation : TGtkProgressBarOrientation; 28 blocks : guint; 29 in_block : gint; 30 activity_pos : gint; 31 activity_step : guint; 32 activity_blocks : guint; 33 pulse_fraction : gdouble; 34 flag0 : word; 35 end; 36 37{ Padding for future expansion } 38 PGtkProgressBarClass = ^TGtkProgressBarClass; 39 TGtkProgressBarClass = record 40 parent_class : TGtkProgressClass; 41 _gtk_reserved1 : procedure ; cdecl; 42 _gtk_reserved2 : procedure ; cdecl; 43 _gtk_reserved3 : procedure ; cdecl; 44 _gtk_reserved4 : procedure ; cdecl; 45 end; 46 47{$ENDIF read_interface_types} 48 49//------------------------------------------------------------------------------ 50 51{$IFDEF read_interface_rest} 52const 53 bm_TGtkProgressBar_activity_dir = $1; 54 bp_TGtkProgressBar_activity_dir = 0; 55 56 57function GTK_TYPE_PROGRESS_BAR : GType; 58function GTK_PROGRESS_BAR(obj: pointer) : PGtkProgressBar; 59function GTK_PROGRESS_BAR_CLASS(klass: pointer) : PGtkProgressBarClass; 60function GTK_IS_PROGRESS_BAR(obj: pointer) : boolean; 61function GTK_IS_PROGRESS_BAR_CLASS(klass: pointer) : boolean; 62function GTK_PROGRESS_BAR_GET_CLASS(obj: pointer) : PGtkProgressBarClass; 63 64function activity_dir(var a : TGtkProgressBar) : guint; 65procedure set_activity_dir(var a : TGtkProgressBar; __activity_dir : guint); 66 67function gtk_progress_bar_get_type:TGtkType; cdecl; external gtklib; 68function gtk_progress_bar_new:PGtkWidget; cdecl; external gtklib; 69{ 70 GtkProgress/GtkProgressBar had serious problems in GTK 1.2. 71 72 - Only 3 or 4 functions are really needed for 95% of progress 73 interfaces; GtkProgress[Bar] had about 25 functions, and 74 didn't even include these 3 or 4. 75 - In activity mode, the API involves setting the adjustment 76 to any random value, just to have the side effect of 77 calling the progress bar update function - the adjustment 78 is totally ignored in activity mode 79 - You set the activity step as a pixel value, which means to 80 set the activity step you basically need to connect to 81 size_allocate 82 - There are ctree_set_expander_style()-functions, to randomly 83 change look-and-feel for no good reason 84 - The split between GtkProgress and GtkProgressBar makes no sense 85 to me whatsoever. 86 87 This was a big wart on GTK and made people waste lots of time, 88 both learning and using the interface. 89 90 So, I have added what I feel is the correct API, and marked all the 91 rest deprecated. However, the changes are 100% backward-compatible and 92 should break no existing code. 93 94 The following 9 functions are the new programming interface. 95 } 96procedure gtk_progress_bar_pulse(pbar:PGtkProgressBar); cdecl; external gtklib; 97procedure gtk_progress_bar_set_text(pbar:PGtkProgressBar; text:Pgchar); cdecl; external gtklib; 98procedure gtk_progress_bar_set_fraction(pbar:PGtkProgressBar; fraction:gdouble); cdecl; external gtklib; 99procedure gtk_progress_bar_set_pulse_step(pbar:PGtkProgressBar; fraction:gdouble); cdecl; external gtklib; 100procedure gtk_progress_bar_set_orientation(pbar:PGtkProgressBar; orientation:TGtkProgressBarOrientation); cdecl; external gtklib; 101function gtk_progress_bar_get_text(pbar:PGtkProgressBar):Pgchar; cdecl; external gtklib; 102function gtk_progress_bar_get_fraction(pbar:PGtkProgressBar):gdouble; cdecl; external gtklib; 103function gtk_progress_bar_get_pulse_step(pbar:PGtkProgressBar):gdouble; cdecl; external gtklib; 104function gtk_progress_bar_get_orientation(pbar:PGtkProgressBar):TGtkProgressBarOrientation; cdecl; external gtklib; 105 106{$ifndef GTK_DISABLE_DEPRECATED} 107function gtk_progress_bar_new_with_adjustment(adjustment:PGtkAdjustment):PGtkWidget; cdecl; external gtklib; 108procedure gtk_progress_bar_set_bar_style(pbar:PGtkProgressBar; style:TGtkProgressBarStyle); cdecl; external gtklib; 109procedure gtk_progress_bar_set_discrete_blocks(pbar:PGtkProgressBar; blocks:guint); cdecl; external gtklib; 110procedure gtk_progress_bar_set_activity_step(pbar:PGtkProgressBar; step:guint); cdecl; external gtklib; 111procedure gtk_progress_bar_set_activity_blocks(pbar:PGtkProgressBar; blocks:guint); cdecl; external gtklib; 112procedure gtk_progress_bar_update(pbar:PGtkProgressBar; percentage:gdouble); cdecl; external gtklib; 113{$endif} 114 115{$ifdef HasGTK2_6} 116function gtk_progress_bar_get_ellipsize(pbar:PGtkProgressBar):TPangoEllipsizeMode; cdecl; external gtklib; 117procedure gtk_progress_bar_set_ellipsize(pbar:PGtkProgressBar; mode:TPangoEllipsizeMode); cdecl; external gtklib; 118{$endif} 119 120{$ENDIF read_interface_rest} 121 122//------------------------------------------------------------------------------ 123 124{$IFDEF read_implementation} 125function GTK_TYPE_PROGRESS_BAR : GType; 126begin 127 GTK_TYPE_PROGRESS_BAR:=gtk_progress_bar_get_type; 128end; 129 130function GTK_PROGRESS_BAR(obj: pointer) : PGtkProgressBar; 131begin 132 GTK_PROGRESS_BAR:=PGtkProgressBar(GTK_CHECK_CAST(obj,GTK_TYPE_PROGRESS_BAR)); 133end; 134 135function GTK_PROGRESS_BAR_CLASS(klass: pointer) : PGtkProgressBarClass; 136begin 137 GTK_PROGRESS_BAR_CLASS:=PGtkProgressBarClass(GTK_CHECK_CLASS_CAST(klass,GTK_TYPE_PROGRESS_BAR)); 138end; 139 140function GTK_IS_PROGRESS_BAR(obj: pointer) : boolean; 141begin 142 GTK_IS_PROGRESS_BAR:=GTK_CHECK_TYPE(obj,GTK_TYPE_PROGRESS_BAR); 143end; 144 145function GTK_IS_PROGRESS_BAR_CLASS(klass: pointer) : boolean; 146begin 147 GTK_IS_PROGRESS_BAR_CLASS:=GTK_CHECK_CLASS_TYPE(klass,GTK_TYPE_PROGRESS_BAR); 148end; 149 150function GTK_PROGRESS_BAR_GET_CLASS(obj: pointer) : PGtkProgressBarClass; 151begin 152 GTK_PROGRESS_BAR_GET_CLASS:=PGtkProgressBarClass(GTK_CHECK_GET_CLASS(obj,GTK_TYPE_PROGRESS_BAR)); 153end; 154 155function activity_dir(var a : TGtkProgressBar) : guint; 156begin 157 activity_dir:=(a.flag0 and bm_TGtkProgressBar_activity_dir) shr bp_TGtkProgressBar_activity_dir; 158end; 159 160procedure set_activity_dir(var a : TGtkProgressBar; __activity_dir : guint); 161begin 162 a.flag0:=a.flag0 or ((__activity_dir shl bp_TGtkProgressBar_activity_dir) and bm_TGtkProgressBar_activity_dir); 163end; 164 165{$ENDIF read_implementation} 166// included by gtk2.pas 167 168