/***********************************************************************
 * FXRuby -- the Ruby language bindings for the FOX GUI toolkit.
 * Copyright (c) 2001-2003 by J. Lyle Johnson. All Rights Reserved.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * For further information please contact the author by e-mail
 * at "lyle@users.sourceforge.net".
 ***********************************************************************/

/// Toolbar Tab styles
enum {
  TOOLBARTAB_HORIZONTAL = 0,              /// Default is for horizontal toolbar
  TOOLBARTAB_VERTICAL   = 0x00008000      /// For vertical toolbar
  };


/**
* A toolbar tab is used to collapse or uncollapse a sibling
* widget.  The sibling affected is the widget immediately following
* the toolbar tab or, if the toolbar tab is the last widget in the list,
* the widget immediately preceding the toolbar tab.
*/
class FXToolbarTab : public FXFrame {
protected:
  FXColor activeColor;                    // Color when active
  FXbool  collapsed;                      // Is collapsed flat
  FXbool  down;                           // Button down
protected:
  FXToolbarTab();
  void drawUpArrow(FXDCWindow& dc);
  void drawDownArrow(FXDCWindow& dc);
  void drawRightArrow(FXDCWindow& dc);
  void drawLeftArrow(FXDCWindow& dc);
  void drawHSpeckles(FXDCWindow& dc,FXint x,FXint w);
  void drawVSpeckles(FXDCWindow& dc,FXint y,FXint h);
public:
  long onPaint(FXObject*,FXSelector,void* PTR_EVENT);
  long onUpdate(FXObject*,FXSelector,void* PTR_NULL);
  long onEnter(FXObject*,FXSelector,void* PTR_EVENT);
  long onLeave(FXObject*,FXSelector,void* PTR_EVENT);
  long onUngrabbed(FXObject*,FXSelector,void* PTR_EVENT);
  long onLeftBtnPress(FXObject*,FXSelector,void* PTR_EVENT);
  long onLeftBtnRelease(FXObject*,FXSelector,void* PTR_EVENT);
  long onKeyPress(FXObject*,FXSelector,void* PTR_EVENT);
  long onKeyRelease(FXObject*,FXSelector,void* PTR_EVENT);
  long onCmdCollapse(FXObject*,FXSelector,void* PTR_IGNORE);
  long onUpdCollapse(FXObject*,FXSelector,void* PTR_IGNORE);
  long onCmdUncollapse(FXObject*,FXSelector,void* PTR_IGNORE);
  long onUpdUncollapse(FXObject*,FXSelector,void* PTR_IGNORE);
public:
  enum {
    ID_COLLAPSE=FXFrame::ID_LAST,
    ID_UNCOLLAPSE,
    ID_LAST
    };
public:
  
  /// Construct toolbar tab 
  %extend {
    FXToolbarTab(FXComposite* p,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=FRAME_RAISED,FXint x=0,FXint y=0,FXint w=0,FXint h=0){
      return new FXRbToolbarTab(p,tgt,sel,opts,x,y,w,h);
      }
    }

  /// Collapse or uncollapse the toolbar
  void collapse(FXbool c=TRUE);
  
  /// Return true if the toolbar is collapsed
  FXbool isCollapsed() const;

  /// Change the tab style
  void setTabStyle(FXuint style);
  
  /// Get current tab style
  FXuint getTabStyle() const;
  
  /// Get the active color
  FXColor getActiveColor() const;

  /// Set the active color
  void setActiveColor(FXColor clr);
  
  /// Destructor
  virtual ~FXToolbarTab();
  };


DECLARE_FXOBJECT_VIRTUALS(FXToolbarTab)
DECLARE_FXID_VIRTUALS(FXToolbarTab)
DECLARE_FXDRAWABLE_VIRTUALS(FXToolbarTab)
DECLARE_FXWINDOW_VIRTUALS(FXToolbarTab)

