1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738
|
{ $Id: FpGuiwsstdctrls.pp 5319 2004-03-17 20:11:29Z marc $}
{
*****************************************************************************
* FpGuiWSStdCtrls.pp *
* --------------- *
* *
* *
*****************************************************************************
*****************************************************************************
This file is part of the Lazarus Component Library (LCL)
See the file COPYING.LCL, included in this distribution,
for details about the license.
*****************************************************************************
}
unit FpGuiWSStdCtrls;
{$mode objfpc}{$H+}
interface
uses
// Bindings
fpguiwsprivate,
// LCL
Classes, StdCtrls, Controls, LCLType, sysutils, Forms,
// Widgetset
WSStdCtrls, WSLCLClasses;
type
{ TFpGuiWSScrollBar }
TFpGuiWSScrollBar = class(TWSScrollBar)
private
protected
class procedure intfSetParams(APrivate: TFPGUIPrivateScrollBar; AScrollBar: TCustomScrollBar);
public
published
class function CreateHandle(const AWinControl: TWinControl;
const AParams: TCreateParams): TLCLHandle; override;
class procedure DestroyHandle(const AWinControl: TWinControl); override;
class procedure SetParams(const AScrollBar: TCustomScrollBar); override;
class procedure SetKind(const AScrollBar: TCustomScrollBar; const AIsHorizontal: Boolean); override;
end;
{ TFpGuiWSCustomGroupBox }
TFpGuiWSCustomGroupBox = class(TWSCustomGroupBox)
private
protected
published
class function CreateHandle(const AWinControl: TWinControl;
const AParams: TCreateParams): TLCLHandle; override;
class procedure DestroyHandle(const AWinControl: TWinControl); override;
end;
{ TFpGuiWSGroupBox }
TFpGuiWSGroupBox = class(TWSCustomGroupBox)
private
protected
public
end;
{ TFpGuiWSCustomComboBox }
TFpGuiWSCustomComboBox = class(TWSCustomComboBox)
private
protected
published
class function CreateHandle(const AWinControl: TWinControl;
const AParams: TCreateParams): TLCLHandle; override;
class procedure DestroyHandle(const AWinControl: TWinControl); override;
{ class function GetSelStart(const ACustomComboBox: TCustomComboBox): integer; override;
class function GetSelLength(const ACustomComboBox: TCustomComboBox): integer; override;}
class function GetItemIndex(const ACustomComboBox: TCustomComboBox): integer; override;
{ class function GetMaxLength(const ACustomComboBox: TCustomComboBox): integer; override;
class procedure SetArrowKeysTraverseList(const ACustomComboBox: TCustomComboBox;
NewTraverseList: boolean); virtual;
class procedure SetDroppedDown(const ACustomComboBox: TCustomComboBox;
ADroppedDown: Boolean); override;
class procedure SetSelStart(const ACustomComboBox: TCustomComboBox; NewStart: integer); override;
class procedure SetSelLength(const ACustomComboBox: TCustomComboBox; NewLength: integer); override;}
class procedure SetItemIndex(const ACustomComboBox: TCustomComboBox; NewIndex: integer); override;
{ class procedure SetMaxLength(const ACustomComboBox: TCustomComboBox; NewLength: integer); override;
class procedure SetStyle(const ACustomComboBox: TCustomComboBox; NewStyle: TComboBoxStyle); override;
class procedure SetReadOnly(const ACustomComboBox: TCustomComboBox; NewReadOnly: boolean); override;}
class function GetItems(const ACustomComboBox: TCustomComboBox): TStrings; override;
class procedure FreeItems(var AItems: TStrings); override;
end;
{ TFpGuiWSComboBox }
TFpGuiWSComboBox = class(TWSComboBox)
private
protected
public
end;
{ TFpGuiWSCustomListBox }
TFpGuiWSCustomListBox = class(TWSCustomListBox)
private
protected
published
class function CreateHandle(const AWinControl: TWinControl;
const AParams: TCreateParams): TLCLHandle; override;
class function GetStrings(const ACustomListBox: TCustomListBox
): TStrings; override;
class procedure FreeStrings(var AStrings: TStrings); override;
class procedure SetItemIndex(const ACustomListBox: TCustomListBox; const AIndex: integer); override;
class function GetItemIndex(const ACustomListBox: TCustomListBox): integer; override;
class procedure SetBorderStyle(const AWinControl: TWinControl; const ABorderStyle: TBorderStyle); override;
end;
{ TFpGuiWSListBox }
TFpGuiWSListBox = class(TWSListBox)
private
protected
public
end;
{ TFpGuiWSCustomEdit }
TFpGuiWSCustomEdit = class(TWSCustomEdit)
private
protected
published
class function CreateHandle(const AWinControl: TWinControl;
const AParams: TCreateParams): TLCLHandle; override;
public
end;
{ TFpGuiWSCustomMemo }
TFpGuiWSCustomMemo = class(TWSCustomMemo)
private
protected
published
class function CreateHandle(const AWinControl: TWinControl;
const AParams: TCreateParams): TLCLHandle; override;
{ class procedure AppendText(const ACustomMemo: TCustomMemo; const AText: string); override;
class procedure SetAlignment(const ACustomMemo: TCustomMemo; const AAlignment: TAlignment); override;}
class function GetStrings(const ACustomMemo: TCustomMemo): TStrings; override;
class procedure FreeStrings(var AStrings: TStrings); override;
end;
{ TFpGuiWSEdit }
TFpGuiWSEdit = class(TWSEdit)
private
protected
public
end;
{ TFpGuiWSMemo }
TFpGuiWSMemo = class(TWSMemo)
private
protected
public
end;
{ TFpGuiWSButtonControl }
TFpGuiWSButtonControl = class(TWSButtonControl)
private
protected
public
end;
{ TFpGuiWSButton }
TFpGuiWSButton = class(TWSButton)
private
protected
published
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLHandle; override;
class procedure DestroyHandle(const AWinControl: TWinControl); override;
class procedure Invalidate(const AWinControl: TWinControl); override;
class function GetText(const AWinControl: TWinControl; var AText: String): Boolean; override;
class procedure SetText(const AWinControl: TWinControl; const AText: String); override;
class procedure SetDefault(const AButton: TCustomButton; ADefault: Boolean); override;
end;
{ TFpGuiWSCustomCheckBox }
TFpGuiWSCustomCheckBox = class(TWSCustomCheckBox)
private
protected
published
class function CreateHandle(const AWinControl: TWinControl;
const AParams: TCreateParams): TLCLHandle; override;
class procedure DestroyHandle(const AWinControl: TWinControl); override;
class function RetrieveState(const ACustomCheckBox: TCustomCheckBox): TCheckBoxState; override;
class procedure SetState(const ACustomCheckBox: TCustomCheckBox; const NewState: TCheckBoxState); override;
class function GetText(const AWinControl: TWinControl; var AText: String): Boolean; override;
class procedure SetText(const AWinControl: TWinControl; const AText: String); override;
end;
{ TFpGuiWSCheckBox }
TFpGuiWSCheckBox = class(TWSCheckBox)
private
protected
public
end;
{ TFpGuiWSToggleBox }
TFpGuiWSToggleBox = class(TWSToggleBox)
private
protected
public
end;
{ TFpGuiWSRadioButton }
TFpGuiWSRadioButton = class(TWSRadioButton)
private
protected
published
class function CreateHandle(const AWinControl: TWinControl;
const AParams: TCreateParams): TLCLHandle; override;
class procedure DestroyHandle(const AWinControl: TWinControl); override;
class function RetrieveState(const ACustomCheckBox: TCustomCheckBox): TCheckBoxState; override;
class procedure SetState(const ACustomCheckBox: TCustomCheckBox; const NewState: TCheckBoxState); override;
class function GetText(const AWinControl: TWinControl; var AText: String): Boolean; override;
class procedure SetText(const AWinControl: TWinControl; const AText: String); override;
class procedure GetPreferredSize(const AWinControl: TWinControl;
var PreferredWidth, PreferredHeight: integer;
WithThemeSpace: Boolean); override;
end;
{ TFpGuiWSCustomStaticText }
TFpGuiWSCustomStaticText = class(TWSCustomStaticText)
private
protected
public
published
class function CreateHandle(const AWinControl: TWinControl;
const AParams: TCreateParams): TLCLHandle; override;
class procedure DestroyHandle(const AWinControl: TWinControl); override;
class procedure SetAlignment(const ACustomStaticText: TCustomStaticText; const NewAlignment: TAlignment); override;
end;
{ TFpGuiWSStaticText }
TFpGuiWSStaticText = class(TWSStaticText)
private
protected
public
end;
implementation
uses
fpg_combobox,
fpg_editcombo,
fpg_checkbox,
fpg_radiobutton,
fpg_listbox;
{ TFpGuiWSCustomStaticText }
class function TFpGuiWSCustomStaticText.CreateHandle(
const AWinControl: TWinControl; const AParams: TCreateParams): TLCLHandle;
var
PrivateWidget: TFPGUIPrivateStaticText;
begin
Result := TLCLHandle(TFPGUIPrivateStaticText.Create(AWinControl, AParams));
PrivateWidget:=TFPGUIPrivateStaticText(Result);
case TCustomStaticText(AWinControl).Alignment of
taLeftJustify: PrivateWidget.StaticText.Alignment:=taLeftJustify ;
taRightJustify: PrivateWidget.StaticText.Alignment:=taRightJustify ;
taCenter: PrivateWidget.StaticText.Alignment:=taCenter ;
end;
end;
class procedure TFpGuiWSCustomStaticText.DestroyHandle(
const AWinControl: TWinControl);
begin
TFPGUIPrivateStaticText(AWinControl.Handle).Free;
AWinControl.Handle:=0;
end;
class procedure TFpGuiWSCustomStaticText.SetAlignment(
const ACustomStaticText: TCustomStaticText; const NewAlignment: TAlignment);
var
PrivateWidget: TFPGUIPrivateStaticText;
begin
PrivateWidget:=TFPGUIPrivateStaticText(ACustomStaticText.Handle);
case NewAlignment of
taLeftJustify: PrivateWidget.StaticText.Alignment:=taLeftJustify ;
taRightJustify: PrivateWidget.StaticText.Alignment:=taRightJustify ;
taCenter: PrivateWidget.StaticText.Alignment:=taCenter ;
end;
end;
{ TFpGuiWSScrollBar }
class procedure TFpGuiWSScrollBar.intfSetParams(APrivate: TFPGUIPrivateScrollBar;
AScrollBar: TCustomScrollBar);
var
lSteps: integer;
begin
APrivate.Min:=AScrollBar.Min;
APrivate.Max:=AScrollBar.Max;
APrivate.Position:=AScrollBar.Position;
if AScrollBar.Kind=sbHorizontal then begin
APrivate.Horizontal:=true;
end else begin
APrivate.Horizontal:=false;
end;
APrivate.ScrollBar.PageSize:=AScrollBar.LargeChange;
APrivate.ScrollBar.ScrollStep:=AScrollBar.SmallChange;
if AScrollBar.PageSize<>0 then begin
lSteps:=(APrivate.Max - APrivate.Min);
if lSteps>0 then begin
APrivate.ScrollBar.SliderSize:=AScrollBar.PageSize/lSteps;
end else begin
APrivate.ScrollBar.SliderSize:=0;
end;
end else begin
APrivate.ScrollBar.SliderSize:=0;
end;
end;
class function TFpGuiWSScrollBar.CreateHandle(const AWinControl: TWinControl;
const AParams: TCreateParams): TLCLHandle;
begin
Result := TLCLHandle(TFPGUIPrivateScrollBar.Create(AWinControl, AParams));
intfSetParams(TFPGUIPrivateScrollBar(Result),TScrollBar(AWinControl));
end;
class procedure TFpGuiWSScrollBar.DestroyHandle(const AWinControl: TWinControl);
begin
TFPGUIPrivateScrollBar(AWinControl.Handle).Free;
AWinControl.Handle:=0;
end;
class procedure TFpGuiWSScrollBar.SetParams(const AScrollBar: TCustomScrollBar);
begin
intfSetParams(TFPGUIPrivateScrollBar(AScrollBar.Handle),AScrollBar);
end;
class procedure TFpGuiWSScrollBar.SetKind(const AScrollBar: TCustomScrollBar;
const AIsHorizontal: Boolean);
begin
inherited SetKind(AScrollBar, AIsHorizontal);
end;
{ TFpGuiWSCustomComboBox }
{------------------------------------------------------------------------------
Method: TQtWSCustomComboBox.CreateHandle
Params: None
Returns: Nothing
Allocates memory and resources for the control and shows it
------------------------------------------------------------------------------}
class function TFpGuiWSCustomComboBox.CreateHandle(
const AWinControl: TWinControl; const AParams: TCreateParams): TLCLHandle;
begin
Result := TLCLHandle(TFPGUIPrivateComboBox.Create(AWinControl, AParams));
end;
{------------------------------------------------------------------------------
Method: TQtWSCustomComboBox.DestroyHandle
Params: None
Returns: Nothing
Releases allocated memory and resources
------------------------------------------------------------------------------}
class procedure TFpGuiWSCustomComboBox.DestroyHandle(const AWinControl: TWinControl);
begin
TFPGUIPrivateComboBox(AWinControl.Handle).Free;
AWinControl.Handle := 0;
end;
{------------------------------------------------------------------------------
Method: TQtWSCustomComboBox.GetItemIndex
Params: None
Returns: The state of the control
------------------------------------------------------------------------------}
class function TFpGuiWSCustomComboBox.GetItemIndex(
const ACustomComboBox: TCustomComboBox): integer;
var
vComboBox: TfpgEditCombo;
begin
vComboBox := TFPGUIPrivateComboBox(ACustomComboBox.Handle).ComboBox;
Result := vComboBox.FocusItem;
end;
{------------------------------------------------------------------------------
Method: TFpGuiWSCustomComboBox.SetItemIndex
Params: Item index in combo
Returns: Nothing
------------------------------------------------------------------------------}
class procedure TFpGuiWSCustomComboBox.SetItemIndex(
const ACustomComboBox: TCustomComboBox; NewIndex: integer);
var
vComboBox: TfpgEditCombo;
begin
vComboBox := TFPGUIPrivateComboBox(ACustomComboBox.Handle).ComboBox;
vComboBox.FocusItem := NewIndex;
if NewIndex<>-1 then begin
vComboBox.Text:=vComboBox.Items[NewIndex];
end else begin
vComboBox.Text:='';
end;
end;
{------------------------------------------------------------------------------
Method: TFpGuiWSCustomComboBox.GetItems
Params: None
Returns: Returns a TStrings controlling the combo items
------------------------------------------------------------------------------}
class function TFpGuiWSCustomComboBox.GetItems(
const ACustomComboBox: TCustomComboBox): TStrings;
var
FComboBox: TfpgEditCombo;
begin
FComboBox := TFPGUIPrivateComboBox(ACustomComboBox.Handle).ComboBox;
Result := FComboBox.Items;
end;
class procedure TFpGuiWSCustomComboBox.FreeItems(var AItems: TStrings);
begin
//Widgetset atomatically frees the items, so override
//and do not call inherited.
end;
{ TFpGuiWSCustomEdit }
{------------------------------------------------------------------------------
Method: TFpGuiWSCustomEdit.CreateHandle
Params: None
Returns: Nothing
------------------------------------------------------------------------------}
class function TFpGuiWSCustomEdit.CreateHandle(const AWinControl: TWinControl;
const AParams: TCreateParams): TLCLHandle;
begin
Result := TLCLHandle(TFPGUIPrivateEdit.Create(AWinControl, AParams));
end;
{ TFpGuiWSButton }
{------------------------------------------------------------------------------
Method: TFpGuiWSButton.GetText
Params: None
Returns: Nothing
------------------------------------------------------------------------------}
class function TFpGuiWSButton.GetText(const AWinControl: TWinControl;
var AText: String): Boolean;
begin
Result := True;
AText := TFPGUIPrivateButton(AWinControl.Handle).GetText;
end;
{------------------------------------------------------------------------------
Method: TFpGuiWSButton.SetText
Params: None
Returns: Nothing
------------------------------------------------------------------------------}
class procedure TFpGuiWSButton.SetText(const AWinControl: TWinControl;
const AText: String);
begin
TFPGUIPrivateButton(AWinControl.Handle).SetText(AText);
end;
class procedure TFpGuiWSButton.SetDefault(const AButton: TCustomButton; ADefault: Boolean);
begin
TFPGUIPrivateButton(AButton.Handle).Button.Default := ADefault;
end;
{------------------------------------------------------------------------------
Method: TFpGuiWSButton.CreateHandle
Params: None
Returns: Nothing
Allocates memory and resources for the control and shows it
------------------------------------------------------------------------------}
class function TFpGuiWSButton.CreateHandle(const AWinControl: TWinControl;
const AParams: TCreateParams): TLCLHandle;
begin
Result := TLCLHandle(TFPGUIPrivateButton.Create(AWinControl, AParams));
end;
class procedure TFpGuiWSButton.DestroyHandle(const AWinControl: TWinControl);
begin
TFPGUIPrivateButton(AWinControl.Handle).Free;
AWinControl.Handle := 0;
end;
class procedure TFpGuiWSButton.Invalidate(const AWinControl: TWinControl);
begin
inherited Invalidate(AWinControl);
TFPGUIPrivateButton(AWinControl.Handle).Widget.Invalidate;
end;
{ TFpGuiWSCustomCheckBox }
class function TFpGuiWSCustomCheckBox.RetrieveState(
const ACustomCheckBox: TCustomCheckBox): TCheckBoxState;
var
vCheckBox: TfpgCheckBox;
begin
vCheckBox := TFPGUIPrivateCheckBox(ACustomCheckBox.Handle).CheckBox;
if vCheckBox.Checked then
Result := cbChecked
else
Result := cbUnchecked;
end;
class procedure TFpGuiWSCustomCheckBox.SetState(
const ACustomCheckBox: TCustomCheckBox; const NewState: TCheckBoxState);
var
vCheckBox: TfpgCheckBox;
begin
vCheckBox := TFPGUIPrivateCheckBox(ACustomCheckBox.Handle).CheckBox;
if NewState = cbChecked then
vCheckBox.Checked := True
else
vCheckBox.Checked := False;
end;
class function TFpGuiWSCustomCheckBox.GetText(const AWinControl: TWinControl;
var AText: String): Boolean;
var
vCheckBox: TfpgCheckBox;
begin
Result := False;
vCheckBox := TFPGUIPrivateCheckBox(AWinControl.Handle).CheckBox;
AText := vCheckBox.Text;
Result := True;
end;
class procedure TFpGuiWSCustomCheckBox.SetText(const AWinControl: TWinControl;
const AText: String);
var
vCheckBox: TfpgCheckBox;
begin
vCheckBox := TFPGUIPrivateCheckBox(AWinControl.Handle).CheckBox;
vCheckBox.Text := AText;
end;
class function TFpGuiWSCustomCheckBox.CreateHandle(
const AWinControl: TWinControl; const AParams: TCreateParams
): TLCLHandle;
begin
Result := TLCLHandle(TFPGUIPrivateCheckBox.Create(AWinControl, AParams));
end;
class procedure TFpGuiWSCustomCheckBox.DestroyHandle(
const AWinControl: TWinControl);
begin
TFPGUIPrivateCheckBox(AWinControl.Handle).Free;
AWinControl.Handle := 0;
end;
{ TFpGuiWSRadioButton }
class function TFpGuiWSRadioButton.RetrieveState(
const ACustomCheckBox: TCustomCheckBox): TCheckBoxState;
var
vRadioButton: TfpgRadioButton;
begin
vRadioButton := TFPGUIPrivateRadioButton(ACustomCheckBox.Handle).RadioButton;
if vRadioButton.Checked then
Result := cbChecked
else
Result := cbUnchecked;
end;
class procedure TFpGuiWSRadioButton.SetState(
const ACustomCheckBox: TCustomCheckBox; const NewState: TCheckBoxState);
var
vRadioButton: TfpgRadioButton;
begin
vRadioButton := TFPGUIPrivateRadioButton(ACustomCheckBox.Handle).RadioButton;
if NewState = cbChecked then
vRadioButton.Checked := True
else
vRadioButton.Checked := False;
end;
class function TFpGuiWSRadioButton.GetText(const AWinControl: TWinControl;
var AText: String): Boolean;
var
vRadioButton: TfpgRadioButton;
begin
Result := False;
vRadioButton := TFPGUIPrivateRadioButton(AWinControl.Handle).RadioButton;
AText := vRadioButton.Text;
Result := True;
end;
class procedure TFpGuiWSRadioButton.SetText(const AWinControl: TWinControl;
const AText: String);
var
vRadioButton: TfpgRadioButton;
begin
vRadioButton := TFPGUIPrivateRadioButton(AWinControl.Handle).RadioButton;
vRadioButton.Text := AText;
end;
class procedure TFpGuiWSRadioButton.GetPreferredSize(
const AWinControl: TWinControl; var PreferredWidth, PreferredHeight: integer;
WithThemeSpace: Boolean);
begin
TFPGUIPrivateRadioButton(AWinControl.Handle).GetPreferredSize(PreferredWidth,PreferredHeight,WithThemeSpace);
end;
class function TFpGuiWSRadioButton.CreateHandle(const AWinControl: TWinControl;
const AParams: TCreateParams): TLCLHandle;
begin
Result := TLCLHandle(TFPGUIPrivateRadioButton.Create(AWinControl, AParams));
end;
class procedure TFpGuiWSRadioButton.DestroyHandle(const AWinControl: TWinControl);
begin
TFPGUIPrivateRadioButton(AWinControl.Handle).Free;
AWinControl.Handle := 0;
end;
{ TFpGuiWSCustomMemo }
class function TFpGuiWSCustomMemo.CreateHandle(const AWinControl: TWinControl;
const AParams: TCreateParams): TLCLHandle;
begin
Result := TLCLHandle(TFPGUIPrivateMemo.Create(AWinControl, AParams));
end;
class function TFpGuiWSCustomMemo.GetStrings(const ACustomMemo: TCustomMemo): TStrings;
var
PrivateMemo: TFPGUIPrivateMemo;
begin
PrivateMemo := TFPGUIPrivateMemo(ACustomMemo.Handle);
Result:=PrivateMemo.GetStrings;
end;
class procedure TFpGuiWSCustomMemo.FreeStrings(var AStrings: TStrings);
begin
//Do nothing, autofree by fpguimemo
end;
{ TFpGuiWSListBox }
class function TFpGuiWSCustomListBox.CreateHandle(const AWinControl: TWinControl;
const AParams: TCreateParams): TLCLHandle;
begin
Result := TLCLHandle(TFPGUIPrivateListBox.Create(AWinControl, AParams));
end;
class function TFpGuiWSCustomListBox.GetStrings(
const ACustomListBox: TCustomListBox): TStrings;
var
FListBox: TfpgListBox;
begin
FListBox := TFPGUIPrivateListBox(ACustomListBox.Handle).ListBox;
Result := FListBox.Items;
end;
class procedure TFpGuiWSCustomListBox.FreeStrings(var AStrings: TStrings);
begin
//Do nothing, autofree by fpguilistbox
end;
class procedure TFpGuiWSCustomListBox.SetItemIndex(
const ACustomListBox: TCustomListBox; const AIndex: integer);
var
PrivateListBox: TFPGUIPrivateListBox;
begin
PrivateListBox:=TFPGUIPrivateListBox(ACustomListBox.Handle);
PrivateListBox.ItemIndex:=AIndex;
end;
class function TFpGuiWSCustomListBox.GetItemIndex(
const ACustomListBox: TCustomListBox): integer;
var
PrivateListBox: TFPGUIPrivateListBox;
begin
PrivateListBox:=TFPGUIPrivateListBox(ACustomListBox.Handle);
Result:=PrivateListBox.ItemIndex;
end;
class procedure TFpGuiWSCustomListBox.SetBorderStyle(
const AWinControl: TWinControl; const ABorderStyle: TBorderStyle);
var
PrivateListBox: TFPGUIPrivateListBox;
begin
PrivateListBox:=TFPGUIPrivateListBox(AWinControl.Handle);
case ABorderStyle of
TBorderStyle.bsNone: PrivateListBox.ListBox.PopupFrame:=true;
TBorderStyle.bsSingle: PrivateListBox.ListBox.PopupFrame:=false;
end;
end;
{ TFpGuiWSCustomGroupBox }
class function TFpGuiWSCustomGroupBox.CreateHandle(
const AWinControl: TWinControl; const AParams: TCreateParams
): TLCLHandle;
begin
Result := TLCLHandle(TFPGUIPrivateGroupBox.Create(AWinControl, AParams));
end;
class procedure TFpGuiWSCustomGroupBox.DestroyHandle(
const AWinControl: TWinControl);
begin
TFPGUIPrivateGroupBox(AWinControl.Handle).Free;
AWinControl.Handle := 0;
end;
end.
|