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


Annotated List
Files
Globals
Hierarchy
Index
/* **************************************************************************
 File: formdesigner.h
 Desc: Designer widget to edit gui structures.
 ----------------------------------------------------------------------------
	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.    */
/* ----------------------------------------------------------------------- */
/*
 * class FormDesigner: Designer widget to edit GUI structures.
 */

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

#ifndef FORMDESIGNER_H
#define FORMDESIGNER_H

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

class CWindowListChild;
class CBasicDocument;
class FormDesigner;
class WidgetSelection;

// class KSimpleConfig;

#include "structs.h"
#include "window_list.h"
#include "form_desc_data.h"

/**
 * class FormDesigner: Designer widget to edit GUI structures.
 */

class FormDesigner : public CWindowListChild
{
	Q_OBJECT

public:
	FormDesigner( QWidget *parent, CBasicDocument *srcptr);
	~FormDesigner();

	/* Description of form data */
	CFormDescData *form_desc;

	CBasicDocument *src_doc_ptr;
	GUI_HEADER *propertyComponent;

	void setComponentProperty( GUI_HEADER *comp_ptr, char *prop_name,
		QVariant *new_value, short prop_type);

	virtual QPoint gridPoint( const QPoint &p );
	QPoint grid( void );
	void selectWidget( QWidget *w, bool select = TRUE );
	void updateSelection( QWidget *w );
	void raiseSelection( QWidget *w );
	void repaintSelection( QWidget *w );
	void clearSelection( bool changePropertyDisplay = TRUE );
	void selectWidgets();
	bool isWidgetSelected( QWidget *w );
	void updateChildSelections( QWidget *w );
	void raiseChildSelections( QWidget *w );
	virtual void emitUpdateProperties( QWidget *w );
	virtual void emitShowProperties( QWidget *w = 0 );
	virtual void emitSelectionChanged();

	virtual void setPropertyShowingBlocked( bool b );
	bool isPropertyShowingBlocked() const;
	GUI_HEADER *findWidgetHeader( QWidget *wgt );
	void changeSelectedComponents( char *prop_name, QVariant *new_value );

	virtual QLabel *sizePreview() const;
	void alignItems( int align_type );

	void handleMousePress( QMouseEvent *e, QWidget *w );
	void handleDblClick( QMouseEvent *e, QWidget *w );
	void handleMouseRelease( QMouseEvent *e, QWidget *w );
	void handleMouseMove( QMouseEvent *e, QWidget *w );

	virtual int numSelectedWidgets() const;
	void checkPreviewGeometry( QRect &r );

	QWidget *currentWidget() const { return propertyWidget; }

	bool isMainContainer( QWidget *w );
	void paintEvent( QPaintEvent *evt );

signals:
	void showProperties( QWidget *w );
	void updateProperties( QWidget *w );
	void selectionChanged();

private:
	QWidget* createSelectedComponent( QWidget* parent,
		short xpos, short ypos, short width, short height );
	PROP_DESC *findComponentProperty( GUI_HEADER *comp_ptr, char *prop_name);
	void resizeEvent( QResizeEvent *evt );

	enum RectType { Insert, Rubber };

	void beginUnclippedPainter( bool doNot );
	void endUnclippedPainter();
	void drawSizePreview( const QPoint &pos, const QString& text );
	void moveSelectedWidgets( int dx, int dy );
	void startRectDraw( const QPoint &p, const QPoint &global, QWidget *w, RectType t );
	void continueRectDraw( const QPoint &p, const QPoint &global, QWidget *w, RectType t );
	void endRectDraw();
	QWidget *mainContainer( void );
	void checkSelectionsForMove( QWidget *w );
	bool allowMove( QWidget *w );
	void popupWidgetMenu( QPoint mouse_pos );

private:
	int currTool;
	bool oldRectValid, widgetPressed, drawRubber, checkedSelectionsForMove;
	QRect currRect;
	QPoint rectAnchor;
	QPainter *unclippedPainter;
	QPoint sizePreviewPos;
	QPixmap *sizePreviewPixmap;
	QPtrList selections;
	QPtrDict usedSelections;
	QRect widgetGeom, rubber;
	QPoint oldPressPos, origPressPos;
	QWidget *insertParent, *propertyWidget;
	QMap moving;
	QLabel *sizePreviewLabel;
	QTimer *checkSelectionsTimer;
	QPtrDict insertedWidgets;
	bool propShowBlocked;
	QTimer *updatePropertiesTimer;
	QTimer *showPropertiesTimer;
	QTimer *selectionChangedTimer,
	*windowsRepaintWorkaroundTimer;
	QPoint connectStartPos, currentConnectPos;
	QObject *connectSender, *connectReceiver;
	QString filename;
	QPixmap *buffer;
	QWidgetList orderedWidgets;
	QWidgetList stackedWidgets;
	QWidget *mContainer;
	bool pixInline;
	QString pixLoader;
	bool toolFixed;

private slots:
	virtual void invalidCheckedSelections();
	virtual void updatePropertiesTimerDone();
	virtual void showPropertiesTimerDone();
	virtual void selectionChangedTimerDone();
	void slotDeleteWidget( void );
	void slotRaiseWidget( void );
	void slotLowerWidget( void );
};

#endif

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