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

    This file is part of explorer95, a file manager for fvwm95.
    Copyright (C) 1996, 1997 David Barth, Hector Peraza.

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

    This program 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 General Public License for more details.

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

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

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

#include "OXNewWidgets.h"


GC OXStatusBar::_defaultGC;
XFontStruct *OXStatusBar::_defaultFontStruct;


//-------------------------------------------------------------------

OXStatusBar::OXStatusBar(const OXWindow *p, int w, int h,
              unsigned int options, unsigned long back) :
  OXFrame(p, w, h, options, back) {

    _bw = 2;
    _status_info = NULL;

    int ht = _defaultFontStruct->max_bounds.ascent +
             _defaultFontStruct->max_bounds.descent;

    _yt = 2 + _defaultFontStruct->max_bounds.ascent;

    Resize(w, ht + 5);
}

void OXStatusBar::DrawBorder() {

  //OXFrame::DrawBorder();
  if (_w > 170) {
    XDrawLine (GetDisplay(), _id, _shadowGC, 0, 0, 150, 0);
    XDrawLine (GetDisplay(), _id, _shadowGC, 0, 0, 0, _h-2);
    XDrawLine (GetDisplay(), _id, _hilightGC, 0, _h-1, 150, _h-1);
    XDrawLine (GetDisplay(), _id, _hilightGC, 150, _h-1, 150, 0);

    XDrawLine (GetDisplay(), _id, _shadowGC, 154, 0, _w-2, 0);
    XDrawLine (GetDisplay(), _id, _shadowGC, 154, 0, 154, _h-2);
    XDrawLine (GetDisplay(), _id, _hilightGC, 154, _h-1, _w-1, _h-1);
    XDrawLine (GetDisplay(), _id, _hilightGC, _w-1, _h-1, _w-1, 0);
  } else {
    XDrawLine (GetDisplay(), _id, _shadowGC, 0, 0, _w-2, 0);
    XDrawLine (GetDisplay(), _id, _shadowGC, 0, 0, 0, _h-2);
    XDrawLine (GetDisplay(), _id, _hilightGC, 0, _h-1, _w-1, _h-1);
    XDrawLine (GetDisplay(), _id, _hilightGC, _w-1, _h-1, _w-1, 0);
  }

  // 3d corner...
  XDrawLine(GetDisplay(), _id, _shadowGC,  _w-3,  _h-2, _w-2, _h-3);
  XDrawLine(GetDisplay(), _id, _shadowGC,  _w-4,  _h-2, _w-2, _h-4);
  XDrawLine(GetDisplay(), _id, _hilightGC, _w-5,  _h-2, _w-2, _h-5);  
   
  XDrawLine(GetDisplay(), _id, _shadowGC,  _w-7,  _h-2, _w-2, _h-7);
  XDrawLine(GetDisplay(), _id, _shadowGC,  _w-8,  _h-2, _w-2, _h-8);
  XDrawLine(GetDisplay(), _id, _hilightGC, _w-9,  _h-2, _w-2, _h-9);
  
  XDrawLine(GetDisplay(), _id, _shadowGC,  _w-11, _h-2, _w-2, _h-11);
  XDrawLine(GetDisplay(), _id, _shadowGC,  _w-12, _h-2, _w-2, _h-12);
  XDrawLine(GetDisplay(), _id, _hilightGC, _w-13, _h-2, _w-2, _h-13);

  XDrawLine(GetDisplay(), _id, _bckgndGC,  _w-13, _h-1, _w-1, _h-1);
  XDrawLine(GetDisplay(), _id, _bckgndGC,  _w-1,  _h-1, _w-1, _h-13);
}
