#if !defined(__alffsbar_h) // Sentry, use file only if it's not already included.
#define __alffsbar_h
/*  Project Biblio-Tec

	 SUBSYSTEM:    TEC30r.dll Library (TecLib)
	 FILE:         alffsbar.h
	 AUTHOR:       Alcindo Ferreira Filho

	 OVERVIEW:
	 ALFFProgressBar, ALFFStatusBar, ALFFMargins,
    ALFFGadget, ALFFSeparatorGadget, ALFFSizeGripGadget,
    ALFFBitmapGadget, ALFFTextGadget, and ALFFModeGadget
    Classes definition, the classes for being used
    where status bars windows are needed. They hide OWL
    correspondent classes.

    COPYRIGHT:    © 1998,2003-2005
                  Alcindo Ferreira Filho
                  <alcindo@inttec.com.br>

    LICENSE:      Biblio-Tec license (BiblTec.txt)
*/

#include <owl\owlall.h>
#include "alffdlg.h"
#include "alffobj.h"

//{{ALFFDialog = ALFFProgressBar}}
class _TECLIBCLASS ALFFProgressBar : public ALFFDialog
{
 public:
   ALFFProgressBar (TWindow* parent, char* title, int initialPos=0, TModule* module = 0);
   virtual ~ALFFProgressBar();
   void     SetPosition(int pos);
   char far* GetClassName() {return "ALFFProgressBar";}

 protected:
   void SetupWindow();
   virtual bool IdleAction(long idleCount);
   TGauge*   LedGauge;
   int       position;
   long      myIdleCount;
};

//{{Main Window Status Bar }}
class _TECLIBCLASS ALFFStatusBar: public TStatusBar, public ALFFObject
{
 public:
    ALFFStatusBar(TWindow* parent = 0, TGadget::TBorderStyle borderStyle = TGadget::Recessed,
                  uint modeIndicators = 0, TFont* font = new TGadgetWindowFont(),
                  TModule* module = 0);
   ~ALFFStatusBar();

   char far* GetClassName() {return "ALFFStatusBar";}

 protected:
 DECLARE_RESPONSE_TABLE(ALFFStatusBar);
};

/*
 *  Gadgets Classes that are wrappers for OWL or other (in future) class libraries
 */
//
// struct  ALFFMargins
// ~~~~~~ ~~~~~~~~~~~~
// Margin units & dimensions used by class ALFFGadget.
//
class _TECLIBCLASS ALFFMargins : protected TMargins, public ALFFObject
{
  enum ALFFUnits
       {
         Pixels  =  TMargins::Pixels,
         LayoutUnits  =  TMargins::LayoutUnits,
         BorderUnits  =  TMargins::BorderUnits
       };

  ALFFUnits  Units;

  int  Left;
  int  Right;
  int  Top;
  int  Bottom;

  ALFFMargins() : ALFFObject() {Units = LayoutUnits; Left = Right = Top = Bottom = 0;}

  ALFFMargins(ALFFUnits u, int l, int r, int t, int b) : ALFFObject()
      {Units = u; Left = l; Right = r; Top = t; Bottom = b;}

  char far* GetClassName() {return "ALFFMargins";}

  void GetPixels(int& left, int& right, int& top, int& bottom, int fontHeight) const;
};

//{{ALFFGadget = TGadget}}
class _TECLIBCLASS ALFFGadget : public TGadget, public ALFFObject
{
 public:
    // Gadget border styles. These match TIUBorder's TStyles exactly
    //
    enum ALFFBorderStyle {
      None = TGadget::None,             	//  No border painted at all
      Plain = TGadget::Plain,           	//  Plain plain window frame
      Raised = TGadget::Raised,         	//  Status field style raised
      Recessed = TGadget::Recessed,     	//  Status field style recessed
      Embossed = TGadget::Embossed,     	//  Grouping raised emboss bead
      Grooved = TGadget::Grooved,       	//  Grouping groove
      ButtonUp = TGadget::ButtonUp,     	//  Button in up position
      ButtonDn = TGadget::ButtonDn,     	//  Button in down position
      WndRaised = TGadget::WndRaised,   	//  Raised window outer+inner edge
      WndRecessed = TGadget::WndRecessed, //  Input field & other window recessed
      WellSet = TGadget::WellSet,         //  Well option set (auto grows + 1)
    };
   ALFFGadget (int id = 0, ALFFBorderStyle borderStyle = None);
   virtual ~ALFFGadget();
   char far* GetClassName() {return "ALFFGadget";}

   // Border dimensions
   //
   struct ALFFBorders {
     uint  Left   : 8;
     uint  Right  : 8;
     uint  Top    : 8;
     uint  Bottom : 8;

   ALFFBorders() {Left = Right = Top = Bottom = 0;}
   };
 protected:

};

//{{ALFFSeparatorGadget = TSeparatorGadget}}
class _TECLIBCLASS ALFFSeparatorGadget : public TSeparatorGadget, public ALFFObject
{
   public:
    ALFFSeparatorGadget(int size = 0, int id = 0);
    char far* GetClassName() {return "ALFFSeparatorGadget";}

   protected:
};

//{{ALFFSizeGripGadget = TSizeGripGadget}}
// ~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
// A gadget that is used on the far right of a status bar to provide re-sizing
// grip for the host window.
//
class _TECLIBCLASS ALFFSizeGripGadget : public TSizeGripGadget, public ALFFObject
{
  public:
    ALFFSizeGripGadget(int id = IDG_SIZEGRIP);
    char far* GetClassName() {return "ALFFSizeGripGadget";}
};

//{{ALFFBitmapGadget = TBitmapGadget}}
class  _TECLIBCLASS ALFFBitmapGadget: public TBitmapGadget, public ALFFObject
{
 public:
    ALFFBitmapGadget(TWindow* msgWindow,
                     int clickMsg,
                     TResId imageResIdOrIndex,
                     int id,
                     TBorderStyle borderStyle,
                     int numImages,
                     int startImage = 0,
                      bool sharedCels = false);
   ~ALFFBitmapGadget();
   char far* GetClassName() {return "ALFFBitmapGadget";}
 protected:
   TWindow* messageWindow;
   int   clickedMessage;
   virtual void LButtonDown(uint modKeys, TPoint& point);
};

//
// class ALFFTextGadget
// ~~~~~ ~~~~~~~~~~~~~~
// When constructing the text gadget specify how many characters you want
// room for and how the text should be aligned horizontally.
//
// The inner bounds are computed by multiplying the number of characters by
// the maximum character width.
//
//{{ALFFTextGadget = ALFFTTextGadget}}
class  _TECLIBCLASS ALFFTextGadget: public TTextGadget, public ALFFObject
{
 public:
    enum ALFFAlign
       {
         Left = TTextGadget::Left,
         Center = TTextGadget::Center,
         Right = TTextGadget::Right
       };

    ALFFTextGadget(int id = 0,
                   ALFFGadget::ALFFBorderStyle borderStyle= ALFFGadget::Recessed,
                   ALFFAlign = Left,
                   uint numChars = 10,
                   const char far* text = 0,
                   TFont* font = 0, /*new TGadgetWindowFont*/
                   COLORREF* bkColor  =  NULL,
                   COLORREF* txtColor =  NULL);
    ~ALFFTextGadget();
    char far* GetClassName() {return "ALFFTextGadget";}
    void SetTextColor(COLORREF color);
    COLORREF GetTextColor();
    void SetBkgdColor(COLORREF color);
    COLORREF GetBkgdColor();
  protected:
    // Override virtual methods defined in TGadget
    //
    TColor*  bkgdColor;
    TColor*  textColor;
    void     Paint(TDC& dc);

  private:
    // Hidden to prevent accidental copying or assignment
    //
    ALFFTextGadget(const ALFFTextGadget&);
    ALFFTextGadget& operator =(const ALFFTextGadget&);
};

/*
 * class ALFFModeGadget
 * ~~~~~ ~~~~~~~~~~~~~~
 */
class _TECLIBCLASS ALFFModeGadget : public ALFFTextGadget
{
  public:
    ALFFModeGadget(int vkKey, const char far* text, int id = 0,
                   ALFFGadget::ALFFBorderStyle borderStyle = ALFFGadget::Recessed,
                   ALFFTextGadget::ALFFAlign align = ALFFTextGadget::Center,
                   TFont* font = 0, /*new TGadgetWindowFont*/
                   COLORREF* modeColor = NULL);
    char far* GetClassName() {return "ALFFModeGadget";}
    /*
     * Override from ALFFGadget
     */
    bool IdleAction(long count);

  private:
    int VkKey;
};

#endif  //
