Source: /app/hbasic/hbasic/src/sizehandle.h


Annotated List
Files
Globals
Hierarchy
Index
/* **************************************************************************
 File:
 Desc: 
 ----------------------------------------------------------------------------
	copyright            : (C) 2001 HBasic project (Marcus Engels)
 ***************************************************************************/

/* **************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/

/* ----------------------------------------------------------------------- */
/* Classlist: List of classes that will be defined in this source file.    */
/* ----------------------------------------------------------------------- */

/* ----------------------------------------------------------------------- */
/* Changelog: Description of important changes within this file.           */
/*            Please report with date, maintainer and change description.  */
/* ----------------------------------------------------------------------- */

#ifndef SIZEHANDLE_H
#define SIZEHANDLE_H

#include 
#include 
#include 

class QMouseEvent;
class FormDesigner;
class WidgetSelection;
class QPaintEvent;

class SizeHandle : public QWidget
{
    Q_OBJECT

public:
	enum Direction { LeftTop, Top, RightTop, Right, RightBottom, Bottom, LeftBottom, Left };

	SizeHandle( FormDesigner *parent, Direction d, WidgetSelection *s );
	void setWidget( QWidget *w );
	void setActive( bool a );
	void updateCursor();

	void setEnabled( bool ) {}

protected:
	void paintEvent( QPaintEvent *e );
	void mousePressEvent( QMouseEvent *e );
	void mouseMoveEvent( QMouseEvent *e );
	void mouseReleaseEvent( QMouseEvent *e );

private:
	void trySetGeometry( QWidget *w, int x, int y, int width, int height );
	void tryResize( QWidget *w, int width, int height );

private:
	QWidget *widget;
	Direction dir;
	QPoint oldPressPos;
	FormDesigner *formWindow;
	WidgetSelection *sel;
	QRect geom, origGeom;
	bool active;
};

class WidgetSelection
{
public:
	WidgetSelection( FormDesigner *parent, QPtrDict *selDict );

	void setWidget( QWidget *w, bool updateDict = TRUE );
	bool isUsed() const;

	void updateGeometry();
	void hide();
	void show();
	void update();
    
	QWidget *widget() const;

protected:
	QIntDict handles;
	QWidget *wid;
	FormDesigner *formWindow;
	QPtrDict *selectionDict;
};

#endif

Generated by: root on linux on Sun Jul 13 18:06:35 2003, using kdoc 2.0a54.