2
0

gtkbutton.pp 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. {
  2. }
  3. {****************************************************************************
  4. Interface
  5. ****************************************************************************}
  6. {$ifdef read_interface}
  7. type
  8. PGtkButton = ^TGtkButton;
  9. TGtkButton = record
  10. bin : TGtkBin;
  11. child : PGtkWidget;
  12. flag0 : {$ifdef win32}longint{$else}word{$endif};
  13. end;
  14. const
  15. bm_in_button = 1;
  16. bp_in_button = 0;
  17. bm_button_down = 2;
  18. bp_button_down = 1;
  19. bm_relief = 4;
  20. bp_relief = 2;
  21. function in_button(var a : TGtkButton) : guint;
  22. procedure set_in_button(var a : TGtkButton; __in_button : guint);
  23. function button_down(var a : TGtkButton) : guint;
  24. procedure set_button_down(var a : TGtkButton; __button_down : guint);
  25. function relief(var a : TGtkButton) : guint;
  26. procedure set_relief(var a : TGtkButton; __button_down : guint);
  27. type
  28. PGtkButtonClass = ^TGtkButtonClass;
  29. TGtkButtonClass = record
  30. parent_class : TGtkBinClass;
  31. pressed : procedure (button:PGtkButton); cdecl;
  32. released : procedure (button:PGtkButton); cdecl;
  33. clicked : procedure (button:PGtkButton); cdecl;
  34. enter : procedure (button:PGtkButton); cdecl;
  35. leave : procedure (button:PGtkButton); cdecl;
  36. end;
  37. Type
  38. GTK_BUTTON=PGtkButton;
  39. GTK_BUTTON_CLASS=PGtkButtonClass;
  40. function GTK_BUTTON_TYPE:TGtkType;cdecl;external gtkdll name 'gtk_button_get_type';
  41. function GTK_IS_BUTTON(obj:pointer):boolean;
  42. function GTK_IS_BUTTON_CLASS(klass:pointer):boolean;
  43. function gtk_button_get_type:TGtkType;cdecl;external gtkdll name 'gtk_button_get_type';
  44. function gtk_button_new : PGtkWidget;cdecl;external gtkdll name 'gtk_button_new';
  45. function gtk_button_new_with_label (thelabel:Pgchar):PGtkWidget;cdecl;external gtkdll name 'gtk_button_new_with_label';
  46. procedure gtk_button_pressed(button:PGtkButton);cdecl;external gtkdll name 'gtk_button_pressed';
  47. procedure gtk_button_released(button:PGtkButton);cdecl;external gtkdll name 'gtk_button_released';
  48. procedure gtk_button_clicked(button:PGtkButton);cdecl;external gtkdll name 'gtk_button_clicked';
  49. procedure gtk_button_enter(button:PGtkButton);cdecl;external gtkdll name 'gtk_button_enter';
  50. procedure gtk_button_leave(button:PGtkButton);cdecl;external gtkdll name 'gtk_button_leave';
  51. procedure gtk_button_set_relief(button:PGtkButton; newstyle:TGtkReliefStyle);cdecl;external gtkdll name 'gtk_button_set_relief';
  52. function gtk_button_get_relief(button:PGtkButton):TGtkReliefStyle;cdecl;external gtkdll name 'gtk_button_get_relief';
  53. {$endif read_interface}
  54. {****************************************************************************
  55. Implementation
  56. ****************************************************************************}
  57. {$ifdef read_implementation}
  58. function in_button(var a : TGtkButton) : guint;
  59. begin
  60. in_button:=(a.flag0 and bm_in_button) shr bp_in_button;
  61. end;
  62. procedure set_in_button(var a : TGtkButton; __in_button : guint);
  63. begin
  64. a.flag0:=a.flag0 or ((__in_button shl bp_in_button) and bm_in_button);
  65. end;
  66. function button_down(var a : TGtkButton) : guint;
  67. begin
  68. button_down:=(a.flag0 and bm_button_down) shr bp_button_down;
  69. end;
  70. procedure set_button_down(var a : TGtkButton; __button_down : guint);
  71. begin
  72. a.flag0:=a.flag0 or ((__button_down shl bp_button_down) and bm_button_down);
  73. end;
  74. function relief(var a : TGtkButton) : guint;
  75. begin
  76. relief:=(a.flag0 and bm_relief) shr bp_relief;
  77. end;
  78. procedure set_relief(var a : TGtkButton; __button_down : guint);
  79. begin
  80. a.flag0:=a.flag0 or ((__button_down shl bp_relief) and bm_relief);
  81. end;
  82. function GTK_IS_BUTTON(obj:pointer):boolean;
  83. begin
  84. GTK_IS_BUTTON:=(obj<>nil) and GTK_IS_BUTTON_CLASS(PGtkTypeObject(obj)^.klass);
  85. end;
  86. function GTK_IS_BUTTON_CLASS(klass:pointer):boolean;
  87. begin
  88. GTK_IS_BUTTON_CLASS:=(klass<>nil) and (PGtkTypeClass(klass)^.thetype=GTK_BUTTON_TYPE);
  89. end;
  90. {$endif read_implementation}