/**************************************************************************

    This file is part of Xclass95, a Win95-looking GUI toolkit.
    Copyright (C) 1996, 1997 David Barth, Hector Peraza.

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public
    License along with this library; if not, write to the Free
    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

**************************************************************************/

#ifndef __OXTAB_H
#define __OXTAB_H

#include <xclass/OXFrame.h>
#include <xclass/ODimension.h>


//-------------------- Tab widget

class OXTabElt : public OXFrame {
public:
  OXTabElt(const OXWindow *p, OString *text, int w, int h,
              GC norm, XFontStruct *font,
              unsigned int options = RAISED_FRAME,
              unsigned long back = _defaultFrameBackground);
  virtual ~OXTabElt();

  virtual void DrawBorder();
  virtual ODimension GetDefaultSize() const;
  const OString *GetText() const { return _text; }

protected:
  OString *_text;
  GC _normGC;
  XFontStruct *_fontStruct;
  int _tw, _th;
};

class OTabLayout : public OLayoutManager {
public:
  OTabLayout(class OXTab *main);
  
  virtual void Layout();
  virtual ODimension GetDefaultSize() const;

protected:
  class OXTab *_main;
  SListFrameElt **_list;
};

class OXTab : public OXCompositeFrame {
  static XFontStruct *_defaultFontStruct;
  XFontStruct *_fontStruct;
  static GC _defaultGC;
  GC _normGC;

public:
  OXTab(const OXWindow *p, int w, int h,
        GC norm = _defaultGC, XFontStruct *font = _defaultFontStruct,
        unsigned int options = CHILD_FRAME,
        unsigned long back = _defaultFrameBackground);
  virtual ~OXTab();

  virtual OXCompositeFrame *AddTab(OString *text);
  virtual void              DrawBorder() {}
  virtual int               HandleButton(XButtonEvent *event);

  OXCompositeFrame *GetContainer() { return _container; }
  int               GetCurrent() { return _current; }
  int               GetTabHeight() { return _tabh; }
  
  friend class OXClient;

protected:
  int _current, _tabh;
  OXCompositeFrame *_container;
};


#endif  // __OXTAB_H
