lazarus/lcl/interfaces/qt/qtwsspin.pp

104 lines
3.4 KiB
ObjectPascal

{ $Id$}
{
*****************************************************************************
* QtWSSpin.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 QtWSSpin;
{$mode objfpc}{$H+}
interface
uses
// Bindings
qt4, qtwidgets,
// LCL
Spin, SysUtils, Controls, LCLType, Forms,
// Widgetset
WSSpin, WSLCLClasses;
type
{ TQtWSCustomFloatSpinEdit }
TQtWSCustomFloatSpinEdit = class(TWSCustomFloatSpinEdit)
private
protected
public
class function CreateHandle(const AWinControl: TWinControl;
const AParams: TCreateParams): HWND; override;
class procedure DestroyHandle(const AWinControl: TWinControl); override;
end;
{ TQtWSFloatSpinEdit }
TQtWSFloatSpinEdit = class(TWSFloatSpinEdit)
private
protected
public
end;
implementation
{ TQtWSCustomFloatSpinEdit }
{------------------------------------------------------------------------------
Method: TQtWSCustomFloatSpinEdit.CreateHandle
Params: None
Returns: Nothing
------------------------------------------------------------------------------}
class function TQtWSCustomFloatSpinEdit.CreateHandle(const AWinControl: TWinControl;
const AParams: TCreateParams): HWND;
var
QtSpinBox: TQtSpinBox;
begin
QtSpinBox := TQtSpinBox.Create(AWinControl, AParams);
// SetSlots(QtSpinBox);
Result := THandle(QtSpinBox);
end;
{------------------------------------------------------------------------------
Method: TQtWSCustomFloatSpinEdit.DestroyHandle
Params: None
Returns: Nothing
------------------------------------------------------------------------------}
class procedure TQtWSCustomFloatSpinEdit.DestroyHandle(const AWinControl: TWinControl);
begin
TQtSpinBox(AWinControl.Handle).Free;
AWinControl.Handle := 0;
end;
initialization
////////////////////////////////////////////////////
// I M P O R T A N T
////////////////////////////////////////////////////
// To improve speed, register only classes
// which actually implement something
////////////////////////////////////////////////////
RegisterWSComponent(TCustomFloatSpinEdit, TQtWSCustomFloatSpinEdit);
// RegisterWSComponent(TFloatSpinEdit, TQtWSFloatSpinEdit);
////////////////////////////////////////////////////
end.