~ubuntu-branches/ubuntu/saucy/lazarus/saucy

« back to all changes in this revision

Viewing changes to lcl/interfaces/gtk2/gtk2wsbuttons.pp

  • Committer: Package Import Robot
  • Author(s): Paul Gevers, Abou Al Montacir, Bart Martens, Paul Gevers
  • Date: 2013-06-08 14:12:17 UTC
  • mfrom: (1.1.9)
  • Revision ID: package-import@ubuntu.com-20130608141217-7k0cy9id8ifcnutc
Tags: 1.0.8+dfsg-1
[ Abou Al Montacir ]
* New upstream major release and multiple maintenace release offering many
  fixes and new features marking a new milestone for the Lazarus development
  and its stability level.
  - The detailed list of changes can be found here:
    http://wiki.lazarus.freepascal.org/Lazarus_1.0_release_notes
    http://wiki.lazarus.freepascal.org/Lazarus_1.0_fixes_branch
* LCL changes:
  - LCL is now a normal package.
      + Platform independent parts of the LCL are now in the package LCLBase
      + LCL is automatically recompiled when switching the target platform,
        unless pre-compiled binaries for this target are already installed.
      + No impact on existing projects.
      + Linker options needed by LCL are no more added to projects that do
        not use the LCL package.
  - Minor changes in LCL basic classes behaviour
      + TCustomForm.Create raises an exception if a form resource is not
        found.
      + TNotebook and TPage: a new implementation of these classes was added.
      + TDBNavigator: It is now possible to have focusable buttons by setting
        Options = [navFocusableButtons] and TabStop = True, useful for
        accessibility and for devices with neither mouse nor touch screen.
      + Names of TControlBorderSpacing.GetSideSpace and GetSpace were swapped
        and are now consistent. GetSideSpace = Around + GetSpace.
      + TForm.WindowState=wsFullscreen was added
      + TCanvas.TextFitInfo was added to calculate how many characters will
        fit into a specified Width. Useful for word-wrapping calculations.
      + TControl.GetColorResolvingParent and
        TControl.GetRGBColorResolvingParent were added, simplifying the work
        to obtain the final color of the control while resolving clDefault
        and the ParentColor.
      + LCLIntf.GetTextExtentExPoint now has a good default implementation
        which works in any platform not providing a specific implementation.
        However, Widgetset specific implementation is better, when available.
      + TTabControl was reorganized. Now it has the correct class hierarchy
        and inherits from TCustomTabControl as it should.
  - New unit in the LCL:
      + lazdialogs.pas: adds non-native versions of various native dialogs,
        for example TLazOpenDialog, TLazSaveDialog, TLazSelectDirectoryDialog.
        It is used by widgetsets which either do not have a native dialog, or
        do not wish to use it because it is limited. These dialogs can also be
        used by user applications directly.
      + lazdeviceapis.pas: offers an interface to more hardware devices such
        as the accelerometer, GPS, etc. See LazDeviceAPIs
      + lazcanvas.pas: provides a TFPImageCanvas descendent implementing
        drawing in a LCL-compatible way, but 100% in Pascal.
      + lazregions.pas. LazRegions is a wholly Pascal implementation of
        regions for canvas clipping, event clipping, finding in which control
        of a region tree one an event should reach, for drawing polygons, etc.
      + customdrawncontrols.pas, customdrawndrawers.pas,
        customdrawn_common.pas, customdrawn_android.pas and
        customdrawn_winxp.pas: are the Lazarus Custom Drawn Controls -controls
        which imitate the standard LCL ones, but with the difference that they
        are non-native and support skinning.
  - New APIs added to the LCL to improve support of accessibility software
    such as screen readers.
* IDE changes:
  - Many improvments.
  - The detailed list of changes can be found here:
    http://wiki.lazarus.freepascal.org/New_IDE_features_since#v1.0_.282012-08-29.29
    http://wiki.lazarus.freepascal.org/Lazarus_1.0_release_notes#IDE_Changes
* Debugger / Editor changes:
  - Added pascal sources and breakpoints to the disassembler
  - Added threads dialog.
* Components changes:
  - TAChart: many fixes and new features
  - CodeTool: support Delphi style generics and new syntax extensions.
  - AggPas: removed to honor free licencing. (Closes: Bug#708695)
[Bart Martens]
* New debian/watch file fixing issues with upstream RC release.
[Abou Al Montacir]
* Avoid changing files in .pc hidden directory, these are used by quilt for
  internal purpose and could lead to surprises during build.
[Paul Gevers]
* Updated get-orig-source target and it compinion script orig-tar.sh so that they
  repack the source file, allowing bug 708695 to be fixed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
{ $Id: gtk2wsbuttons.pp 28647 2010-12-08 13:35:07Z blikblum $}
2
1
{
3
2
 *****************************************************************************
4
3
 *                             Gtk2WSButtons.pp                              * 
27
26
interface
28
27
 
29
28
uses
30
 
  glib2, gtk2, gdk2, gdk2pixbuf, Gtk2WSPrivate,
 
29
  glib2, gtk2, gdk2, gdk2pixbuf,
31
30
////////////////////////////////////////////////////
32
31
  LCLType, Controls, Buttons, Graphics, GraphType,
33
32
////////////////////////////////////////////////////
34
33
  WSButtons, WSLCLClasses, WSProc,
35
 
  Gtk2Def, Gtk2Debug;
 
34
  Gtk2Def;
36
35
 
37
36
type
38
37
  PBitBtnWidgetInfo = ^TBitBtnWidgetInfo;
58
57
  published
59
58
    class function  CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
60
59
    class procedure SetGlyph(const ABitBtn: TCustomBitBtn; const AValue: TButtonGlyph); override;
61
 
    class procedure SetLayout(const ABitBtn: TCustomBitBtn; const AValue: TButtonLayout); override;
 
60
    class procedure SetLayout(const ABitBtn: TCustomBitBtn; const {%H-}AValue: TButtonLayout); override;
62
61
    class procedure SetMargin(const ABitBtn: TCustomBitBtn; const AValue: Integer); override;
63
62
    class procedure SetSpacing(const ABitBtn: TCustomBitBtn; const AValue: Integer); override;
64
63
    class procedure SetText(const AWinControl: TWinControl; const AText: String); override;
99
98
  TWinControlAccess = class(TWinControl)
100
99
  end;
101
100
 
102
 
procedure GtkWSBitBtn_StateChanged(AWidget: PGtkWidget; AState: TGtkStateType; AInfo: PWidgetInfo); cdecl;
 
101
procedure GtkWSBitBtn_StateChanged(AWidget: PGtkWidget; {%H-}AState: TGtkStateType; AInfo: PWidgetInfo); cdecl;
103
102
var
104
103
  BitBtn: TCustomBitBtnAccess;
105
104
begin
195
194
  BitBtnInfo: PBitBtnWidgetInfo;
196
195
  Allocation: TGTKAllocation;
197
196
begin
198
 
  Result := TLCLIntfHandle(PtrUInt(gtk_button_new));
 
197
  Result := TLCLIntfHandle({%H-}PtrUInt(gtk_button_new));
199
198
  if Result = 0 then Exit;
200
199
  {$IFDEF DebugLCLComponents}
201
200
  DebugGtkWidgets.MarkCreated(Pointer(Result),dbgsName(AWinControl));
202
201
  {$ENDIF}
203
202
 
204
 
  WidgetInfo := CreateWidgetInfo(Pointer(Result), BitBtn, AParams);
 
203
  WidgetInfo := CreateWidgetInfo({%H-}Pointer(Result), BitBtn, AParams);
205
204
 
206
205
  New(BitBtnInfo);
207
206
  FillChar(BitBtnInfo^, SizeOf(BitBtnInfo^), 0);
208
207
  WidgetInfo^.UserData := BitBtnInfo;
209
208
  WidgetInfo^.DataOwner := True;
210
209
 
211
 
  gtk_widget_show(PGtkWidget(Result));
 
210
  gtk_widget_show({%H-}PGtkWidget(Result));
212
211
 
213
212
  Allocation.X := AParams.X;
214
213
  Allocation.Y := AParams.Y;
215
214
  Allocation.Width := AParams.Width;
216
215
  Allocation.Height := AParams.Height;
217
 
  gtk_widget_size_allocate(PGtkWidget(Result), @Allocation);
 
216
  gtk_widget_size_allocate({%H-}PGtkWidget(Result), @Allocation);
218
217
 
219
 
  Set_RC_Name(AWinControl, PGtkWidget(Result));
220
 
  SetCallbacks(PGtkWidget(Result), WidgetInfo);
 
218
  Set_RC_Name(AWinControl, {%H-}PGtkWidget(Result));
 
219
  SetCallbacks({%H-}PGtkWidget(Result), WidgetInfo);
221
220
end;
222
221
 
223
222
class procedure TGtk2WSBitBtn.SetGlyph(const ABitBtn: TCustomBitBtn;
230
229
begin
231
230
  if not WSCheckHandleAllocated(ABitBtn, 'SetGlyph') then
232
231
    Exit;
233
 
  MainWidget := PGtkWidget(ABitBtn.Handle);
 
232
  MainWidget := {%H-}PGtkWidget(ABitBtn.Handle);
234
233
  WidgetInfo := GetWidgetInfo(MainWidget);
235
234
  BitBtnInfo := WidgetInfo^.UserData;
236
235
  BuildNeeded := UpdateGlyph(ABitBtn, BitBtnInfo, AValue, GtkStateToButtonState[GTK_WIDGET_STATE(MainWidget)]);
237
236
  // at initialization widget will be built in SetLayout
238
 
  if not (wcfInitializing in TWinControlAccess(ABitBtn).FWinControlFlags) and BuildNeeded then
 
237
  if not (wcfInitializing in {%H-}TWinControlAccess(ABitBtn).FWinControlFlags) and BuildNeeded then
239
238
    BuildWidget(ABitBtn, MainWidget, BitBtnInfo, ABitBtn.Caption);
240
239
end;
241
240
 
248
247
begin
249
248
  if not WSCheckHandleAllocated(ABitBtn, 'SetLayout') then
250
249
    Exit;
251
 
  MainWidget := Pointer(ABitBtn.Handle);
 
250
  MainWidget := {%H-}Pointer(ABitBtn.Handle);
252
251
  WidgetInfo := GetWidgetInfo(MainWidget);
253
252
  BitBtnInfo := WidgetInfo^.UserData;
254
253
  BuildWidget(ABitBtn, MainWidget, BitBtnInfo, ABitBtn.Caption);
262
261
begin
263
262
  if not WSCheckHandleAllocated(ABitBtn, 'SetMargin') then
264
263
    Exit;
265
 
  MainWidget := PGtkWidget(ABitBtn.Handle);
 
264
  MainWidget := {%H-}PGtkWidget(ABitBtn.Handle);
266
265
  AlignWidget := PGtkAlignment(gtk_bin_get_child(PGtkBin(MainWidget)));
267
266
  if GTK_IS_ALIGNMENT(AlignWidget) then
268
267
    UpdateMargin(ABitBtn, AlignWidget, AValue);
276
275
begin
277
276
  if not WSCheckHandleAllocated(ABitBtn, 'SetSpacing') then
278
277
    Exit;
279
 
  MainWidget := Pointer(ABitBtn.Handle);
 
278
  MainWidget := {%H-}Pointer(ABitBtn.Handle);
280
279
  ChildWidget := gtk_bin_get_child(PGtkBin(MainWidget));
281
280
  if GTK_IS_ALIGNMENT(ChildWidget) then
282
281
  begin
299
298
  if (wcfInitializing in TWinControlAccess(AWinControl).FWinControlFlags)
300
299
    or not WSCheckHandleAllocated(AWincontrol, 'SetText') then
301
300
    Exit;
302
 
  MainWidget := Pointer(AWinControl.Handle);
 
301
  MainWidget := {%H-}Pointer(AWinControl.Handle);
303
302
  WidgetInfo := GetWidgetInfo(MainWidget);
304
303
  BitBtnInfo := WidgetInfo^.UserData;
305
304
  LabelWidget := BitBtnInfo^.LabelWidget;
318
317
  Widget: PGTKWidget;
319
318
begin
320
319
  if not AWinControl.HandleAllocated then exit;
321
 
  Widget:= PGtkWidget(AWinControl.Handle);
 
320
  Widget:= {%H-}PGtkWidget(AWinControl.Handle);
322
321
  Gtk2WidgetSet.SetWidgetColor(Widget, clNone, AWinControl.color,
323
322
     [GTK_STATE_NORMAL,GTK_STATE_ACTIVE,GTK_STATE_PRELIGHT,GTK_STATE_SELECTED]);
324
323
end;
332
331
begin
333
332
  if not AWinControl.HandleAllocated then exit;
334
333
 
335
 
  WidgetInfo := GetWidgetInfo(PGtkWidget(AWinControl.Handle));
 
334
  WidgetInfo := GetWidgetInfo({%H-}PGtkWidget(AWinControl.Handle));
336
335
  BitBtnInfo := WidgetInfo^.UserData;
337
336
  LabelWidget := BitBtnInfo^.LabelWidget;
338
337
  if LabelWidget <> nil then
428
427
  Pixbuf: PGdkPixbuf;
429
428
  Mask: PGdkBitmap;
430
429
begin
431
 
  GDIObject := PGDIObject(Bitmap.Handle);
 
430
  GDIObject := {%H-}PGDIObject(Bitmap.Handle);
432
431
  Mask := nil;
433
432
  Pixbuf := nil;
434
433
  if GDIObject^.GDIBitmapType = gbPixbuf then