{***************************************************************************}
{ TMS IntraWeb Component Pack Pro                                           }
{ for Delphi & C++Builder                                                   }
{                                                                           }
{ written by TMS Software                                                   }
{            copyright © 2002 - 2009                                        }
{            Email : info@tmssoftware.com                                   }
{            Web : http://www.tmssoftware.com                               }
{                                                                           }
{ The source code is given as is. The author is not responsible             }
{ for any possible damage done due to the use of this code.                 }
{ The component can be freely used in any application. The complete         }
{ source code remains property of the author and may not be distributed,    }
{ published, given or sold in any form as such. No parts of the source      }
{ code can be included in any other component or application without        }
{ written authorization of the author.                                      }
{***************************************************************************}

unit IWAdvSelector;                                    
                        
interface                                       

{$R TMSIWADVSELECTOR.RES}                             
                                                              
{$I TMSDEFS.INC}                                         

uses                                               

  {$IFDEF LINUX}
  QControls, QGraphics, QIWPicCntnr, QForms,
  {$ELSE}
  Windows, Graphics, Controls, IWPicCntnr, Forms,
  {$ENDIF}
  {$IFDEF DELPHI6_LVL}
  Types,
  {$ENDIF}
  Classes,
  IWControl, IWTypes, IWCompEdit, IWFont, IWTMSImg,
  IWCompLabel, IWExtCtrls, IWHTMLTag, IWTMSBase, IWColor,
  ExtCtrls, Math, IWImageList
  {$IFDEF TMSIW6}
  , IWRenderContext
  {$ENDIF}
  , Dialogs
  {$IFDEF TMSIW9}
  , IWXMLTag
  {$ENDIF}
  ;

type
  TTIWGradientDirection = (gdHorizontal, gdVertical);
  TTIWItemType = (itColor, itCustom, itFont, itImage);
  TTIWItemSize = (isFull, isNormal);
  TTIWGlyphPosition = ( gpAboveText, gpBeforeText);

  TTIWImagePosition = ( ipBeforeText, ipAfterText, ipAboveText, ipBelowText );
  TTIWAlignment = ( taCenter, taLeft, taRight );
  TTIWVAlignment = ( vaBottom, vaMiddle, vaTop );

  TTIWAdvSelector = class;
  TAdvSelectorItem = class;
  TAdvSelectorItems = class;

  TTIWPicture = class(TPersistent)
  private
    FFileName: string;
    FImageIndex: integer;
  public
    constructor Create;
    function ImageRef(Images: TIWImageList): string;
  published
     property FileName: string read FFileName write FFileName;
     property ImageIndex: integer read FImageIndex write FImageIndex default -1;
  end;

  TAdvSelectorDropDown = class(TPersistent)
  private
    FAllowDrag: bool;
    FCaptionColor: TIWColor;
    FCaptionColorTo: TIWColor;
    FCaptionDragGripColor: TIWColor;
    FCaptionDragGripGlyph: TTIWPicture;
    FCaptionForeColor: TIWColor;
    FCaptionGradientDirection: TTIWGradientDirection;
    FCaptionText: string;
    FColor: TIWColor;
    FColorTo: TIWColor;
    FColumns: integer;
    FGradientDirection: TTIWGradientDirection;
    FGlyphWidth: integer;
    FGlyphHeight: integer;
    FGlyphMarginX: integer;
    FGlyphMarginY: integer;
    FGlyphPosition: TTIWGlyphPosition;
    FHoverColor: TIWColor;
    FItemWidth: integer;
    FItemHeight: integer;
    FSelectionColor: TIWColor;
    FSelectionBorderColor: TIWColor;
  public
    constructor Create;
    destructor Destroy; override;

  published
    property AllowDrag: bool read FAllowDrag write FAllowDrag default True;
    property CaptionColor: TIWColor read FCaptionColor write FCaptionColor default clBtnFace;
    property CaptionColorTo: TIWColor read FCaptionColorTo write FCaptionColorTo default clNone;
    property CaptionDragGripColor: TIWColor read FCaptionDragGripColor write FCaptionDragGripColor default clInactiveBorder;
    property CaptionDragGripGlyph: TTIWPicture read FCaptionDragGripGlyph write FCaptionDragGripGlyph;
    property CaptionForeColor: TIWColor read FCaptionForeColor write FCaptionForeColor default clBlack;
    property CaptionGradientDirection: TTIWGradientDirection read FCaptionGradientDirection write FCaptionGradientDirection default gdVertical;
    property CaptionText: String read FCaptionText write FCaptionText;
    property BackColor: TIWColor read FColor write FColor default clWebAZURE;
    property BackColorTo: TIWColor read FColorTo write FColorTo default clWebWHITE;
    property Columns: integer read FColumns write FColumns default 1;
    property GradientDirection: TTIWGradientDirection read FGradientDirection write FGradientDirection default gdHorizontal;
    property GlyphWidth: integer read FGlyphWidth write FGlyphWidth default 20;
    property GlyphHeight: integer read FGlyphHeight write FGlyphHeight default 20;
    property GlyphMarginX: integer read FGlyphMarginX write FGlyphMarginX default 3;
    property GlyphMarginY: integer read FGlyphMarginY write FGlyphMarginY default 3;
    property GlyphPosition: TTIWGlyphPosition read FGlyphPosition write FGlyphPosition default gpBeforeText;
    property HoverColor: TIWColor read FHoverColor write FHoverColor default clWebORANGE;
    property ItemWidth: integer read FItemWidth write FItemWidth default 80;
    property ItemHeight: integer read FItemHeight write FItemHeight default 30;
    property SelectionColor: TIWColor read FSelectionColor write FSelectionColor default clWebPAPAYAWHIP;
    property SelectionBorderColor: TIWColor read FSelectionBorderColor write FSelectionBorderColor default clBlack;

  end;

  TAdvSelectorItem = class(TCollectionItem)
  private
    FOwner: TAdvSelectorItems;
    FColor: TIWColor;
    FGlyph: TTIWPicture;
    FHint: string;
    FName: string;
    FSize: TTIWItemSize;
    FText: string;
    FItemType:  TTIWItemType;
    FValue: string;
  protected
    function GetDisplayName: String; override;
  public
    constructor Create(Collection: TCollection); override;
    destructor Destroy; override;
    procedure Assign(Source: TPersistent); override;
    function GetOwner: TPersistent; override;
  published
    property Color: TIWColor read FColor write FColor default clNone;
    property Glyph: TTIWPicture read FGlyph write FGlyph;
    property Hint: string read FHint write FHint;
    property Name: string read FName write FName;
    property Size: TTIWItemSize read FSize write FSize default isNormal;
    property Text: string read FText write FText;
    property ItemType: TTIWItemType read FItemType write FItemType default itColor;
    property Value: string read FValue write FValue;

  end;

  TAdvSelectorItems = class(TCollection)
  private
    FOwner: TTIWAdvSelector;
    function GetItem(Index: Integer): TAdvSelectorItem;
    procedure SetItem(Index: Integer; const Value: TAdvSelectorItem);
  protected
    procedure Update(Item: TCollectionItem); override;
  public
    constructor Create(AOwner: TTIWAdvSelector);
    destructor Destroy; override;
    procedure Assign(Source: TPersistent); override;
    function Add: TAdvSelectorItem;
    function Insert(Index: integer): TAdvSelectorItem;
    function GetOwner: TPersistent; override;
    property Items[Index: Integer]: TAdvSelectorItem read GetItem write SetItem; default;
  end;

  TItemClickEvent = procedure(Sender:TObject; ItemIndex: integer) of object;

  {$IFDEF TMSIW9}
  TIWAsyncItemEvent = procedure (Sender: TObject; EventParams: TStringList; ItemIndex: Integer) of object;
  {$ENDIF}

  TTIWAdvSelector = class(TIWControl)
  private
    FText: String;
    FGlyph: TTIWPicture;
    FHint: string;
    FFont: TIWfont;

    FImagePosition: TTIWImagePosition;
    FAlignment: TTIWAlignment;
    FVAlignment: TTIWVAlignment;

    FBackColor: TIWColor;
    FBackColorTo: TIWColor;
    FBackColorGradientDirection: TTIWGradientDirection;

    FBorderColor: TIWColor;
    FBorderWidth: Integer;

    FHotColor: TIWColor;
    FHotColorTo: TIWColor;
    FHotColorGradientDirection: TTIWGradientDirection;
    FHotBorderColor: TIWColor;

    FDownColor: TIWColor;
    FDownColorTo: TIWColor;
    FDownColorGradientDirection: TTIWGradientDirection;
    FDownBorderColor: TIWColor;

    FClientEvent: TStringList;

    FItems: TAdvSelectorItems;
    FImages: TIWImageList;
    FDropDown: TAdvSelectorDropDown;
    FDropDownImage: TIPicture;
    FDropDownImageURL: string;
    FSelectedIndex: integer;
    FShowSelectedColor: boolean;
    FShowSelectedItem: boolean;
    FShowSelectedText: boolean;
    FShowDropDownButton: boolean;

    FOnClick: TItemClickEvent;
    {$IFDEF TMSIW9}
    FOnAsyncClick: TIWAsyncItemEvent;
    {$ENDIF}

    FTop: string;
    FLeft: string;

    procedure SetTextEx(const Value: string);
    procedure SetFont(const Value: TIWfont);
    procedure SetGlyph(const Value: TTIWPicture);
    procedure SetClientEvent(const Value: TStringList);
    procedure SetItems(const Value: TAdvSelectorItems);
    procedure SetShowDropDownButton(const Value: boolean);
    procedure SetDropDownImage(const Value: TIPicture);    
  protected
    procedure SetValue(const AValue: string); override;  
    procedure Submit(const AValue: string); override;
    procedure Notification(AComponent: TComponent; AOperation: TOperation); override;
    {$IFDEF TMSIW9}
    procedure DoAsyncClick(AParams: TStringList);
    {$ENDIF}
  public
    {$IFDEF TMSIW6}
    procedure IWPaint; override;
    function RenderHTML(AContext: TIWBaseComponentContext): TIWHTMLTag; override;
    {$ELSE}
    procedure Paint; override;
    function RenderHTML: TIWHTMLTag; override;
    {$ENDIF}
    {$IFDEF TMSIW9}
    function RenderAsync(AContext: TIWBaseHTMLComponentContext): TIWXMLTag; override;
    {$ENDIF}
    constructor Create(AOwner: TComponent); override;
    procedure DrawGradient(Canvas: TCanvas; FromColor, ToColor: TIWColor; Steps: Integer; r:TRect; Direction: Boolean);
    destructor Destroy; override;
  published
    property Text: string read FText write SetTextEx; //stored;
    property Glyph: TTIWPicture read FGlyph write SetGlyph;
    property Hint: string read FHint write FHint;
    property Font : TIWfont read FFont write SetFont;

    property Alignment: TTIWAlignment read FAlignment write FAlignment default taCenter;
    property VerticalAlignment: TTIWVAlignment read FVAlignment write FVAlignment default vaMiddle;
    property ImagePosition: TTIWImagePosition read FImagePosition write FImagePosition default ipBeforeText;

    property BackColor: TIWColor read FBackColor write FBackColor default clWebLIGHTCYAN;
    property BackColorTo: TIWColor read FBackColorTo write FBackColorTo default clWebLIGHTSTEELBLUE;
    property BackColorGradientDirection: TTIWGradientDirection read FBackColorGradientDirection write FBackColorGradientDirection default gdVertical;

    property BorderColor: TIWColor read FBorderColor write FBorderColor default clNone;
    property BorderWidth: Integer read FBorderWidth write FBorderWidth default 1;

    property HotColor: TIWColor read FHotColor write FHotColor default clWebAZURE;
    property HotColorTo: TIWColor read FHotColorTo write FHotColorTo default clNone;
    property HotColorGradientDirection: TTIWGradientDirection read FHotColorGradientDirection write FHotColorGradientDirection default gdVertical;
    property HotBorderColor: TIWColor read FHotBorderColor write FHotBorderColor default clWebSTEELBLUE;

    property DownColor: TIWColor read FDownColor write FDownColor default clWebLIGHTSTEELBLUE;
    property DownColorTo: TIWColor read FDownColorTo write FDownColorTo default clNone;
    property DownColorGradientDirection: TTIWGradientDirection read FDownColorGradientDirection write FDownColorGradientDirection default gdVertical;
    property DownBorderColor: TIWColor read FDownBorderColor write FDownBorderColor default clWebSTEELBLUE;

    property ClientEvent: TStringList read FClientEvent write SetClientEvent;

    property OnClick: TItemClickEvent read FOnClick write FOnClick;
    {$IFDEF TMSIW9}
    property OnAsyncClick: TIWAsyncItemEvent read FOnAsyncClick write FOnAsyncClick;
    {$ENDIF}

    property Items: TAdvSelectorItems read FItems write SetItems;
    property Images: TIWImageList read FImages write FImages;

    property DropDown: TAdvSelectorDropDown read FDropDown write FDropDown;
    property DropDownImage: TIPicture read FDropDownImage write SetDropDownImage;
    property DropDownImageURL: string read FDropDownImageURL write FDropDownImageURL;
    property SelectedIndex: integer read FSelectedIndex write FSelectedIndex default -1;
    property ShowSelectedColor: boolean read FShowSelectedColor write FShowSelectedColor default false;
    property ShowSelectedItem: boolean read FShowSelectedItem write FShowSelectedItem default false;
    property ShowSelectedText: boolean read FShowSelectedText write FShowSelectedText default false;
    property ShowDropDownButton: boolean read FShowDropDownButton write SetShowDropDownButton default true;

  end;


implementation

uses
  {$IFDEF LINUX}
  QImgList,
  {$ELSE}
  ImgList, ShellAPI, CommCtrl,
  {$ENDIF}
  IWApplication, IWServerControllerBase, IWServer,
  SWStrings, SWSystem, IWAppForm, SysUtils, IWGlobal
  {$IFDEF TMSIW7}
  , IWBaseHTMLControl
  {$ENDIF}
  ;

procedure TTIWAdvSelector.DrawGradient(Canvas: TCanvas; FromColor, ToColor: TIWColor; Steps: Integer; r:TRect; Direction: Boolean);
var
  diffr,startr,endr: Integer;
  diffg,startg,endg: Integer;
  diffb,startb,endb: Integer;
  iend: Integer;
  rstepr,rstepg,rstepb,rstepw: Real;
  i,stepw: Word;

begin
  if Steps = 0 then
    Steps := 1;

  FromColor := ColorToRGB(FromColor);
  ToColor := ColorToRGB(ToColor);

  startr := (FromColor and $0000FF);
  startg := (FromColor and $00FF00) shr 8;
  startb := (FromColor and $FF0000) shr 16;
  endr := (ToColor and $0000FF);
  endg := (ToColor and $00FF00) shr 8;
  endb := (ToColor and $FF0000) shr 16;

  diffr := endr - startr;
  diffg := endg - startg;
  diffb := endb - startb;

  rstepr := diffr / steps;
  rstepg := diffg / steps;
  rstepb := diffb / steps;

  if Direction then
    rstepw := (R.Right - R.Left) / Steps
  else
    rstepw := (R.Bottom - R.Top) / Steps;

  with Canvas do
  begin
    for i := 0 to Steps - 1 do
    begin
      endr := startr + Round(rstepr*i);
      endg := startg + Round(rstepg*i);
      endb := startb + Round(rstepb*i);
      stepw := Round(i*rstepw);
      Pen.Color := endr + (endg shl 8) + (endb shl 16);
      Brush.Color := Pen.Color;
      if Direction then
      begin
        iend := R.Left + stepw + Trunc(rstepw) + 1;
        if iend > R.Right then
          iend := R.Right;
        Rectangle(R.Left + stepw,R.Top,iend,R.Bottom)
      end
      else
      begin
        iend := R.Top + stepw + Trunc(rstepw)+1;
        if iend > r.Bottom then
          iend := r.Bottom;
        Rectangle(R.Left, R.Top+stepw,R.Right,iend);
      end;
    end;
  end;
end;
                     

{ TTIWAdvSelector }
{$IFDEF TMSIW9}
procedure TTIWAdvSelector.DoAsyncClick(AParams: TStringList);
begin
  if Assigned(OnAsyncClick) then
    OnAsyncClick(Self, AParams, SelectedIndex);
end;

function TTIWAdvSelector.RenderAsync(
  AContext: TIWBaseHTMLComponentContext): TIWXMLTag;
begin
  Result := TIWXMLTag.CreateTag('control');
  try
    Result.AddStringParam('id', HTMLName);
    Result.AddStringParam('type', 'TTIWADVSELECTOR');
    RenderAsyncCommonProperties( AContext, Result );
  except
    FreeAndNil(Result);
  end;
end;
{$ENDIF}

constructor TTIWAdvSelector.Create(AOwner: TComponent);
begin
  inherited;

  {$IFDEF TMSIW6}
  SetRenderSize(True);
  {$ELSE}
  FRenderSize := True;
  {$ENDIF}
//  FNeedsFormTag := True;
  {$IFDEF TMSIW6}
  {TODO}
  {$ELSE}
  FSupportedScriptEvents := 'OnClick';
  FSupportsInput := true;
  FSupportsSubmit := true;
  {$ENDIF}

  FText := EmptyStr;
  FGlyph := TTIWPicture.Create;
  FHint := EmptyStr;

  FBackColor := clWebLIGHTCYAN;
  FBackColorTo := clWebLIGHTSTEELBLUE;
  FBackColorGradientDirection := gdVertical;

  FBorderColor := clNone;
  FBorderWidth := 1;

  FHotColor := clWebAZURE;
  FHotColorTo := clNone;
  FHotColorGradientDirection := gdVertical;
  FHotBorderColor := clWebSTEELBLUE;

  FDownColor := clWebLIGHTSTEELBLUE;
  FDownColorTo := clNone;
  FDownColorGradientDirection := gdVertical;
  FDownBorderColor := clWebSTEELBLUE;

  FClientEvent := TStringList.Create;

  FFont := TIWFont.Create;
  FFont.FontName := 'Arial';
  FFont.Color := clBlack;
  FFont.Size := 10;

  FItems := TAdvSelectorItems.Create(Self);
  FDropDown := TAdvSelectorDropDown.Create;
  FDropDownImage := TIPicture.Create;
  FSelectedIndex := -1;
  FShowSelectedColor := false;
  FShowSelectedItem := false;
  FShowSelectedText := false;
  FShowDropDownButton := true;

  FAlignment := taCenter;
  FVAlignment := vaMiddle;
  FImagePosition := ipBeforeText;

  FTop := EmptyStr;
  FLeft := EmptyStr;

  Width := 65;
  Height := 24;

  {$IFDEF TMSIW6}
  {TODO}
  {$ELSE}
  FSupportedScriptEvents := 'OnClick';
  {$ENDIF}

  if not (csDesigning in Componentstate) then
    begin
      {$IFDEF TMSIW51}
      TIWServer.AddInternalFile('IW_JS_TMSIWADVSELECTOR','/js/TMSIWADVSELECTOR.js');
      {$ELSE}
      GIWServer.AddInternalFile('IW_JS_TMSIWADVSELECTOR');
      {$ENDIF}
    end;
  end;

destructor TTIWAdvSelector.Destroy;
begin
  FItems.Free;
  FDropDown.Free;
  FDropDownImage.Free;
  FFont.Free;
  FClientEvent.Free;
  FGlyph.Free;
  inherited;
end;

procedure TTIWAdvSelector.SetShowDropDownButton(const Value: boolean);
begin
  FShowDropDownButton := value;
  Invalidate;
end;

procedure TTIWAdvSelector.SetTextEx(const Value: string);
begin
  FText := value;
  Invalidate;
end;


{$IFDEF TMSIW6}
procedure TTIWAdvSelector.IWPaint;
{$ELSE}
procedure TTIWAdvSelector.Paint;
{$ENDIF}
var
  r: TRect;
  s: string;
begin
  Canvas.Font.Name := Font.FontName;
  Canvas.Font.Size := Font.Size;
  Canvas.Font.Color := Font.Color;
  Canvas.Font.Style := Font.Style;

  with Canvas do
  begin
    r.Left := 0;
    r.Top := 0;
    r.Right := Width;
    r.Bottom := Height;
    if BackColorGradientDirection = gdVertical then
      DrawGradient(Canvas,FBackColor, FBackColorTo,80,r,False)
    else
      DrawGradient(Canvas,FBackColor, FBackColorTo,80,r,True);
    Brush.Style := bsClear;
    TextOut(Width div 2 - TextWidth(Text) div 2,Height div 2 - TextHeight(Text) div 2,Text);

    if ShowDropDownButton then
    begin
      Font.Name := 'WebDings';
      s := chr($36);
      Font.Size := 11;
      TextOut(Width - TextWidth(s),Height div 2 - TextHeight(s) div 2,s);
    end;


  end;
end;


procedure TTIWAdvSelector.Notification(AComponent: TComponent; AOperation: TOperation);
begin
  inherited;
  if (AOperation = opRemove) then
    if (AComponent = Images) then
      Images := nil;
end;

procedure TTIWAdvSelector.SetGlyph(const Value: TTIWPicture);
begin
  FGlyph.Assign(Value);
  Invalidate;
end;

procedure TTIWAdvSelector.SetClientEvent(const Value: TStringList);
begin
  FClientEvent.Assign(Value);
  Invalidate;
end;

procedure TTIWAdvSelector.SetDropDownImage(const Value: TIPicture);
begin
  FDropDownImage.Assign(Value);
  Invalidate;
end;

procedure TTIWAdvSelector.SetFont(const Value: TIWfont);
begin
  FFont.Assign(Value);
  Invalidate;
end;

procedure TTIWAdvSelector.Submit(const AValue: string);
var
  s: string;
begin
  inherited;
  s := AValue;

  if Assigned(OnClick) then
    OnClick(Self, SelectedIndex);
end;

procedure TTIWAdvSelector.SetItems(const Value: TAdvSelectorItems);
begin
  FItems.Assign(Value); 
end;


{$IFDEF TMSIW6}
function TTIWAdvSelector.RenderHTML(AContext: TIWBaseComponentContext): TIWHTMLTag;
{$ELSE}
function TTIWAdvSelector.RenderHTML: TIWHTMLTag;
{$ENDIF}
var
  htmlres, ImgPath, buttonval: string;
  backColorStr, backColorToStr, borderColorStr, borderWidthStr, iType, ival: string;
  scriptString, eventString, clienteventString, image, icolor, cv, ct, imgval, textrow, textpos, glyphpos: string;
  gradient, cgradient, graddir, DragGrip, DragGripColor, cspanh, endrow, sitem, scolor, itext, ceVal, cvalue: string;
  i, j, w, h, puw, cspan, bwidth, bheight: Integer;
  isPartial: boolean;
  seli, asi: TAdvSelectorItem;
  talign, valign, imagepos: string;
  ajaxcall, doasync, fontname: string;
begin

 {$IFDEF TMSIW6}
  with AContext.PageContext as TIWPageContext40 do
    isPartial := WebApplication.IsPartialUpdate;
  {$ELSE}

  {$ENDIF}

    doasync := 'false';
    {$IFDEF TMSIW9}
    if Assigned(FOnAsyncClick) then
    begin
        doasync := 'true';
        Acontext.WebApplication.RegisterCallBack(HTMLName+'.DoAsyncClick', DoAsyncClick);
    end;
   {$ENDIF}

  if not isPartial then
    TIWComponent40Context(AContext).AddScriptFile('/js/TMSIWADVSELECTOR.js');

      w := Width;
      h := Height;     

      if Assigned(OnClick) then
        eventString := '"' + HTMLName + '"'
      else
        eventString := '""';

      //if (ClientEvent.Length > 0)
      clienteventString := '"' + HTMLName + '"';
      //else
      //	clienteventString = "''";

      backColorStr := EmptyStr;
      if not (BackColor = clNone) then
        backColorStr := ColorToRGBString(BackColor);

      backColorToStr := EmptyStr;
      if not ((BackColorTo = clNone) and (BackColor = clNone)) then
        backColorToStr := ColorToRGBString(BackColorTo);

      borderColorStr := EmptyStr;
      if not (BorderColor = clNone) then
        borderColorStr := ColorToRGBString(BorderColor);

      borderWidthStr := '0';
      //if not (BorderColor = clNone) then
      borderWidthStr := IntToStr(BorderWidth);

      image := EmptyStr;
      icolor := EmptyStr;
      ct := EmptyStr;
      cv := EmptyStr;

      if not (SelectedIndex = -1) then
      begin
        seli := Items[SelectedIndex];

        cv := ColorToRGBString(seli.Color);
        if ( (seli.ItemType = itFont) or (seli.ItemType = itCustom) ) then
          cv := seli.Value
        else if (seli.ItemType = itImage) then
          cv := StringReplace(seli.Glyph.FileName,'\','/',[rfReplaceAll]);

        ct := seli.Text;

        if (ShowSelectedText) then
          Text := seli.Text;

        if ( (ShowSelectedColor) and (seli.ItemType = itColor)) then
          icolor := '<div class='''+HTMLName+'color'' style=''background:'+ColorToRGBString(seli.Color)+';border:1px solid gray;''></div>';

        if ( (ShowSelectedItem) and (seli.ItemType <> itColor) and (seli.Glyph.FileName <> EmptyStr) ) then
          image := '<img src='''+StringReplace(seli.Glyph.FileName,'\','/',[rfReplaceAll])+''' align=''absmiddle''>';
      end;


      if ( (image = EmptyStr) and not (Glyph.FileName = EmptyStr) ) then
        image := '<img src='''+StringReplace(Glyph.FileName,'\','/',[rfReplaceAll])+''' align=''absmiddle''>';

      talign := 'center';
      if (Alignment = taLeft) then
        talign := 'left';
      if (Alignment = taRight) then
        talign := 'right';

      valign := 'middle';
      if (VerticalAlignment = vaTop) then
         valign := 'top';
      if (VerticalAlignment = vaBottom) then
        valign := 'bottom';

      imagepos := 'BeforeText';
      if (ImagePosition = ipAfterText) then
        imagepos := 'AfterText';
      if (ImagePosition = ipAboveText) then
        imagepos := 'AboveText';
      if (ImagePosition = ipBelowText) then
        imagepos := 'BelowText';


       fontname := Font.FontName;
       if Font.FontFamily <> EmptyStr then
         fontname := Font.FontFamily;

        if DropDownImageURL <> EmptyStr then
        begin
          buttonval := '<img src=''' + DropDownImageURL + '''>';
        end
        else if FDropDownImage.Empty then
        begin
          buttonval := '<font face=''webdings''>6</font>'
        end
        else
        begin
                                                                                            
          if FDropDownImage.IsGIF then
          {$IFDEF TMSIW71}
            buttonval := TIWServerControllerBase.NewCacheFile('gif', true)
          {$ELSE}
            buttonval := TIWServerControllerBase.NewCacheFile('gif')
          {$ENDIF}
          else
          {$IFDEF TMSIW71}
            buttonval := TIWServerControllerBase.NewCacheFile('jpg', true);
          {$ELSE}
            buttonval := TIWServerControllerBase.NewCacheFile('jpg');
          {$ENDIF}

          FDropDownImage.SaveToFile(buttonval);

          buttonval := '<img src=''' + GetCacheDir(Self) + ExtractFilename(buttonval)+ '''>';
        end;
                   
        //render button
       scriptString := '<script>var asGenerator = "Delphi"; var asHeight = "'
         +IntToStr(Height)+'"; asi_Create('+doasync+',"'+text+'","'+image
         +'","font-family:' + fontname + ';font-size:' + IntToStr(Font.Size)
         + 'pt;' +iif(fsBold in Font.Style, 'font-weight:bold;', '')
         + iif(fsItalic in Font.Style, 'font-style:italic;', '')
         + 'color:' + ColorToRGBString(Font.Color) +';","'+
        backColorStr +'","'+
        backColorToStr+'","'+
        IIF(BackColorGradientDirection = gdHorizontal,'1','0') + '","'+
        ColorToRGBString(HotColor)+'","'+
        ColorToRGBString(HotColorTo)+'","'+
        IIF(HotColorGradientDirection = gdHorizontal,'1','0') + '","'+
        ColorToRGBString(HotBorderColor)+'","'+
        ColorToRGBString(DownColor) +'","'+
        ColorToRGBString(DownColorTo) + '","'+
        IIF(DownColorGradientDirection = gdHorizontal,'1','0') + '","'+
        ColorToRGBString(DownBorderColor)+ '","'+talign+'","'+ IntToStr(w) +'","'+
         IntToStr(h) +'",'+eventString+','+clienteventString+',"'+
        borderWidthStr + '","solid","' + borderColorStr + '","'+imagepos+'","'+valign+'","' +
        HTMLName + '","' + HTMLName + '",' +
        IIF(ShowDropDownButton,'true','false') + ',' + IIF(DropDown.AllowDrag,'true','false') +
        ',"' + StringReplace(Hint,'"','&quot;',[rfReplaceAll]) + '","' + icolor + '","' + buttonval + '");</script>';


     ImgPath := FGlyph.ImageRef(Images);
     (*
     if FGlyph.Empty then
       ImgPath := ''
     else
     begin
       {$IFDEF TMSIW71}
       ImgName := TIWServerControllerBase.NewCacheFile('bmp',true);
       {$ELSE}
       ImgName := TIWServerControllerBase.NewCacheFile('bmp');
       {$ENDIF}
       FGlyph.SaveToFile(ImgName);
       ImgPath := GetCacheDir(Self) + ExtractFileName(ImgName);
     end;
     *)


     //render stylesheet
      htmlres := '<style>'#13
        + '.'+HTMLName+'border{'#13
        + '  overflow: hidden;'#13
        + '  padding: '+ IntToStr(DropDown.GlyphMarginY)+'px '+ IntToStr(DropDown.GlyphMarginX) +'px;'#13
        + '';

      htmlres := htmlres + ''
        + '}'#13
        + '.'+HTMLName+'color{'#13
        + '  height: '+ IntToStr(DropDown.GlyphHeight) +'px;'#13
        + '  width: '+ IntToStr(DropDown.GlyphWidth) +'px;'#13
        + ' position:relative;top:1px;left:1px;'#13
        + '  overflow: hidden;'#13
        + '}'#13
        + '</style>'#13;

      htmlres := htmlres + scriptString;

      if clienteventString <> '' then
      begin
  			htmlres := htmlres + '<script>function '+HTMLName+'cef(id){'#13
        + 'var val = document.getElementById(id + "CV").value;'#13
        + 'var txt = document.getElementById(id + "CT").value;'#13
        + 'var idx = document.getElementById(id + "SI").value;'#13
        + ClientEvent.GetText+'}</script>'#13;
		  end;

      {$IFDEF TMSIW9}
      if Assigned(FOnAsyncClick) then
      begin
        ajaxcall := 'processAjaxEvent(''onClick'', '
          + HTMLControlImplementation.IWCLName
          + ',''' + HTMLName + '.' + 'DoAsyncClick' + ''','
          + 'true' + ', null, '
          + 'true' + ');';
       end;
      {$ENDIF}

 			htmlres := htmlres + '<script>function '+HTMLName+'asyncClick(){'#13
        + ajaxcall
        +'}</script>'#13;


      //render popup
      gradient := EmptyStr;
      if not ( (DropDown.BackColor = clNone) and (DropDown.BackColorTo = clNone) ) then
      begin
        graddir := '0';
        if (DropDown.GradientDirection = gdHorizontal) then
          graddir := '1';

        gradient := 'FILTER:progid:DXImageTransform.Microsoft.Gradient(GradientType='+graddir+',StartColorStr='+ColorToRGBString(DropDown.BackColor)+',EndColorStr='+ColorToRGBString(DropDown.BackColorTo)+');';
      end;

      puw := (DropDown.ItemWidth*DropDown.Columns) + (2*DropDown.Columns) + 9;

      htmlres := htmlres + '<div id="'+HTMLName+'popup" '
        + ' style="cursor:pointer;cursor:default;background:'+ColorToRGBString(DropDown.BackColor)+';'
        +gradient+'display:none;border:1px solid black;padding:2;height:;width:'+ IntToStr(puw)
        +';position:absolute;z-index:3001;">';

      //DropdownCaption
      if (DropDown.AllowDrag) then
      begin
        cgradient := EmptyStr;
        if ( (DropDown.CaptionColor <> clNone) and (DropDown.CaptionColorTo <> clNone) ) then
        begin
          graddir := '0';
          if (DropDown.CaptionGradientDirection = gdHorizontal) then
            graddir := '1';

          cgradient := 'FILTER:progid:DXImageTransform.Microsoft.Gradient(GradientType='+graddir+',StartColorStr='+ColorToRGBString(DropDown.CaptionColor)+',EndColorStr='+ColorToRGBString(DropDown.CaptionColorTo)+');';
        end;

        DragGripcolor := EmptyStr;
        if not (DropDown.CaptionDragGripColor = clNone) then
          DragGripcolor := 'background:'+ColorToRGBString(DropDown.CaptionDragGripColor)+';';

        DragGrip := '<center><div style="'+DragGripcolor+'width:30;height:7;overflow:hidden;"></div></center>';
        if not (DropDown.CaptionDragGripGlyph.FileName = EmptyStr) then
          DragGrip := '<img ondragstart="ASI_cancelEvent()" src="'+ StringReplace(DropDown.CaptionDragGripGlyph.FileName,'\','/',[rfReplaceAll])+'">';

        htmlres := htmlres + '<div id="'+HTMLName+'dragdiv1" '
          + ' style="'+cgradient+'background: '+ColorToRGBString(DropDown.CaptionColor)+';cursor:pointer;cursor:move;height:7;width:100%;" '
          + ' onmousedown=''ASIStartDrag("'+HTMLName+'",event);''>'
          + '<table cellspacing=0 cellpadding=0 border=0 width=100% height=100%><tr><td align=center valign=middle>' + DragGrip + '</td></tr></table>'
          + ' </div>';

        htmlres := htmlres + '<div id="'+HTMLName+'dragdiv2"'
          + ' style="cursor:pointer;cursor:move;height:12;width:100%;display:none;" '
          + ' onmousedown=''ASIStartDrag("'+HTMLName+'",event);''>'
          + '<table cellspacing=0 cellpadding=0 border=0 style="'+cgradient+'background: '+ColorToRGBString(DropDown.CaptionColor)+';overflow:hidden;height:12;width:100%;">'
          + '<tr><td nowrap style="font-family:'+Font.FontName+';font-size:'+ IntToStr(Font.Size) +';color:'+ColorToRGBString(DropDown.CaptionForeColor)+';"><b>&nbsp;'+DropDown.CaptionText+'</b></td>'
          + '<td align="right" style="cursor:pointer;"'
          {$IFDEF TMSIW9}
          + ' Onclick=''asi_popup('+HTMLControlImplementation.IWCLName+','+doasync+',null,"'+HTMLName+'","captionclose",'+IIF(DropDown.AllowDrag,'true','false')+',"'+HTMLName+'");'''
          {$ELSE}
          + ' Onclick=''asi_popup("",'+doasync+',null,"'+HTMLName+'","captionclose",'+IIF(DropDown.AllowDrag,'true','false')+',"'+HTMLName+'");'''
          {$ENDIF}
          + '>'
          + '<font size="2" color="'+ColorToRGBString(DropDown.CaptionForeColor)+'"><b>X&nbsp;</b></font>'
          + '</td></tr></table>'
          + ' </div>';

        if (AContext.WebApplication.Browser = brIE) then
          htmlres := htmlres + '<div style="width:100%;height:2;overflow:hidden;"></div>'
        else
          htmlres := htmlres + '<div style="width:100%;height:8;overflow:hidden;"></div>';

      end;
      //end DropDownCaption

       htmlres := htmlres
        + '<table border=0 cellpadding=0 cellspacing=2 '
        + '><tr>'#13
        + '';

      i := 0;
      for j := 1 to Items.Count do
      begin
        asi := Items[j - 1];       
        cspanh := EmptyStr;
        endrow := EmptyStr;
        bwidth := DropDown.ItemWidth;
        bheight := DropDown.ItemHeight;
        sitem := EmptyStr;
        scolor := EmptyStr;
        scolor := ColorToRGBString(DropDown.SelectionColor);

        itext := EmptyStr;
        if not (asi.Text = EmptyStr) then
          itext := '&nbsp;' + asi.Text + '&nbsp;';

        if (i = DropDown.Columns) then
        begin
          htmlres := htmlres + '</tr><tr>'#13;     
          i := 0;                               
        end;                                        
                                                           
        if (asi.Size = isFull) then                      
        begin                                   
          cspan := (DropDown.Columns*2);
          if (cspan > 0) then
          begin
            cspanh := 'colspan="' + IntToStr(cspan) + '"';
            bwidth := (bwidth*DropDown.Columns) + (2*DropDown.Columns) - 1;
          end;
          endrow := '</tr><tr>'#13;
          i := i-1;
        end;

        if (j-1 = SelectedIndex) then
          sitem := 'background:' + ColorToRGBString(DropDown.SelectionColor) + ';border:1px solid ' + ColorToRGBString(DropDown.SelectionBorderColor) + ';';

        ceVal := ColorToRGBString(asi.Color);
        if ( (asi.ItemType = itFont) or (asi.ItemType = itCustom) ) then
          ceVal := asi.Text
        else if (asi.ItemType = itImage) then
          ceVal := StringReplace(asi.Glyph.FileName,'\','/',[rfReplaceAll]);

        cvalue := ColorToRGBString(asi.Color);
        if (asi.ItemType = itFont) then
          cvalue := asi.Text;
        if (asi.ItemType = itCustom) then
          cvalue := asi.Value
        else if (asi.ItemType = itImage) then
          cvalue := StringReplace(asi.Glyph.FileName,'\','/',[rfReplaceAll]);

        imgval := EmptyStr;
        if not (asi.Glyph.FileName = EmptyStr) then
          imgval := '<img src="'+StringReplace(asi.Glyph.FileName,'\','/',[rfReplaceAll])+'" class="'+HTMLName+'color">';

        textrow := EmptyStr;
        textpos := EmptyStr;
        glyphpos := 'width="'+ IntToStr(DropDown.GlyphWidth) +'"';
        if not (DropDown.GlyphPosition = gpBeforeText) then
        begin
          textrow := '</tr><tr>';
          textpos := 'text-align:center;';
          glyphpos := EmptyStr;
        end;

        if not (AContext.WebApplication.Browser = brIE) then
        begin
          bwidth := bwidth - (DropDown.GlyphMarginX*2);
          bheight := bheight - (DropDown.GlyphMarginY*2);
        end;

        if (asi.ItemType = itCustom) then
          iType := 'Custom'
        else if (asi.ItemType = itImage) then
          iType := 'Image'
        else if (asi.ItemType = itFont) then                 
          iType := 'Font'
        else
          iType := 'Color';
                       
        htmlres := htmlres + '<td '+cspanh+' class="'+HTMLName+'td"'
          + '>'#13
          + '<div class="'+HTMLName+'border" title="'+asi.Hint+'" id="'+HTMLName + IntToStr(j - 1) +'"'
          + 'style="'+sitem+'position:relative;top:0px;left:0px;width:'+ IntToStr(bwidth) +'px;height:'+ IntToStr(bheight) +'px;"'
          + ' onmouseover=''asi_me(event,"'+HTMLName+'","or",this,"'+ColorToRGBString(DropDown.HoverColor)+'","'+HTMLName+'")'''
          + ' onmouseout=''asi_me(event,"'+HTMLName+'","ot",this,"'+scolor+'","'+HTMLName+'")'''
          {$IFDEF TMSIW9}
          + ' onmousedown=''asi_popup('+HTMLControlImplementation.IWCLName+','+doasync+',event,"'+HTMLName+'","itemclick",'+ IIF(DropDown.AllowDrag,'true','false')+',"'+HTMLName+'",this,"'+scolor+'","'+asi.Text+'","'+ColorToRGBString(asi.Color)+'",'+ IIF(ShowSelectedColor,'true','false')+','+ IIF(ShowSelectedItem,'true','false')+','+IIF(ShowSelectedText,'true','false')+',"'+ceVal+'","'+iType+'","'+ StringReplace(asi.Glyph.FileName,'\','/',[rfReplaceAll])+'",'+eventString+',"'+asi.Text+'","'+cvalue+'");'
          {$ELSE}
          + ' onmousedown=''asi_popup("",'+doasync+',event,"'+HTMLName+'","itemclick",'+ IIF(DropDown.AllowDrag,'true','false')+',"'+HTMLName+'",this,"'+scolor+'","'+asi.Text+'","'+ColorToRGBString(asi.Color)+'",'+ IIF(ShowSelectedColor,'true','false')+','+ IIF(ShowSelectedItem,'true','false')+','+IIF(ShowSelectedText,'true','false')+',"'+ceVal+'","'+iType+'","'+ StringReplace(asi.Glyph.FileName,'\','/',[rfReplaceAll])+'",'+eventString+',"'+asi.Text+'","'+cvalue+'");'
          {$ENDIF}

          + HTMLName+'cef("'+HTMLName+'");'' '
          + '>'#13
          + '<table border=0 cellpadding=0 cellspacing=0 '
          + 'style="'+textpos+'font-family:'+Font.FontName +';font-size:'+ IntToStr(Font.Size) + ';color:' + ColorToRGBString(Font.Color) +';position:relative;top:0px;left:0px;width:'+ IntToStr((bwidth-(2*DropDown.GlyphMarginX)-2))+';height:'+ IntToStr((DropDown.ItemHeight-(2*DropDown.GlyphMarginY)-2)) +';"'
          + '><tr>';                                        
          
        if ( not (imgval = EmptyStr) or (asi.ItemType = itColor) ) then
          htmlres := htmlres + '<td '+glyphpos+'><center>'#13;

              
        if (asi.ItemType = itFont) then
        begin

            ival := EmptyStr;
            if not (asi.Text = EmptyStr) then
              ival := asi.Value;

            if not (imgval = EmptyStr) then
              htmlres := htmlres + imgval + '</center></td>' + textrow;

            htmlres := htmlres + '<td><font face="'+ival+'">' + itext + '</font>&nbsp;</td>';
        end
        else if (asi.ItemType = itImage) or (asi.ItemType = itCustom) then
        begin                                              

            if not (imgval = EmptyStr) then
              htmlres := htmlres + imgval + '</center></td>' + textrow;

            htmlres := htmlres + '<td>' + itext + '&nbsp;</td>';
        end                                                                                        
        else
        begin                                             
            htmlres := htmlres
              + '<div class="'+HTMLName+'color" '
              + ' style="background:'+ColorToRGBString(asi.Color)+';border:1px solid silver;"></div></center>'
              + '</td>'+textrow+'<td align=center>' + itext + '&nbsp;</td>';
        end;
        i := i+1;                                 

        htmlres := htmlres                              
          + '</tr></table>'#13
          + '</div></td>'+endrow;

      end;

      htmlres := htmlres + '</tr></table></div>';

      htmlres := htmlres + '<input type="hidden" id="'+HTMLName+'SI" name="'+HTMLName+'SI" value="'+ IntToStr(SelectedIndex) +'">';
      htmlres := htmlres + '<input type="hidden" id="'+HTMLName+'CV" name="'+HTMLName+'CV" value="'+cv+'">';
      htmlres := htmlres + '<input type="hidden" id="'+HTMLName+'CT" name="'+HTMLName+'CT" value="'+ct+'">';

      if (DropDown.AllowDrag) then
      begin
        htmlres := htmlres + '<input type="hidden" value="'+FTop+'" name="'+HTMLName+'SST" id="'+ HTMLName + 'SST">';
        htmlres := htmlres + '<input type="hidden" value="'+FLeft+'" name="'+HTMLName+'SSL" id="'+ HTMLName + 'SSL">';
      end;

  Result := TIWHTMLTag.CreateTag('DIV');
  Result.Contents.AddText(htmlres);

  with Result.Contents.AddTag('INPUT') do
  begin
    AddStringParam('TYPE', 'hidden');
    AddStringParam('NAME', HTMLName);
    AddStringParam('ID', HTMLName + '_INPUT');
  end;

      //StartupScript
      if ( (FTop <> EmptyStr) or (FLeft <> EmptyStr) ) then
      begin
        scriptString := EmptyStr;

        scriptString := scriptString + ' document.getElementById("'+HTMLName+'popup").style.display = ""; '#13;
        scriptString := scriptString + ' document.getElementById("'+HTMLName+'dragdiv1").style.display = "none"; '#13;
        scriptString := scriptString + ' document.getElementById("'+HTMLName+'dragdiv2").style.display = ""; '#13;

        if (FTop <> EmptyStr) then
          scriptString := scriptString + ' document.getElementById("'+HTMLName+'popup").style.top = '+FTop+'; '#13;

        if (FLeft <> EmptyStr) then
          scriptString := scriptString + ' document.getElementById("'+HTMLName+'popup").style.left = '+FLeft+'; '#13;

        if not (AContext.WebApplication.Browser = brIE) then
          scriptString := scriptString + ' ASIshowWindowedObjects(false,document.getElementById("'+HTMLName+'popup")); '#13;

        Result.Contents.AddText('<script>' + scriptString + '</script>'#13);
      end;
      //end StartupScript

end;

procedure TTIWAdvSelector.SetValue(const AValue: string);
var
vp: integer;
VarVal,su: string;
begin

    VarVal := aValue;

    vp := pos('^', VarVal);
    if vp > 0 then
    begin
      su := copy(VarVal, 1, vp - 1);
      Delete(VarVal, 1, vp);

      SelectedIndex := StrToInt(su);

   end;

    vp := pos('^', VarVal);
    if vp > 0 then
    begin

      su := copy(VarVal, 1, vp - 1);
      Delete(VarVal, 1, vp);

      FTop := su;
   end;

    vp := pos('^', VarVal);
    if vp > 0 then
    begin

      su := copy(VarVal, 1, vp - 1);
      Delete(VarVal, 1, vp);

      FLeft := su;

   end;

end;


                                                  
{ TTIWPicture }

constructor TTIWPicture.Create;
begin
  inherited Create;
  FFileName := '';
  FImageIndex := -1;
end;

function TTIWPicture.ImageRef(Images: TIWImageList): string;
begin
  Result := '';

  if FileName <> '' then
    Result :=  StringReplace(FileName,'\','/',[rfReplaceAll])
  else
    if Assigned(Images) and (ImageIndex >= 0) then
      Result := GServerController.CacheURL + Images.ExtractImageToCache(ImageIndex);
end;

{ TAdvSelectorItem }

procedure TAdvSelectorItem.Assign(Source: TPersistent);
begin
  if Source is TAdvSelectorItem then
  begin
    FColor := (Source as TAdvSelectorItem).Color;
    FGlyph.Assign((Source as TAdvSelectorItem).Glyph);
    FName := (Source as TAdvSelectorItem).Name;
  end;
end;

constructor TAdvSelectorItem.Create(Collection: TCollection);
begin
  inherited;
  if Collection is TAdvSelectorItems then
  begin
    FOwner := Collection as TAdvSelectorItems;
  end;

  FGlyph := TTIWPicture.Create;
  FColor := clNone;
  FSize := isNormal;
  FText := EmptyStr;
  FItemType := itColor;
  FName := EmptyStr;
  FValue := EmptyStr;

end;

destructor TAdvSelectorItem.Destroy;
begin
  FGlyph.Free;
  inherited;
end;

function TAdvSelectorItem.GetDisplayName: String;
begin
    Result := 'Item' + IntToStr(Index);
end;

function TAdvSelectorItem.GetOwner: TPersistent;
begin
  Result := FOwner;
end;

{ TAdvSelectorItems }

function TAdvSelectorItems.Add: TAdvSelectorItem;
begin
  Result := TAdvSelectorItem(inherited Add);
end;

procedure TAdvSelectorItems.Assign(Source: TPersistent);
begin
//  showmessage('here');
  inherited;
end;

constructor TAdvSelectorItems.Create(AOwner: TTIWAdvSelector);
begin
  inherited Create(TAdvSelectorItem);
  FOwner := AOwner;
end;

destructor TAdvSelectorItems.Destroy;
begin
  inherited;
end;

function TAdvSelectorItems.GetItem(Index: Integer): TAdvSelectorItem;
begin
  Result := TAdvSelectorItem(inherited Items[Index]);
end;

function TAdvSelectorItems.GetOwner: TPersistent;
begin
  Result := FOwner;
end;

function TAdvSelectorItems.Insert(Index: integer): TAdvSelectorItem;
begin
  result := TAdvSelectorItem(inherited Insert(Index));
end;

procedure TAdvSelectorItems.SetItem(Index: Integer;
  const Value: TAdvSelectorItem);
begin
  inherited Items[Index] := Value;
end;

procedure TAdvSelectorItems.Update(Item: TCollectionItem);
begin
  inherited;
  FOwner.Invalidate;
end;


{ TAdvSelectorDropDown }

constructor TAdvSelectorDropDown.Create;
begin
  inherited;
  FColor := clWebAZURE;
  FColorTo := clWebWHITE;
  FCaptionDragGripGlyph := TTIWPicture.Create;
  FAllowDrag := true;
  FCaptionColor := clBtnFace;
  FCaptionColorTo := clNone;
  FCaptionDragGripColor := clInactiveBorder;
  FCaptionForeColor := clBlack;
  FCaptionGradientDirection := gdVertical;
  FCaptionText := EmptyStr;
  FColumns := 1;
  FGradientDirection := gdHorizontal;
  FGlyphWidth := 20;
  FGlyphHeight := 20;
  FGlyphMarginX := 3;
  FGlyphMarginY := 3;
  FGlyphPosition := gpBeforeText;
  FHoverColor := clWebORANGE;
  FItemWidth := 80;
  FItemHeight := 30;
  FSelectionColor := clWebPAPAYAWHIP;
  FSelectionBorderColor := clBlack;
end;

destructor TAdvSelectorDropDown.Destroy;
begin
  FCaptionDragGripGlyph.Free;
  inherited;
end;

end.
