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

« back to all changes in this revision

Viewing changes to lcl/interfaces/gtk2/gtk2wschecklst.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: gtk2wschecklst.pp 26012 2010-06-09 23:01:52Z marc $}
 
1
{ $Id: gtk2wschecklst.pp 36862 2012-04-17 07:55:52Z zeljko $}
2
2
{
3
3
 *****************************************************************************
4
4
 *                             Gtk2WSCheckLst.pp                             * 
37
37
////////////////////////////////////////////////////
38
38
  CheckLst, StdCtrls, Controls, LCLType, SysUtils, Classes, LMessages, LCLProc,
39
39
////////////////////////////////////////////////////
40
 
  WSCheckLst, WSLCLClasses,
41
 
  Gtk2WSStdCtrls;
 
40
  WSCheckLst, WSLCLClasses;
42
41
 
43
42
type
44
43
 
74
73
 
75
74
{ TGtk2WSCheckListBox }
76
75
 
77
 
procedure Gtk2WS_CheckListBoxDataFunc(tree_column: PGtkTreeViewColumn;
78
 
  cell: PGtkCellRenderer; tree_model: PGtkTreeModel; iter: PGtkTreeIter; data: Pointer); cdecl;
 
76
procedure Gtk2WS_CheckListBoxDataFunc({%H-}tree_column: PGtkTreeViewColumn;
 
77
  cell: PGtkCellRenderer; tree_model: PGtkTreeModel; iter: PGtkTreeIter; {%H-}data: Pointer); cdecl;
79
78
var
80
79
  b: byte;
81
80
  ADisabled: gboolean;
91
90
  g_object_set(cell, 'activatable', [gboolean(not ADisabled), nil]);
92
91
end;
93
92
 
94
 
procedure Gtk2WS_CheckListBoxToggle(cellrenderertoggle : PGtkCellRendererToggle;
 
93
procedure Gtk2WS_CheckListBoxToggle({%H-}cellrenderertoggle : PGtkCellRendererToggle;
95
94
  arg1 : PGChar; WidgetInfo: PWidgetInfo); cdecl;
96
95
var
97
96
  Mess: TLMessage;
 
97
  Param: PtrInt;
 
98
  Iter : TGtkTreeIter;
 
99
  TreeView: PGtkTreeView;
 
100
  ListStore: PGtkTreeModel;
 
101
  Path: PGtkTreePath;
 
102
  AState: TCheckBoxState;
98
103
begin
99
104
  {$IFDEF EventTrace}
100
105
  EventTrace('Gtk2WS_CheckListBoxToggle', WidgetInfo^.LCLObject);
101
106
  {$ENDIF}
102
 
  TCheckListBox(widgetInfo^.lclObject).Toggle(StrToInt(arg1));
 
107
  Val(arg1, Param);
 
108
 
 
109
  TreeView := PGtkTreeView(WidgetInfo^.CoreWidget);
 
110
  ListStore := gtk_tree_view_get_model(TreeView);
 
111
 
 
112
  if gtk_tree_model_iter_nth_child(ListStore, @Iter, nil, Param) then
 
113
    begin
 
114
      TCustomCheckListBox(WidgetInfo^.LCLObject).Toggle(Param);
 
115
      AState:=TCustomCheckListBox(WidgetInfo^.LCLObject).State[Param];
 
116
 
 
117
      gtk_list_store_set(ListStore, @Iter, [gtk2CLBState,
 
118
        Byte(AState), -1]);
 
119
    end;
 
120
 
 
121
 
 
122
  Path := gtk_tree_path_new_from_indices(Param, -1);
 
123
  if Path <> nil then
 
124
  begin
 
125
    if TreeView^.priv^.tree <> nil then
 
126
      gtk_tree_view_set_cursor(TreeView, Path, nil, False);
 
127
    gtk_tree_path_free(Path);
 
128
  end;
 
129
 
 
130
  FillChar(Mess{%H-}, SizeOf(Mess), #0);
103
131
  Mess.Msg := LM_CHANGED;
104
 
  Val(arg1, Mess.WParam);
 
132
 
105
133
  Mess.Result := 0;
 
134
  Mess.WParam := Param;
106
135
  DeliverMessage(widgetInfo^.lclObject, Mess);
107
 
end;
108
136
 
109
 
procedure Gtk2WS_CheckListBoxRowActivate(treeview : PGtkTreeView;
110
 
  arg1 : PGtkTreePath; arg2 : PGtkTreeViewColumn; WidgetInfo: PWidgetInfo); cdecl;
111
 
var
112
 
  APathStr: Pgchar;
113
 
  AIndex: Integer;
114
 
begin
115
 
  APathStr := gtk_tree_path_to_string(arg1);
116
 
  AIndex := StrToInt(APathStr);
117
 
  g_free(APathStr);
118
 
  if TCheckListBox(widgetInfo^.lclObject).ItemEnabled[AIndex] then
119
 
    TCheckListBox(widgetInfo^.lclObject).Toggle(AIndex);
120
137
end;
121
138
 
122
139
class procedure TGtk2WSCustomCheckListBox.SetCallbacks(const AGtkWidget: PGtkWidget;
142
159
  WidgetInfo: PWidgetInfo;
143
160
begin
144
161
  Result := TGtk2WSBaseScrollingWinControl.CreateHandle(AWinControl,AParams);
145
 
  p := PGtkWidget(Result);
 
162
  p := {%H-}PGtkWidget(Result);
146
163
 
147
164
  if Result = 0 then exit;
148
165
 
176
193
  gtk_tree_view_column_set_clickable(GTK_TREE_VIEW_COLUMN(column), True);
177
194
 
178
195
  SignalConnect(PGtkWidget(renderer), 'toggled', @Gtk2WS_CheckListBoxToggle, WidgetInfo);
179
 
  // don't toggle on double-click
180
 
  //SignalConnect(TreeViewWidget, 'row_activated', @Gtk2WS_CheckListBoxRowActivate, WidgetInfo);
181
 
 
182
 
  //g_signal_connect (renderer, 'toggled', G_CALLBACK (@gtk_clb_toggle), AWinControl);
183
 
  //g_signal_connect (TreeViewWidget, 'row_activated', G_CALLBACK (@gtk_clb_toggle_row_activated), AWinControl);
184
196
 
185
197
  // Text Column
186
198
  renderer := gtk_cell_renderer_text_new();
218
230
  Disabled: gboolean;
219
231
begin
220
232
  Result := True;
221
 
  WidgetInfo := GetWidgetInfo(PGtkWidget(ACheckListBox.Handle));
 
233
  WidgetInfo := GetWidgetInfo({%H-}PGtkWidget(ACheckListBox.Handle));
222
234
 
223
235
  TreeView := PGtkTreeView(WidgetInfo^.CoreWidget);
224
236
  ListStore := gtk_tree_view_get_model(TreeView);
240
252
  b: byte;
241
253
begin
242
254
  Result := cbUnchecked;
243
 
  WidgetInfo := GetWidgetInfo(PGtkWidget(ACheckListBox.Handle));
 
255
  WidgetInfo := GetWidgetInfo({%H-}PGtkWidget(ACheckListBox.Handle));
244
256
 
245
257
  TreeView := PGtkTreeView(WidgetInfo^.CoreWidget);
246
258
  ListStore := gtk_tree_view_get_model(TreeView);
261
273
  ListStore: PGtkTreeModel;
262
274
  Disabled: gboolean;
263
275
begin
264
 
  WidgetInfo := GetWidgetInfo(PGtkWidget(ACheckListBox.Handle));
 
276
  WidgetInfo := GetWidgetInfo({%H-}PGtkWidget(ACheckListBox.Handle));
265
277
 
266
278
  TreeView := PGtkTreeView(WidgetInfo^.CoreWidget);
267
279
  ListStore := gtk_tree_view_get_model(TreeView);
280
292
  WidgetInfo: PWidgetInfo;
281
293
  ListStore: PGtkTreeModel;
282
294
begin
283
 
  WidgetInfo := GetWidgetInfo(PGtkWidget(ACheckListBox.Handle));
 
295
  WidgetInfo := GetWidgetInfo({%H-}PGtkWidget(ACheckListBox.Handle));
284
296
 
285
297
  TreeView := PGtkTreeView(WidgetInfo^.CoreWidget);
286
298
  ListStore := gtk_tree_view_get_model(TreeView);