(*
*******************************************************************************
*         Copyright (C) SofCon 2003 All Rights Reserved                       *
*******************************************************************************
*
*    project:     Vizualizacni knihovny pro jednotku KIT
*
*
*    title:       defcus
*
*******************************************************************************
*
*    description: Defaultni customizacni procedura
*                 pro jednotlive komponenty a sub-tridy
*
*    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 defcus;

interface


function FocusLRKeyMapper( KeyCode: Word ): Word;
function FocusUDKeyMapper( KeyCode: Word ): Word;
function WindowLRKeyMapper( KeyCode: Word ): Word;
function WindowUDKeyMapper( KeyCode: Word ): Word;


implementation

uses
  iodrv, bitmaps,
  controls, grctrls;


function FocusLRKeyMapper( KeyCode: Word ): Word;
var
  Result : Word;
begin
  case KeyCode of
    kbLeft       : Result := vkPrev;
    kbRight      : Result := vkNext;
  else
    Result := 0;
  end;

  FocusLRKeyMapper := Result;
end;



function FocusUDKeyMapper( KeyCode: Word ): Word;
var
  Result : Word;
begin
  case KeyCode of
    kbUp         : Result := vkPrev;
    kbDown       : Result := vkNext;
  else
    Result := 0;
  end;

  FocusUDKeyMapper := Result;
end;


function WindowLRKeyMapper( KeyCode: Word ): Word;
var
  Result : Word;
begin
  case KeyCode of
    kbLeft       : Result := vkPrevWindow;
    kbRight      : Result := vkNextWindow;
  else
    Result := 0;
  end;

  WindowLRKeyMapper := Result;
end;



function WindowUDKeyMapper( KeyCode: Word ): Word;
var
  Result : Word;
begin
  case KeyCode of
    kbUp         : Result := vkPrevWindow;
    kbDown       : Result := vkNextWindow;
  else
    Result := KeyCode;
  end;

  WindowUDKeyMapper := Result;
end;



{-------------------------------
{ DefaultCustomizeProc
{---
{ Konfiguracni procedura pro vsechny komponenty definovane
{ v jednotka VMenu a GrMenu. Procedura konfiguruje komponenty
{ tak, aby byly vhodne zobrazeny a reagovaly spravne na
{ vstupni udalosti terminalu Term10 }
{---
{ AControl   Odkaz na instanci komponenty
{ AClass     Kod tridy konfigurace
{---
{ AClass musi odpovidat tride komponenty, jinak
{ volani funkce muze zpusobit nepredvidatelne nasledky.
}

procedure DefaultCustomizeProc( AControl: PControl; AClass: Word ); far;
const
  CStaticTextTitle : string[4] = #$00#$0F#$0F#$0F;
begin
  case AClass and ccGeneralMask of

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

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

  {----------------- TDialog }
    ccDialog:
    begin
      with PDialog( AControl )^ do
      begin
      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
      end;
    end;

  {----------------- TEdit }
    ccEdit:
    begin
      with PEdit( AControl )^ do
      begin
        SetInsMode( False );
        if AClass = ccEditInlineList then
        begin
          SetFlags( 0, edfBorder );
        end;
      end;
    end;

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

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


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

  {----------------- TNavigator }
    ccNavigator:
    begin
      with PNavigator( AControl )^ do
      begin
        SetFlags( nafBorder, 0 );
      end;
    end;

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

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

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

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

  {----------------- TStaticText }
    ccStaticText:
    begin
      with PStaticText( AControl )^ do
      begin
        case AClass of
          ccStaticTextTitle:
          begin
            SetPalette( CStaticTextTitle, True );
            SetFlags( stfBorder, 0 );
            SetTextParams( TextFlags, 4, Offset.Y, Leading );
          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
        SetFlags( mfBorder, 0 );
      end;
    end;

  {----------------- TMenuBox }
    ccMenuBox:
    begin
      with PMenuBar( AControl )^ do
      begin
        SetFlags( mfBorder, 0 );
      end;
    end;

  {----------------- TMenuOverlay }
    ccMenuOverlay:
    begin
      with PMenuOverlay( AControl )^ do
      begin
        SetFlags( mofBorder, 0 );
      end;
    end;

  {----------------- TMenuPopup }
    ccMenuPopup:
    begin
      with PMenuPopup( AControl )^ do
      begin
      end;
    end;

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


  else
    { Invalid class }
  end;
end;



begin
{  RegisterStdBitmaps1BPP; }
  RegisterCustomizeProc( DefaultCustomizeProc, cplDefault-1 );
end.
