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


Annotated List
Files
Globals
Hierarchy
Index
/* **************************************************************************
 File: mainwindow.h
 Desc: Main QMainWindow structure for HBasic.
 ----------------------------------------------------------------------------
	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 CMainWindow : QMainWindow widget for HBasic. 
 */
/* ----------------------------------------------------------------------- */
/* Changelog: Description of important changes within this file.           */
/*            Please report with date, maintainer and change description.  */
/* ----------------------------------------------------------------------- */

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include "defines.h"

// include files for QT
#ifdef INCLUDE_KDEUI
#include 
#else
#include 
#endif

class QAction;
class QString;
class QWorkspace;
class QPopupMenu;
class QToolBar;
class HBToolBar;
class Help;
class CMainWidget;
class ProjectTree;
class CWindowListChild;
class QAction;

/**
 * QMainWindow widget for HBasic. 
 */

/* MOC will fail if we define 2 class entries for QMainWIndow and KMainwindow */

class CMainWindow : public CLASS_MAINWIN
{
	Q_OBJECT

public:
	/** construtor */
	CMainWindow();

	short edit_tool;

	QAction *actionFileNew;
	QAction *actionFileOpen;
	QAction *actionFileLoadAscii;
	QAction *actionFileSave;
	QAction *actionFileSaveAscii;
	QAction *actionFileSaveAs;
	QAction *actionFilePrint;
	QAction *actionFileExit;

	QAction *actionEditUndo;
	QAction *actionEditRedo;
	QAction *actionEditCut;
	QAction *actionEditCopy;
	QAction *actionEditPaste;
	QAction *actionEditDelete;
	QAction *actionEditFind;
	QAction *actionEditFindNext;
	QAction *actionEditReplace;
	QAction *actionEditFold;
	QAction *actionEditUnfold;

	QAction *actionViewToolbar;
	QAction *actionViewTb1;
	QAction *actionViewTb2;
	QAction *actionViewTb3;
	QAction *actionViewTb4;
	QAction *actionViewTb5;
	QAction *actionViewTb6;

	QAction *actionViewStatusBar;
	QAction *actionViewOptions;
	QAction *actionViewPckgMgr;
	QAction *actionViewMenuEditWindow;
	QAction *actionViewDebugWindow;
	QAction *actionViewDbWindow;
	QAction *actionViewMacroWindow;
	QAction *actionViewMessageWindow;
	QAction *actionViewDirectWindow;
	QAction *actionViewProject;
	QAction *actionViewOptionsDlg;
	QAction *actionViewDbDesignWindow;
	QAction *actionViewComponent;
	QAction *actionViewProperty;
	QAction *actionViewSelect;

	QAction *actionDbSelect;
	QAction *actionDbTable;
	QAction *actionDbView;

	QAction *actionRunInterp;
	QAction *actionRunRestart;
	QAction *actionRunCompiler;
//	QAction *actionRunNetCompiler;
	QAction *actionRunStep;
	QAction *actionRunStepInto;
	QAction *actionRunCursor;
	QAction *actionRunEndsub;
	QAction *actionRunBreak;
	QAction *actionRunStop;

	QAction *actionAlignLeft;
	QAction *actionAlignHCenter;
	QAction *actionAlignRight;
	QAction *actionAlignTop;
	QAction *actionAlignVCenter;
	QAction *actionAlignBottom;

	QAction *actionHelpContent;
	QAction *actionWhatsThis;
	QAction *actionHelpAbout;

	/** file_menu contains all items of the menubar entry "File" */
	QPopupMenu *pFileMenu;
	/** edit_menu contains all items of the menubar entry "Edit" */
	QPopupMenu *pEditMenu;
	/** view_menu contains all items of the menubar entry "View" */
	QPopupMenu *pViewMenu;
	/** DbMenu contains all items of the menubar entry "Database" */
	QPopupMenu *pDbMenu;
	/** the window menu */
	QPopupMenu *pWindowMenu;
	/** run_menu contains all items of the menubar entry "Run" */
	QPopupMenu *pRunMenu;

	/** view_menu contains all items of the menubar entry "Help" */
	QPopupMenu *pHelpMenu;

	/* Load dialog as dynamic library into memory */
	short loadDynDialog( char *library_name );
	QWidget *isAFormDesignerChild( QObject *o );
	QWidget *isSourceEditorChild( QObject *o );
	QWidget *isWindowListChild( QObject *o );

	void createSubWindows();
	void printCurrentDocument( void );

	void enableMenuGroups( void );
	void startDbTableWizard( void );
	void showWindowMessage( char *message_text );

protected:
	/** event filter to catch close events for MDI child windows and is installed in createClient() on every child window.
	* Closing a window calls the eventFilter first which removes the view from the connected documents' view list. If the
	* last view is going to be closed, the eventFilter() tests if the document is modified; if yes, it asks the user to
	* save the document. If the document title contains "Untitled", slotFileSaveAs() gets called to get a save name and path.
	 */
	virtual bool eventFilter(QObject* object, QEvent* event);
	void openSelectWindow( QWidget *parent );
	void loadPackageList( void );
	void resizeEvent( QResizeEvent *evt );

	QFrame *border_frame;

/**
 * Start the SQL statement editor for SQL statement with name.
 */

	void editSQLStmt( QString *name );


/* ---------------------------------------------------------------------- */

public slots:

/**
 * Save the current project group to file and ask the user for filename.
 */
	void slotFileSaveAs();

/** 
 * Save a source in ascii form.
 */
	void slotFileSaveAscii();

/** 
 * Set compiler options for current project.
 */

	void slotCompOptions( void );

/**
 * Create a new Calculation sheet in the current project. 
 */
	void createNewCalcSheet( void );

/**
 * Start Undo or Redo opration.
 */

	void slotEditUndo();
	void slotEditRedo();

/* Open dialog to create new database table. */
	void slotCreateNewDbTable( void );

/* Open dialog to create new SQL statement. */
	void slotCreateNewSQLStmt( void );
/* Open dialog to create new DB query. */
	void slotCreateNewQuery( void );
/* Open dialog to create new DB report. */
	void slotCreateNewReport( void );

/* Open database connection edit dialog. */
	void openDlgDbPassword( void );

/* Create new DbDesigner window. */
void slotViewDbDesignWindow();

/* Create new macro window */
void slotViewMacroWindow( void );

/* Create new message window */
void slotViewMessageWindow( void );

/* Create new direct window */
void slotViewDirectWindow();

void showTableEditor( QString *table_name );

/* Entry in toolbar has been clicked */
void slotToolBarClicked( void );

/** 
 * Generate a new Source / Form in the current project 
 */
	void slotFileNew();

/**
 * Exit the HBasic application.
 */
	void slotFileQuit( void );
	/** Print current document */
	void slotFilePrint();

	/** put the marked text/object into the clipboard and remove
	* it from the document */
	void slotEditCut();
	/** put the marked text/object into the clipboard*/
	void slotEditCopy();
	/** paste the clipboard into the document*/
	void slotEditPaste();
	/** Delete the contents of the marked block */
	void slotEditDelete();
	/** find a string in the source file */
	void slotEditFind();
	/** Repeat last search from cursor position */
	void slotEditFindNext();
	/* Edit icon entries from icon list */
	void dlgEditIcon( void );
	/** Replace a string in the source file */
	void slotEditReplace();
	/** Fold all source lines in current document */
	void slotEditFold();
	/** Unfold all source lines in current document */
	void slotEditUnfold();
	/** run the parser to create interpretable program*/
	void slotRunInterpreter( void );
	/** run the parser to create executable program*/
	void slotRunCompiler( void );
	/** run the compiler to create net program */
//	void slotRunNetCompiler( void );
	/** Restart the interpreter after break. */
	void slotRunRestart( void );
	/** Execute one single interpreter step. */
	void slotStepOver( void );
	/** Execute one single interpreter step (step into subs). */
	void slotStepIn( void );
	/** Execute interpreter until cursor position. */
	void slotRunCursor( void );
	/** Execute interpreter until end of current subroutine. */
	void slotStepOut( void );
	/** Terminate program execution and program. */
	void slotRunStop( void );
	/** Open a new document from file.  */
	void slotFileOpen( void );
	/** Load a source in ascii form.  */
	void slotFileLoadAscii();
	/** Save the current project group to file.  */
	void slotFileSave();

	/* Open Options dialog */
	void slotViewOptionsDlg();
	/* Open menuedit dialog */
	void slotViewMenuWindow();
	/* Open Package manager dialog */
	void slotViewPckgmgr();
	/* Open/Close project window. */
	void slotViewWindowProject();
	/* Open/Close property editor. */
	void slotViewWindowProperty();
	/* Open/Close component selection. */
	void slotViewWindowComponent();
	/* Show new debug window. */
	void slotViewDebugWindow();

	/* Toggle toolbars on/off. */
	void slotToggleFileTb(void );
	void slotToggleEditTb(void );
	void slotToggleRunTb(void );
	void slotToggleWinTb(void );
	void slotToggleAlignTb(void );
	void slotToggleHelpTb(void );

	/* Align GUI items to left side. */
	void slotAlignLeft( void );
	void slotAlignRight( void );
	void slotAlignHCenter( void );
	void slotAlignTop( void );
	void slotAlignBottom( void );
	void slotAlignVCenter( void );

	/** change the status message of the whole statusbar temporary */
	void slotStatusHelpMsg(const QString &text);
	void slotHelpContent();
	void slotHelpAbout();

	/** gets called when the window menu is activated; recreates the window menu with all opened window titles. */
	void windowMenuAboutToShow();
	/** activates the MDI child widget when it gets selected from the window menu. */
	void windowMenuActivated( int id );

	void createNewIcon( void );

private:
	short projecttree_visible;
	short components_visible;
	Help *help;   /* Help window pointer */
	/** initMenuBar creates the menu_bar and inserts the menuitems */
	void initMenuBar();
	/* this creates the toolbars. Change the toolbar look and add */
	/* new toolbars in this function */
	void initToolBar();
	/** setup the mainview*/
	void initView();
	CWindowListChild *isASubWindow( QObject *o );
	HBToolBar *createToolBar( char *name, int flagpos );

	QToolBar *mainToolbar;
		
		/** pWorkspace is the MDI frame widget that handles MDI child widgets. Inititalized in
		 * initView()
		 */
	QWorkspace *pWorkspace;

	/* Starting address for dynamically loaded dialog */
	void (*start_dyn_dlg)( void );
	void *dyn_dlg_lib_handle;

	QWidget *lastPressWidget;    /* Widget pressed in form window. */

		/** a counter that gets increased each time the user creates a new document with "File"->"New" */
	int untitledCount;
	/** a list of all open documents. If the last window of a document gets closed, the installed eventFilter
	* removes this document from the list. The document list is checked for modified documents when the user
	* is about to close the application. */
	//    QList *pDocList;	

};

#endif 


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