(*
*******************************************************************************
*         Copyright (C) SofCon 2003 All Rights Reserved                       *
*******************************************************************************
*
*    project:     Vizualizacni knihovny pro jednotku KIT
*
*
*    title:       ColorCus.pas
*
*******************************************************************************
*
*    description: Konfiguracni procedura pro komponenty zobrazovane
*                 na terminaly Color
*
*    version:     0.01
*
*     (vyse uvedena verze je pouze verze teto knihovny, ktera
*      je soucasti baliku LIBV, jehoz verze je uvedena v knihovne
*      Iodrv.pas)
*
*    language:    Borland Pascal
*
*    author:      Binko
*    history:     date        sign   remark
*                 06/09/04    bin     prvni vydani
*
*****************************************************************************
*)

unit ColorCus;

interface

implementation

uses
  Controls,
  GrCtrls;

{-------------------------------
{ ColorCustomizeProc
{---
{ Konfiguracni procedura pro vsechny komponenty definovane
{ v jednotkach Controls a GrCtrls. Procedura konfiguruje komponenty
{ tak, aby byly vhodne zobrazeny na barevnych terminalech
}
{---
{ AControl   Odkaz na instanci komponenty
{ AClass     Kod tridy konfigurace
{---
{ AClass musi odpovidat tride komponenty, jinak
{ volani funkce muze zpusobit nepredvidatelne nasledky.
}

procedure ColorCustomizeProc( AControl: PControl; AClass: Word ); far;
const
                                    { 1   2   3   4   5   6   7   8   9   10  11 }
  CStaticText      : string[4]  = #$0F#$08#$07#$00;
  CStaticTextTitle : string[4]  = #$01#$09#$00#$0F;
  CNavigator       : string[4]  = #$01#$09#$00#$0F;
  CEdit            : string[4]  = #$03#$00#$0B#$00;
  CProgressBar     : string[4]  = #$0F#$00#$0B#$03;
{  CListBox         : string[9]  = #$0F#$0A#$08#$07#$00#$01#$0F#$07#$00;}
  CListBox         : string[9]  = #$03#$0F#$08#$00#$00#$08#$0F#$01#$0F;
{  CScrollBar       : string[6]  = #$06#$0E#$00#$0C#$00#$04;}
  CScrollBar       : string[6]  = #$06#$0E#$00#$00#$0E#$06;
  CWindow          : string[11] = #$0F#$09#$00#$01#$01#$01#$07#$01#$01#$01#$0F;
  CTrackBar        : string[12] = #$0F#$07#$00#$08#$0C#$00#$04#$0C#$00#$04#$01#$07;
  CButton          : string[12] = #$08#$07#$00#$08#$08#$0F#$07#$08#$00#$07#$0F#$00;
  CMenuBar         : string[6]  = #$07#$0F#$08#$00#$01#$0F;
  CMenuBox         : string[6]  = #$07#$0F#$08#$00#$01#$0F;
  CUpDown          : string[3]  = #$02#$0A#$08#$00;
  CListView        : string[11] = #$0F#$0A#$08#$07#$00#$07#$00#$01#$0F#$02#$0F;
  CListEdit        : string[11] = #$0F#$0A#$08#$07#$00#$07#$00#$01#$0F#$02#$0F;
  CMenuOverlay     : string[8]  = #$0F#$07#$00#$00#$00#$02#$0F#$0F;

begin
  case AClass and ccGeneralMask  of

  {----------------- TWindow }
    ccWindow:
    begin
      with PWindow( AControl )^ do
      begin
        SetPalette( CWindow, True );
      end;
    end;

  {----------------- TFrame }
    ccFrame:
    begin
      with PFrame( AControl )^ do
      begin
      end;
    end;

  {----------------- TDialog }
    ccDialog:
    begin
      with PDialog( AControl )^ do
      begin
        SetPalette( CWindow, True );
      end;
    end;

  {----------------- TPageControl }
    ccPageControl:
    begin
      with PPageControl( AControl )^ do
      begin
      end;
    end;

  {----------------- TPage }
    ccPage:
    begin
      with PPage( AControl )^ do
      begin
      end;
    end;

  {----------------- TApplication }
    ccApplication:
    begin
      with PApplication( AControl )^ do
      begin
      end;
    end;

  {----------------- TButton }
    ccButton:
    begin
      with PButton( AControl )^ do
      begin
        SetPalette( CButton, True );
      end;
    end;

  {----------------- TEdit }
    ccEdit:
    begin
      with PEdit( AControl )^ do
      begin
        SetPalette( CEdit, True );
      end;
    end;

  {----------------- TListBox }
    ccListBox:
    begin
      with PListBox( AControl )^ do
      begin
        SetPalette( CListBox, True );
      end;
    end;

  {----------------- TListView }
    ccListView:
    begin
      with PListView( AControl )^ do
      begin
        SetPalette( CListView, True );
      end;
    end;

  {----------------- TListEdit }
    ccListEdit:
    begin
      with PListEdit( AControl )^ do
      begin
        SetPalette( CListEdit, True );
      end;
    end;

  {----------------- TNavigator }
    ccNavigator:
    begin
      with PNavigator( AControl )^ do
      begin
        SetPalette( CNavigator, True );
      end;
    end;

  {----------------- TProgressBar }
    ccProgressBar:
    begin
      with PProgressBar( AControl )^ do
      begin
        SetPalette( CProgressBar, True );
      end;
    end;

  {----------------- TScrollBar }
    ccScrollBar:
    begin
      with PScrollBar( AControl )^ do
      begin
        SetPalette( CScrollBar, True );
      end;
    end;

  {----------------- TTrackBar }
    ccTrackBar:
    begin
      with PTrackBar( AControl )^ do
      begin
        SetPalette( CTrackBar, True );
      end;
    end;

  {----------------- TUpDown }
    ccUpDown:
    begin
      with PUpDown( AControl )^ do
      begin
        SetPalette( CUpDown, True );
      end;
    end;

  {----------------- TStaticText }
    ccStaticText:
    begin
      with PStaticText( AControl )^ do
      begin
        SetPalette( CStaticText, True );

        case AClass of
          ccStaticTextTitle:
          begin
            SetPalette( CStaticTextTitle, True );
          end;
        end;
      end;
    end;

  {----------------- TPaintBox }
    ccPaintBox:
    begin
      with PPaintBox( AControl )^ do
      begin
      end;
    end;

  {----------------- TImage }
    ccImage:
    begin
      with PImage( AControl )^ do
      begin
      end;
    end;

  {----------------- TKeyPad }
    ccKeyPad:
    begin
      with PKeyPad( AControl )^ do
      begin
      end;
    end;

  {----------------- TMenuBar }
    ccMenuBar:
    begin
      with PMenuBar( AControl )^ do
      begin
        SetPalette( CMenuBar, True );
      end;
    end;

  {----------------- TMenuBox }
    ccMenuBox:
    begin
      with PMenuBar( AControl )^ do
      begin
        SetPalette( CMenuBox, True );
      end;
    end;

  {----------------- TMenuOverlay }
    ccMenuOverlay:
    begin
      with PMenuOverlay( AControl )^ do
      begin
        SetPalette( CMenuOverlay, True );
      end;
    end;

  {----------------- TMenuPopUp }
    ccMenuPopUp:
    begin
      with PMenuPopUp( AControl )^ do
      begin
        SetPalette( CMenuBox, True );
{!!!!!!!!!!!!!!!!!!! vytvorit vlastni, nebo nechat box ???????????????? }
      end;
    end;

  {----------------- TDeskTop }
    ccDeskTop:
    begin
      with PDeskTop( AControl )^ do
      begin
{!!!!!!!!!!!!!!!!!!! vytvorit vlastni ???????????????? }
      end;
    end;


  else
    { Invalid class }
  end;
end;


begin
  RegisterCustomizeProc( ColorCustomizeProc, cplDefault );
end.
