/*
 *	$Id: cdeclient.h,v 1.2 2002/03/12 01:17:49 fredrik Exp $
 *	
 *	CDE KWin client - emulates the look and feel
 *	of dtwm, the CDE window manager.
 *	
 *	Copyright (c) 2000-2001, 2002
 *		Chris Lee       <lee@azsites.com>
 *		Lennart Kudling <kudling@kde.org>
 *      	Fredrik Höglund <fredrik@kde.org>
 *
 *	Originally based on the KStep client.
 *	
 *	Distributed under the terms of the BSD license.	
 */

#ifndef __CDECLIENT_H
#define __CDECLIENT_H

#include <qbutton.h>
#include <qbitmap.h>
#include <kpixmap.h>
#include <kwin/client.h>
#include <kwin/kwinbutton.h>

class QLabel;
class QHBoxLayout;
class QVBoxLayout;
class QSpacerItem;

namespace KWinInternal {

class CdeClient;

enum Buttons { BtnMenu=0, BtnHelp, BtnIconify, BtnMax, BtnClose, BtnCount };

class CdeButton : public KWinInternal::KWinButton
{
public:
    CdeButton( CdeClient* parent=0, const char* name=0, int btnType=0,
               const QString& tip=NULL );
    void reset();

protected:
    virtual void drawButton( QPainter *p );

private:
    int m_btnType;
    Client* m_parent;
};

class CdeClient : public KWinInternal::Client
{
    Q_OBJECT
public:
    CdeClient( Workspace* ws, WId w, QWidget* parent=0, const char* name=0 );
    ~CdeClient() {};

protected:
    void resizeEvent( QResizeEvent* );
    void paintEvent( QPaintEvent* );
    void addClientButtons( const QString& );
    void mouseDoubleClickEvent( QMouseEvent* );
    void mousePressEvent( QMouseEvent* );
    void mouseReleaseEvent( QMouseEvent* );
    void captionChange( const QString& );
    void maximizeChange( bool m );
    void activeChange( bool );
    MousePosition mousePosition( const QPoint& p ) const;

protected slots:
    void menuButtonPressed();

private:
    CdeButton* button[BtnCount];
    QVBoxLayout* mainLayout;
    QHBoxLayout* titleLayout;
    QSpacerItem* titlebar;
    bool titlebarPressed;
};

};

#endif

