/*
  'Acqua' kwin client

  Copyright (C) 2001 Rik Hemsley (rikkus) <rik@kde.org>

  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; see the file COPYING.  If not, write to
  the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  Boston, MA 02111-1307, USA.
*/
#include <kconfig.h>
#include "AcquaButtonMenu.h"

using namespace KWinInternal;


#include "other.xpm"
#include "other_down.xpm"
#include "other_inactive.xpm"
#include "other_unused.xpm"

namespace AcquaNamespace
{

static int buttonStyle;

static void readConfig()
{
   KConfig config("kwinrc");
   config.setGroup("Style");
   buttonStyle=config.readNumEntry("AcquaButtonStyle",1);
}

}; // Namespace



AcquaButtonMenu::AcquaButtonMenu(QWidget * parent)
  : AcquaButton(parent, i18n("Menu"),24)
{
  AcquaNamespace::readConfig();

  if (AcquaNamespace::buttonStyle==1) {
    pixmap_inactive=QPixmap(other_unused_xpm);
  }
  else {
    pixmap_inactive=QPixmap(other_inactive_xpm);
  }
  pixmap_=QPixmap(other_xpm);
  pixmap_down=QPixmap(other_down_xpm);
  pixmap_over=QPixmap(other_xpm);
  
}

  void
AcquaButtonMenu::clickEvent(int /* button */)
{
}

  void
AcquaButtonMenu::mousePressEvent(QMouseEvent *e)
{
  AcquaButton::mousePressEvent(e);

  QPoint menuPoint ( rect().bottomLeft() );

  // Move to right if menu on rhs, otherwise on left
  // and make this depend on windowWrapper(), not button.
  emit popupMenu( mapToGlobal( menuPoint ) );

  mouseDown_=false;
  repaint();
}

#include "AcquaButtonMenu.moc"
// vim:ts=2:sw=2:tw=78:set et:
