mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-17 02:49:30 +02:00
Separates CheckBox on gtk2 and further removes clistbox.
git-svn-id: trunk@14179 -
This commit is contained in:
parent
fa1810d49d
commit
2c82246914
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -2973,7 +2973,6 @@ lcl/interfaces/fpgui/fpguiwsarrow.pp svneol=native#text/pascal
|
||||
lcl/interfaces/fpgui/fpguiwsbuttons.pp svneol=native#text/pascal
|
||||
lcl/interfaces/fpgui/fpguiwscalendar.pp svneol=native#text/pascal
|
||||
lcl/interfaces/fpgui/fpguiwschecklst.pp svneol=native#text/pascal
|
||||
lcl/interfaces/fpgui/fpguiwsclistbox.pp svneol=native#text/pascal
|
||||
lcl/interfaces/fpgui/fpguiwscomctrls.pp svneol=native#text/pascal
|
||||
lcl/interfaces/fpgui/fpguiwscontrols.pp svneol=native#text/pascal
|
||||
lcl/interfaces/fpgui/fpguiwsdbctrls.pp svneol=native#text/pascal
|
||||
@ -3098,7 +3097,6 @@ lcl/interfaces/gtk2/gtk2wsarrow.pp svneol=native#text/pascal
|
||||
lcl/interfaces/gtk2/gtk2wsbuttons.pp svneol=native#text/pascal
|
||||
lcl/interfaces/gtk2/gtk2wscalendar.pp svneol=native#text/pascal
|
||||
lcl/interfaces/gtk2/gtk2wschecklst.pp svneol=native#text/pascal
|
||||
lcl/interfaces/gtk2/gtk2wsclistbox.pp svneol=native#text/pascal
|
||||
lcl/interfaces/gtk2/gtk2wscomctrls.pp svneol=native#text/pascal
|
||||
lcl/interfaces/gtk2/gtk2wscontrols.pp svneol=native#text/pascal
|
||||
lcl/interfaces/gtk2/gtk2wscustomlistview.inc svneol=native#text/pascal
|
||||
|
@ -105,7 +105,6 @@ uses
|
||||
FpGuiWSButtons,
|
||||
// FpGuiWSCalendar,
|
||||
// FpGuiWSCheckLst,
|
||||
// FpGuiWSCListBox,
|
||||
// FpGuiWSComCtrls,
|
||||
FpGuiWSControls,
|
||||
// FpGuiWSDbCtrls,
|
||||
|
@ -1,63 +0,0 @@
|
||||
{ $Id: FpGuiwsclistbox.pp 5319 2004-03-17 20:11:29Z marc $}
|
||||
{
|
||||
*****************************************************************************
|
||||
* FpGuiWSCListBox.pp *
|
||||
* --------------- *
|
||||
* *
|
||||
* *
|
||||
*****************************************************************************
|
||||
|
||||
*****************************************************************************
|
||||
* *
|
||||
* This file is part of the Lazarus Component Library (LCL) *
|
||||
* *
|
||||
* See the file COPYING.LCL, included in this distribution, *
|
||||
* for details about the copyright. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* *
|
||||
*****************************************************************************
|
||||
}
|
||||
unit FpGuiWSCListBox;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
////////////////////////////////////////////////////
|
||||
// I M P O R T A N T
|
||||
////////////////////////////////////////////////////
|
||||
// To get as little as posible circles,
|
||||
// uncomment only when needed for registration
|
||||
////////////////////////////////////////////////////
|
||||
// CListBox,
|
||||
////////////////////////////////////////////////////
|
||||
WSCListBox, WSLCLClasses;
|
||||
|
||||
type
|
||||
|
||||
{ TFpGuiWSCListBox }
|
||||
|
||||
TFpGuiWSCListBox = class(TWSCListBox)
|
||||
private
|
||||
protected
|
||||
public
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
initialization
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// I M P O R T A N T
|
||||
////////////////////////////////////////////////////
|
||||
// To improve speed, register only classes
|
||||
// which actually implement something
|
||||
////////////////////////////////////////////////////
|
||||
// RegisterWSComponent(TCListBox, TFpGuiWSCListBox);
|
||||
////////////////////////////////////////////////////
|
||||
end.
|
@ -2756,11 +2756,6 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TGtkWidgetSet.SetSelectionMode(Sender: TObject; Widget: PGtkWidget;
|
||||
MultiSelect, ExtendedSelect: boolean);
|
||||
{$IFdef GTK2}
|
||||
begin
|
||||
DebugLn('TODO: TGtkWidgetSet.SetSelectionMode');
|
||||
end;
|
||||
{$Else}
|
||||
var
|
||||
AControl: TWinControl;
|
||||
SelectionMode: TGtkSelectionMode;
|
||||
@ -2768,7 +2763,7 @@ var
|
||||
begin
|
||||
AControl:=TWinControl(Sender);
|
||||
if (AControl is TWinControl) and
|
||||
(AControl.fCompStyle in [csListBox, csCheckListBox, csCListBox]) then
|
||||
(AControl.fCompStyle in [csListBox, csCheckListBox]) then
|
||||
begin
|
||||
if MultiSelect then
|
||||
begin
|
||||
@ -2776,26 +2771,18 @@ begin
|
||||
then SelectionMode:= GTK_SELECTION_EXTENDED
|
||||
else SelectionMode:= GTK_SELECTION_MULTIPLE;
|
||||
end
|
||||
else begin
|
||||
else
|
||||
begin
|
||||
SelectionMode:= GTK_SELECTION_BROWSE;
|
||||
end;
|
||||
case AControl.fCompStyle of
|
||||
|
||||
csListBox, csCheckListBox:
|
||||
begin
|
||||
GtkList:=PGtkList(GetWidgetInfo(Widget, True)^.CoreWidget);
|
||||
if (GtkList^.selection=nil)
|
||||
and (SelectionMode=GTK_SELECTION_BROWSE) then
|
||||
SelectionMode:=GTK_SELECTION_SINGLE;
|
||||
gtk_list_set_selection_mode(GtkList,SelectionMode);
|
||||
end;
|
||||
|
||||
else
|
||||
Assert (true, 'WARNING:[TGtkWidgetSet.IntSendMessage3] usage of LM_SETSELMODE unimplemented for actual component');
|
||||
end;
|
||||
GtkList:=PGtkList(GetWidgetInfo(Widget, True)^.CoreWidget);
|
||||
if (GtkList^.selection=nil)
|
||||
and (SelectionMode=GTK_SELECTION_BROWSE) then
|
||||
SelectionMode:=GTK_SELECTION_SINGLE;
|
||||
gtk_list_set_selection_mode(GtkList,SelectionMode);
|
||||
end;
|
||||
end;
|
||||
{$EndIf}
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
procedure TGtkWidgetSet.BringFormToFront(Sender: TObject);
|
||||
|
@ -289,6 +289,7 @@ type
|
||||
protected
|
||||
class procedure SetCallbacks(const AGtkWidget: PGtkWidget; const AWidgetInfo: PWidgetInfo); virtual;
|
||||
public
|
||||
{$IFDEF GTK1}
|
||||
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
|
||||
class function RetrieveState(const ACustomCheckBox: TCustomCheckBox
|
||||
): TCheckBoxState; override;
|
||||
@ -300,7 +301,7 @@ type
|
||||
var PreferredWidth, PreferredHeight: integer;
|
||||
WithThemeSpace: Boolean); override;
|
||||
class procedure SetFont(const AWinControl: TWinControl; const AFont : tFont); override;
|
||||
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{ TGtkWSCheckBox }
|
||||
@ -1499,6 +1500,8 @@ begin
|
||||
TGtkWidgetset(WidgetSet).SetCallback(LM_CHANGED, PGtkObject(AGtkWidget), AWidgetInfo^.LCLObject);
|
||||
end;
|
||||
|
||||
{$IFDEF Gtk1}
|
||||
|
||||
class function TGtkWSCustomCheckBox.CreateHandle(
|
||||
const AWinControl: TWinControl; const AParams: TCreateParams
|
||||
): TLCLIntfHandle;
|
||||
@ -1542,10 +1545,8 @@ class procedure TGtkWSCustomCheckBox.SetShortCut(
|
||||
const ACustomCheckBox: TCustomCheckBox;
|
||||
const OldShortCut, NewShortCut: TShortCut);
|
||||
begin
|
||||
{$IFDEF Gtk1}
|
||||
Accelerate(ACustomCheckBox, PGtkWidget(ACustomCheckBox.Handle), NewShortcut,
|
||||
'activate_item');
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
class procedure TGtkWSCustomCheckBox.SetState(const ACB: TCustomCheckBox;
|
||||
@ -1593,6 +1594,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{$ENDIF}
|
||||
|
||||
{ TGtkWSCustomMemo }
|
||||
|
||||
|
@ -47,7 +47,7 @@ uses
|
||||
DynHashArray, GraphType, GraphMath, Graphics, Menus,
|
||||
GtkWSControls, GTKWinApiWindow, StdCtrls, ComCtrls,
|
||||
Dialogs, ExtDlgs, Themes, LResources, Math, GTKGlobals,
|
||||
{Buttons, CListBox, Calendar, Arrow, Spin, FileCtrl, CommCtrl, ExtCtrls, }
|
||||
{Buttons, Calendar, Arrow, Spin, FileCtrl, CommCtrl, ExtCtrls, }
|
||||
GtkDef, Gtk2Def, GtkFontCache, GtkInt, GtkExtra;
|
||||
|
||||
type
|
||||
@ -146,7 +146,6 @@ uses
|
||||
// Gtk2WSButtons,
|
||||
// Gtk2WSCalendar,
|
||||
Gtk2WSCheckLst,
|
||||
// Gtk2WSCListBox,
|
||||
Gtk2WSComCtrls,
|
||||
Gtk2WSControls,
|
||||
// Gtk2WSDbCtrls,
|
||||
|
@ -451,24 +451,16 @@ var
|
||||
begin
|
||||
AControl:=TWinControl(Sender);
|
||||
if (AControl is TWinControl) and
|
||||
(AControl.fCompStyle in [csListBox, csCheckListBox, csCListBox]) then
|
||||
(AControl.fCompStyle in [csListBox, csCheckListBox]) then
|
||||
begin
|
||||
if MultiSelect then
|
||||
SelectionMode:= GTK_SELECTION_MULTIPLE
|
||||
else
|
||||
SelectionMode:= GTK_SELECTION_SINGLE;
|
||||
|
||||
case AControl.fCompStyle of
|
||||
|
||||
csListBox, csCheckListBox:
|
||||
begin
|
||||
Selection := gtk_tree_view_get_selection(GTK_TREE_VIEW(
|
||||
GetWidgetInfo(Widget, True)^.CoreWidget));
|
||||
gtk_tree_selection_set_mode(Selection, SelectionMode);
|
||||
end;
|
||||
else
|
||||
inherited SetSelectionMode(Sender, Widget, MultiSelect, ExtendedSelect);
|
||||
end;
|
||||
Selection := gtk_tree_view_get_selection(GTK_TREE_VIEW(
|
||||
GetWidgetInfo(Widget, True)^.CoreWidget));
|
||||
gtk_tree_selection_set_mode(Selection, SelectionMode);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -1,63 +0,0 @@
|
||||
{ $Id$}
|
||||
{
|
||||
*****************************************************************************
|
||||
* Gtk2WSCListBox.pp *
|
||||
* ----------------- *
|
||||
* *
|
||||
* *
|
||||
*****************************************************************************
|
||||
|
||||
*****************************************************************************
|
||||
* *
|
||||
* This file is part of the Lazarus Component Library (LCL) *
|
||||
* *
|
||||
* See the file COPYING.modifiedLGPL, included in this distribution, *
|
||||
* for details about the copyright. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* *
|
||||
*****************************************************************************
|
||||
}
|
||||
unit Gtk2WSCListBox;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
////////////////////////////////////////////////////
|
||||
// I M P O R T A N T
|
||||
////////////////////////////////////////////////////
|
||||
// To get as little as posible circles,
|
||||
// uncomment only when needed for registration
|
||||
////////////////////////////////////////////////////
|
||||
// CListBox,
|
||||
////////////////////////////////////////////////////
|
||||
WSCListBox, WSLCLClasses;
|
||||
|
||||
type
|
||||
|
||||
{ TGtk2WSCListBox }
|
||||
|
||||
TGtk2WSCListBox = class(TWSCListBox)
|
||||
private
|
||||
protected
|
||||
public
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
initialization
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// I M P O R T A N T
|
||||
////////////////////////////////////////////////////
|
||||
// To improve speed, register only classes
|
||||
// which actually implement something
|
||||
////////////////////////////////////////////////////
|
||||
// RegisterWSComponent(TCListBox, TGtk2WSCListBox);
|
||||
////////////////////////////////////////////////////
|
||||
end.
|
@ -282,10 +282,17 @@ type
|
||||
private
|
||||
protected
|
||||
public
|
||||
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
|
||||
class procedure GetPreferredSize(const AWinControl: TWinControl;
|
||||
var PreferredWidth, PreferredHeight: integer;
|
||||
WithThemeSpace: Boolean); override;
|
||||
class function RetrieveState(const ACustomCheckBox: TCustomCheckBox
|
||||
): TCheckBoxState; override;
|
||||
class procedure SetShortCut(const ACustomCheckBox: TCustomCheckBox;
|
||||
const OldShortCut, NewShortCut: TShortCut); override;
|
||||
class procedure SetState(const ACustomCheckBox: TCustomCheckBox;
|
||||
const NewState: TCheckBoxState); override;
|
||||
const NewState: TCheckBoxState); override;
|
||||
class procedure SetFont(const AWinControl: TWinControl; const AFont : tFont); override;
|
||||
end;
|
||||
|
||||
{ TGtk2WSCheckBox }
|
||||
@ -711,6 +718,40 @@ end;
|
||||
|
||||
{ TGtk2WSCustomCheckBox }
|
||||
|
||||
class function TGtk2WSCustomCheckBox.CreateHandle(
|
||||
const AWinControl: TWinControl; const AParams: TCreateParams
|
||||
): TLCLIntfHandle;
|
||||
var
|
||||
Widget: PGtkWidget;
|
||||
WidgetInfo: PWidgetInfo;
|
||||
Allocation: TGTKAllocation;
|
||||
begin
|
||||
{$ToDo verify if the check box has correct z-order and place a EventBox under it if not.}
|
||||
Widget := gtk_check_button_new_with_label(AParams.Caption);
|
||||
{$IFDEF DebugLCLComponents}
|
||||
DebugGtkWidgets.MarkCreated(Widget, dbgsName(AWinControl));
|
||||
{$ENDIF}
|
||||
Result := THandle(PtrUInt(Widget));
|
||||
WidgetInfo := CreateWidgetInfo(Pointer(Result), AWinControl, AParams);
|
||||
|
||||
Allocation.X := AParams.X;
|
||||
Allocation.Y := AParams.Y;
|
||||
Allocation.Width := AParams.Width;
|
||||
Allocation.Height := AParams.Height;
|
||||
gtk_widget_size_allocate(PGtkWidget(Result), @Allocation);
|
||||
|
||||
Set_RC_Name(AWinControl, PGtkWidget(Result));
|
||||
SetCallbacks(PGtkWidget(Result), WidgetInfo);
|
||||
end;
|
||||
|
||||
class procedure TGtk2WSCustomCheckBox.GetPreferredSize(
|
||||
const AWinControl: TWinControl; var PreferredWidth, PreferredHeight: integer;
|
||||
WithThemeSpace: Boolean);
|
||||
begin
|
||||
GetGTKDefaultWidgetSize(AWinControl,PreferredWidth,PreferredHeight,
|
||||
WithThemeSpace);
|
||||
end;
|
||||
|
||||
class function TGtk2WSCustomCheckBox.RetrieveState(
|
||||
const ACustomCheckBox: TCustomCheckBox): TCheckBoxState;
|
||||
var
|
||||
@ -726,6 +767,14 @@ begin
|
||||
Result := cbUnChecked;
|
||||
end;
|
||||
|
||||
class procedure TGtk2WSCustomCheckBox.SetShortCut(
|
||||
const ACustomCheckBox: TCustomCheckBox; const OldShortCut,
|
||||
NewShortCut: TShortCut);
|
||||
begin
|
||||
Accelerate(ACustomCheckBox, PGtkWidget(ACustomCheckBox.Handle), NewShortcut,
|
||||
'activate_item');
|
||||
end;
|
||||
|
||||
class procedure TGtk2WSCustomCheckBox.SetState(
|
||||
const ACustomCheckBox: TCustomCheckBox; const NewState: TCheckBoxState);
|
||||
var
|
||||
@ -741,6 +790,25 @@ begin
|
||||
LockOnChange(GtkObject,-1);
|
||||
end;
|
||||
|
||||
class procedure TGtk2WSCustomCheckBox.SetFont(const AWinControl: TWinControl;
|
||||
const AFont: tFont);
|
||||
var
|
||||
Widget: PGTKWidget;
|
||||
LblWidget: PGtkWidget;
|
||||
begin
|
||||
if not AWinControl.HandleAllocated then exit;
|
||||
if AFont.IsDefault then exit ;
|
||||
|
||||
Widget:= PGtkWidget(AWinControl.Handle);
|
||||
LblWidget := (pGtkBin(Widget)^.Child);
|
||||
|
||||
if LblWidget<>nil then begin
|
||||
Gtk2WidgetSet.SetWidgetColor(LblWidget, AWinControl.font.color, clNone,
|
||||
[GTK_STATE_NORMAL,GTK_STATE_ACTIVE,GTK_STATE_PRELIGHT,GTK_STATE_SELECTED]);
|
||||
Gtk2WidgetSet.SetWidgetFont(LblWidget, AFont);
|
||||
end;
|
||||
end;
|
||||
|
||||
{$I gtk2wscustommemo.inc}
|
||||
|
||||
{ TGtk2WSCustomEdit }
|
||||
|
@ -238,7 +238,6 @@ Uses
|
||||
WinCEWSButtons,
|
||||
// WinCEWSCalendar,
|
||||
WinCEWSCheckLst,
|
||||
// WinCEWSCListBox,
|
||||
WinCEWSComCtrls,
|
||||
WinCEWSControls,
|
||||
// WinCEWSDbCtrls,
|
||||
|
Loading…
Reference in New Issue
Block a user