Source: /app/hbasic/hbasic/dialogs/icon_manager.h


Annotated List
Files
Globals
Hierarchy
Index
/* **************************************************************************
 File: icon_manager.h
 Desc: Icon manager widget.
 ----------------------------------------------------------------------------
	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.    */
/* ----------------------------------------------------------------------- */
/* CIconEditorWidget : Dialog to load and manage icons. */

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

#ifndef ICON_EDITOR_H
#define ICON_EDITOR_H

#include 
#include 
#include 
#include 
#include 

class QLabel;
class QPaintEvent;
class QFrame;
class QPopupMenu;
class IconTreeEntry;
class CIconEditorWindow;

#include "../hbdata/hbicon.h"
#include "../src/structs.h"

/* ---------------------------------------------------------------------- */
/**
 * @short Editor widget to select or load icon names.
 *
 * This is the editor widget of the icon editor.
 */

class CIconEditWidget : public QFrame
{
	Q_OBJECT

public:
	CIconEditWidget( CIconEditorWindow *parent, short initial_pixsize );

	/* Set current editor pixmap */
	void setCurrentPixmap( QPixmap *p, QImage *i );
	void setEditColor( QColor new_color );
	void setPixelSize( short new_pixel_size );
	void setDrawMode( short new_draw_mode );

private:
	/* # of display pixels for each icon pixel */
	short pix_size;
	short mouse_press_mode;
	short mouse_xstart;
	short mouse_ystart;
	CIconEditorWindow *parent_window;
	QColor edit_color;

	/* 0 = draw / 1 = get color */
	short draw_mode;
	QPixmap *current_pixmap;
	QImage *current_image;

	void paintEvent( QPaintEvent *p );
	void drawDetailedPixmap( QPainter *p );
	void drawPixel( short pix_xpos, short pix_ypos );
	void mousePressEvent( QMouseEvent *evt );
	void mouseReleaseEvent( QMouseEvent *evt );
	void mouseMoveEvent( QMouseEvent *evt );

public slots:
	void slotDrawLarger( void );
	void slotDrawSmaller( void );
};

/* ################################################################### */

/**
 * @short Entry in listview of icon editor.
 *
 * This entry is derived from QListViewItem and contains
 *  additional infos to manage the icon editor treeview.
 */

class IconTreeEntry : public QListViewItem
{
public:
	IconTreeEntry( QListView *parent, QString entry_text, void *new_struct_ptr );

	void *struct_ptr;
};

/* ################################################################### */

/**
 * @short Icon editor window.
 *
 * Use the icon editor to load images into your project that may be used
 *  in menubar and toolbar description.
 */


class CIconEditorWindow : public QDialog
{
	Q_OBJECT

public:
	QListView *lv_icon;

	CIconEditorWindow( QWidget *parent );
	~CIconEditorWindow();

	QFrame *color_widget;

protected:
	void resizeEvent( QResizeEvent *evt );
	void createIconEntries( void );
	QPixmap *createPixmapFromAction( HBIcon *action_ptr );

private:
	QPushButton *btn_quit;
	QPushButton *btn_add;

	/* Icon editor buttons */
	QPushButton *btn_color;
	QPushButton *btn_get_color;
	QPushButton *btn_larger;
	QPushButton *btn_smaller;
	CIconEditWidget *wgt_image;
	IconTreeEntry *current_icon_entry;
	CIconEditWidget *edit_image;

	QImage current_image;
	QPixmap current_pixmap;

	HBIcon *current_hbicon;

	/* ------------------------------------- */
	/* CIconEditorWindow :: Private methods. */

	void selectFirstItem( void );
	void saveCurrentIcon( void );

private slots:
	void slotQuit( void );
	void slotCreateIcon( void );
	void slotSelectColor( void );
	void slotGetColor( void );
	void slotIconSelection( QListViewItem *new_item );
	void slotRightMousePressed( QListViewItem *new_popup_item, const QPoint &pos, int num);
	void slotDropIcon( void );
};


#endif

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