2010-08-02 14:49 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
- contrib/hbqt/gtqtc
- Deleted experimental GT written for QT API.
This commit is contained in:
@@ -16,6 +16,10 @@
|
||||
The license applies to all entries newer than 2009-04-28.
|
||||
*/
|
||||
|
||||
2010-08-02 14:49 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
|
||||
- contrib/hbqt/gtqtc
|
||||
- Deleted experimental GT written for QT API.
|
||||
|
||||
2010-08-02 14:47 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* contrib/hbqt/qscintilla/hbqscintilla.hbc
|
||||
+ Added libname.
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
gtqtc.cpp
|
||||
gtqtc.h
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,349 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
*
|
||||
* Copyright 2009 Pritpal Bedi <pritpal@vouchcac.com>
|
||||
* www - http://harbour-project.org
|
||||
*
|
||||
* 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, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
|
||||
*
|
||||
* As a special exception, the Harbour Project gives permission for
|
||||
* additional uses of the text contained in its release of Harbour.
|
||||
*
|
||||
* The exception is that, if you link the Harbour libraries with other
|
||||
* files to produce an executable, this does not by itself cause the
|
||||
* resulting executable to be covered by the GNU General Public License.
|
||||
* Your use of that executable is in no way restricted on account of
|
||||
* linking the Harbour library code into it.
|
||||
*
|
||||
* This exception does not however invalidate any other reasons why
|
||||
* the executable file might be covered by the GNU General Public License.
|
||||
*
|
||||
* This exception applies only to the code released by the Harbour
|
||||
* Project under the name Harbour. If you copy code from other
|
||||
* Harbour Project or Free Software Foundation releases into a copy of
|
||||
* Harbour, as the General Public License permits, the exception does
|
||||
* not apply to the code that you add in this way. To avoid misleading
|
||||
* anyone as to the status of such modified files, you must delete
|
||||
* this exception notice from them.
|
||||
*
|
||||
* If you write modifications of your own for Harbour, it is your choice
|
||||
* whether to permit this exception to apply to your modifications.
|
||||
* If you do not wish that, delete this exception notice.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HB_QTC_H_
|
||||
|
||||
#define HB_QTC_H_
|
||||
|
||||
#define HB_GT_NAME QTC
|
||||
|
||||
#include <QtGui/QtGui>
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QList>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QMainWindow>
|
||||
#include <QtGui/QDesktopWidget>
|
||||
#include <QtGui/QWidget>
|
||||
#include <QtGui/QFont>
|
||||
#include <QtGui/QPainter>
|
||||
#include <QtGui/QPaintDevice>
|
||||
#include <QtGui/QColor>
|
||||
#include <QtGui/QKeyEvent>
|
||||
#include <QtGui/QMouseEvent>
|
||||
#include <QtGui/QClipboard>
|
||||
#include <QtCore/QThread>
|
||||
#include <QtCore/QTextCodec>
|
||||
|
||||
#include "hbset.h"
|
||||
#include "hbgtcore.h"
|
||||
#include "hbapicdp.h"
|
||||
#include "hbapierr.h"
|
||||
#include "hbapiitm.h"
|
||||
#include "inkey.ch"
|
||||
#include "hbvm.h"
|
||||
#include "hbthread.h"
|
||||
|
||||
#include "hbgtqtc.ch"
|
||||
|
||||
#define WVT_CHAR_QUEUE_SIZE 4096 // 128
|
||||
#define WVT_MAX_TITLE_SIZE 128
|
||||
#define WVT_MAX_ROWS 256
|
||||
#define WVT_MAX_COLS 256
|
||||
#define WVT_MAX_WINDOWS 256
|
||||
#define WVT_DEFAULT_ROWS 25
|
||||
#define WVT_DEFAULT_COLS 80
|
||||
#define WVT_DEFAULT_FONT_HEIGHT 20
|
||||
#define WVT_DEFAULT_FONT_WIDTH 10
|
||||
#define WVT_DEFAULT_FONT_NAME "Courier New"
|
||||
|
||||
#define QQRGB( r,g,b ) ( qRgb( r,g,b ) )
|
||||
|
||||
#define C_BLACK RGB( 0x0 ,0x0 ,0x0 )
|
||||
#define C_BLUE RGB( 0x0 ,0x0 ,0x85 )
|
||||
#define C_GREEN RGB( 0x0 ,0x85,0x0 )
|
||||
#define C_CYAN RGB( 0x0 ,0x85,0x85 )
|
||||
#define C_RED RGB( 0x85,0x0 ,0x0 )
|
||||
#define C_MAGENTA RGB( 0x85,0x0 ,0x85 )
|
||||
#define C_BROWN RGB( 0x85,0x85,0x0 )
|
||||
#define C_WHITE RGB( 0xC6,0xC6,0xC6 )
|
||||
#define C_LIGHT_GRAY RGB( 0x60,0x60,0x60 )
|
||||
#define C_BRIGHT_BLUE RGB( 0x00,0x00,0xFF )
|
||||
#define C_BRIGHT_GREEN RGB( 0x60,0xFF,0x60 )
|
||||
#define C_BRIGHT_CYAN RGB( 0x60,0xFF,0xFF )
|
||||
#define C_BRIGHT_RED RGB( 0xF8,0x00,0x26 )
|
||||
#define C_BRIGHT_MAGENTA RGB( 0xFF,0x60,0xFF )
|
||||
#define C_YELLOW RGB( 0xFF,0xFF,0x00 )
|
||||
#define C_BRIGHT_WHITE RGB( 0xFF,0xFF,0xFF )
|
||||
|
||||
#define BLACK QQRGB( 0x0 ,0x0 ,0x0 )
|
||||
#define BLUE QQRGB( 0x0 ,0x0 ,0x85 )
|
||||
#define GREEN QQRGB( 0x0 ,0x85,0x0 )
|
||||
#define CYAN QQRGB( 0x0 ,0x85,0x85 )
|
||||
#define RED QQRGB( 0x85,0x0 ,0x0 )
|
||||
#define MAGENTA QQRGB( 0x85,0x0 ,0x85 )
|
||||
#define BROWN QQRGB( 0x85,0x85,0x0 )
|
||||
#define WHITE QQRGB( 0xC6,0xC6,0xC6 )
|
||||
#define LIGHT_GRAY QQRGB( 0x60,0x60,0x60 )
|
||||
#define BRIGHT_BLUE QQRGB( 0x00,0x00,0xFF )
|
||||
#define BRIGHT_GREEN QQRGB( 0x60,0xFF,0x60 )
|
||||
#define BRIGHT_CYAN QQRGB( 0x60,0xFF,0xFF )
|
||||
#define BRIGHT_RED QQRGB( 0xF8,0x00,0x26 )
|
||||
#define BRIGHT_MAGENTA QQRGB( 0xFF,0x60,0xFF )
|
||||
#define YELLOW QQRGB( 0xFF,0xFF,0x00 )
|
||||
#define BRIGHT_WHITE QQRGB( 0xFF,0xFF,0xFF )
|
||||
|
||||
/* xHarbour compatible definitions */
|
||||
#if !defined( K_SH_LEFT )
|
||||
#define K_SH_LEFT K_LEFT /* Shift-Left == Left */
|
||||
#define K_SH_UP K_UP /* Shift-Up == Up */
|
||||
#define K_SH_RIGHT K_RIGHT /* Shift-Right == Right */
|
||||
#define K_SH_DOWN K_DOWN /* Shift-Down == Down */
|
||||
#define K_SH_INS K_INS /* Shift-Ins == Ins */
|
||||
#define K_SH_DEL K_DEL /* Shift-Del == Del */
|
||||
#define K_SH_HOME K_HOME /* Shift-Home == Home */
|
||||
#define K_SH_END K_END /* Shift-End == End */
|
||||
#define K_SH_PGUP K_PGUP /* Shift-PgUp == PgUp */
|
||||
#define K_SH_PGDN K_PGDN /* Shift-PgDn == PgDn */
|
||||
#define K_SH_RETURN K_RETURN /* Shift-Enter == Enter */
|
||||
#define K_SH_ENTER K_ENTER /* Shift-Enter == Enter */
|
||||
#endif
|
||||
|
||||
#ifndef WM_MOUSEWHEEL
|
||||
# define WM_MOUSEWHEEL 0x020A
|
||||
#endif
|
||||
#ifndef WM_ENTERSIZEMOVE
|
||||
# define WM_ENTERSIZEMOVE 561
|
||||
#endif
|
||||
#ifndef WM_EXITSIZEMOVE
|
||||
# define WM_EXITSIZEMOVE 562
|
||||
#endif
|
||||
|
||||
#ifndef SWP_DEFERERASE
|
||||
# define SWP_DEFERERASE 0x2000
|
||||
#endif
|
||||
#ifndef SW_NORMAL
|
||||
# define SW_NORMAL 1
|
||||
#endif
|
||||
#ifndef SC_MAXIMIZE
|
||||
# define SC_MAXIMIZE 0xF030
|
||||
#endif
|
||||
|
||||
#define SYS_EV_MARK 1000
|
||||
|
||||
void hb_ToOutDebug( const char * sTraceMsg, ... );
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
class MainWindow;
|
||||
|
||||
class DrawingArea : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DrawingArea( QWidget *parent = 0 );
|
||||
virtual ~DrawingArea( void );
|
||||
|
||||
PHB_GT pGT;
|
||||
|
||||
void resetWindowSize( void );
|
||||
void redrawBuffer( const QRect & rect );
|
||||
|
||||
bool createCaret( int iWidth, int iHeight );
|
||||
void showCaret( void );
|
||||
void hideCaret( void );
|
||||
void setCaretPos( int iRow, int iCol );
|
||||
void destroyCaret();
|
||||
|
||||
void displayCell( int iRow, int iCol );
|
||||
void displayBlock( int iRow, int iCol );
|
||||
void resizeImage( const QSize &newSize );
|
||||
void drawBoxCharacter( QPainter *painter, HB_USHORT usChar, int iColor, int x, int y );
|
||||
void copyTextOnClipboard( void );
|
||||
void paintCopyOperation( void );
|
||||
|
||||
QImage *_image;
|
||||
QFont _qFont;
|
||||
|
||||
QRgb _COLORS[ 16 ];
|
||||
|
||||
int _fontHeight;
|
||||
int _fontWidth;
|
||||
int _fontAscent;
|
||||
|
||||
int _iROWS, _iCOLS;
|
||||
int _wndWidth, _wndHeight;
|
||||
|
||||
int _crtHeight;
|
||||
int _crtWidth;
|
||||
bool _bBlinking;
|
||||
int _crtLastRow;
|
||||
int _crtLastCol;
|
||||
|
||||
bool _bFirst;
|
||||
bool _bSizing;
|
||||
bool _bInvertRect;
|
||||
|
||||
bool _bCopying;
|
||||
QRect _rCopying;
|
||||
QRect _rCopyingP;
|
||||
|
||||
QBasicTimer *_basicTimer;
|
||||
|
||||
protected:
|
||||
void keyPressEvent( QKeyEvent *event );
|
||||
void keyReleaseEvent( QKeyEvent *event );
|
||||
void mousePressEvent( QMouseEvent *event );
|
||||
void mouseMoveEvent( QMouseEvent *event );
|
||||
void mouseReleaseEvent( QMouseEvent *event );
|
||||
void mouseDoubleClickEvent( QMouseEvent * event );
|
||||
void paintEvent( QPaintEvent *event );
|
||||
void resizeEvent( QResizeEvent *event );
|
||||
void wheelEvent( QWheelEvent *event );
|
||||
void timerEvent( QTimerEvent *event );
|
||||
void focusInEvent( QFocusEvent *event );
|
||||
void focusOutEvent( QFocusEvent *event );
|
||||
void moveEvent( QMoveEvent *event );
|
||||
bool event( QEvent *event );
|
||||
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MainWindow();
|
||||
virtual ~MainWindow();
|
||||
|
||||
DrawingArea *_drawingArea;
|
||||
PHB_GT pGT;
|
||||
|
||||
void setWindowSize( void );
|
||||
|
||||
protected:
|
||||
void closeEvent( QCloseEvent *event );
|
||||
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
PHB_GT pGT; /* core GT pointer */
|
||||
int iHandle; /* window number */
|
||||
|
||||
QApplication *qApplctn;
|
||||
MainWindow *qWnd;
|
||||
QFont *qFont;
|
||||
QFont *qFontBox;
|
||||
QEventLoop *qEventLoop;
|
||||
|
||||
int iCmdShow;
|
||||
|
||||
int ROWS; /* number of displayable rows in window */
|
||||
int COLS; /* number of displayable columns in window */
|
||||
|
||||
bool CaretExist; /* TRUE if a caret has been created */
|
||||
bool CaretHidden; /* TRUE if a caret has been hiden */
|
||||
int CaretSize; /* Height of solid caret */
|
||||
int CaretWidth; /* Width of solid caret */
|
||||
|
||||
QPoint MousePos; /* the last mouse position */
|
||||
bool MouseMove; /* Flag to say whether to return mouse movement events */
|
||||
|
||||
int Keys[ WVT_CHAR_QUEUE_SIZE ]; /* Array to hold the characters & events */
|
||||
int keyPointerIn; /* Offset into key array for character to be placed */
|
||||
int keyPointerOut; /* Offset into key array of next character to read */
|
||||
int keyLast; /* last inkey code value in buffer */
|
||||
|
||||
QPoint PTEXTSIZE; /* size of the fixed width font */
|
||||
bool FixedFont; /* TRUE if current font is a fixed font */
|
||||
int FixedSize[ WVT_MAX_COLS ]; /* buffer for ExtTextOut() to emulate fixed pitch when Proportional font selected */
|
||||
int fontHeight; /* requested font height */
|
||||
int fontWidth; /* requested font width */
|
||||
int fontWeight; /* Bold level */
|
||||
int fontQuality; /* requested font quality */
|
||||
char fontFace[ WVT_MAX_COLS ]; /* requested font face name LF_FACESIZE #defined in wingdi.h */
|
||||
|
||||
bool fInit; /* logical variable indicating that window should be open */
|
||||
|
||||
PHB_CODEPAGE hostCDP; /* Host/HVM CodePage for unicode output translations */
|
||||
PHB_CODEPAGE inCDP; /* Host/HVM CodePage for unicode input translations */
|
||||
|
||||
QIcon qIcon; /* Title Bar and Task List icon. Can be NULL. */
|
||||
bool bIconToFree; /* Do we need to free this icon when it's not NULL? */
|
||||
|
||||
int CodePage; /* Code page to use for display characters */
|
||||
bool AltF4Close; /* Can use Alt+F4 to close application */
|
||||
bool CenterWindow; /* True if window is to be Reset into centre of window */
|
||||
|
||||
bool bMaximized; /* Flag is set when window has been maximized */
|
||||
bool bBeingMarked; /* Flag to control DOS window like copy operation */
|
||||
bool bBeginMarked;
|
||||
|
||||
bool bResizable;
|
||||
bool bSelectCopy;
|
||||
char * pszSelectCopy;
|
||||
bool bClosable;
|
||||
|
||||
int ResizeMode; /* Sets the resizing mode either to FONT or ROWS */
|
||||
bool bResizing;
|
||||
bool bAlreadySizing;
|
||||
|
||||
#if defined( UNICODE )
|
||||
PHB_CODEPAGE boxCDP; /* CodePage for legacy drawing chars: IBM437 */
|
||||
#endif
|
||||
|
||||
#if !defined( UNICODE )
|
||||
HB_BYTE keyTransTbl[ 256 ];
|
||||
HB_BYTE chrTransTbl[ 256 ];
|
||||
#endif
|
||||
|
||||
} HB_GTWVT, * PHB_GTWVT;
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#endif /* HB_QTC_H_ */
|
||||
@@ -1,10 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
../hbqt_common.hbc
|
||||
../hbqtcore.hbc
|
||||
../hbqtgui.hbc
|
||||
|
||||
{!HB_QT_STATIC}gt=${hb_name}
|
||||
{HB_QT_STATIC}gt=${hb_name}s
|
||||
@@ -1,11 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
../hbqt_common.hbm
|
||||
|
||||
filelist.hbm
|
||||
|
||||
-instfile=inc:hbgtqtc.ch
|
||||
|
||||
gtqtcs.hbp
|
||||
@@ -1,11 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
../hbqt_common.hbm
|
||||
|
||||
filelist.hbm
|
||||
|
||||
-stop{!HB_QT_BUILD_STATIC|!allwin}
|
||||
|
||||
-cflag=-DQT_NODLL
|
||||
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* Header file for the GTQTC
|
||||
*
|
||||
* Copyright 2009 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* www - http://harbour-project.org
|
||||
*
|
||||
* 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, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
|
||||
*
|
||||
* As a special exception, the Harbour Project gives permission for
|
||||
* additional uses of the text contained in its release of Harbour.
|
||||
*
|
||||
* The exception is that, if you link the Harbour libraries with other
|
||||
* files to produce an executable, this does not by itself cause the
|
||||
* resulting executable to be covered by the GNU General Public License.
|
||||
* Your use of that executable is in no way restricted on account of
|
||||
* linking the Harbour library code into it.
|
||||
*
|
||||
* This exception does not however invalidate any other reasons why
|
||||
* the executable file might be covered by the GNU General Public License.
|
||||
*
|
||||
* This exception applies only to the code released by the Harbour
|
||||
* Project under the name Harbour. If you copy code from other
|
||||
* Harbour Project or Free Software Foundation releases into a copy of
|
||||
* Harbour, as the General Public License permits, the exception does
|
||||
* not apply to the code that you add in this way. To avoid misleading
|
||||
* anyone as to the status of such modified files, you must delete
|
||||
* this exception notice from them.
|
||||
*
|
||||
* If you write modifications of your own for Harbour, it is your choice
|
||||
* whether to permit this exception to apply to your modifications.
|
||||
* If you do not wish that, delete this exception notice.
|
||||
*
|
||||
*/
|
||||
|
||||
/* NOTE: This file is also used by C code. */
|
||||
|
||||
#ifndef _HBGTQTC_CH
|
||||
#define _HBGTQTC_CH
|
||||
|
||||
#define HB_GTI_QTCODEC 90 /* Instructs gtqtc to request for code page conversion class off Qt */
|
||||
|
||||
#endif /* _HBGTQTC_CH */
|
||||
@@ -1,474 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
//----------------------------------------------------------------------//
|
||||
//----------------------------------------------------------------------//
|
||||
//----------------------------------------------------------------------//
|
||||
//
|
||||
// [x]Harbour Extended Features Deno
|
||||
// .
|
||||
// Pritpal Bedi <pritpal@vouchcac.com>
|
||||
//
|
||||
//----------------------------------------------------------------------//
|
||||
//----------------------------------------------------------------------//
|
||||
//----------------------------------------------------------------------//
|
||||
|
||||
#include "hbgtinfo.ch"
|
||||
#include "inkey.ch"
|
||||
#include "box.ch"
|
||||
|
||||
#define RGB(r,g,b) ( r + ( g * 256 ) + ( b * 256 * 256 ) )
|
||||
|
||||
//----------------------------------------------------------------------//
|
||||
|
||||
// To be in hbgtinfo.ch
|
||||
//
|
||||
#define HB_GTI_SETPARENT 101
|
||||
#define HB_GTI_WINHANDLE 102
|
||||
|
||||
//----------------------------------------------------------------------//
|
||||
|
||||
STATIC nRows := 20, nCols := 60, nColorIndex := 1
|
||||
|
||||
//----------------------------------------------------------------------//
|
||||
|
||||
FUNCTION Main()
|
||||
Local nKey, lMark, lResize, lClose
|
||||
LOCAL cVar := ' '
|
||||
LOCAL cVar1 := ' '
|
||||
LOCAL getlist := {}
|
||||
#if 0
|
||||
Local nHeight := 20
|
||||
Local nWidth := Int( nHeight/2 )
|
||||
Local cFont := 'Courier New'
|
||||
#endif
|
||||
Local nn := 0
|
||||
Local cc := 'abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmn'
|
||||
|
||||
SET SCOREBOARD OFF
|
||||
|
||||
#if 0
|
||||
Hb_GtInfo( HB_GTI_FONTNAME , cFont )
|
||||
Hb_GtInfo( HB_GTI_FONTWIDTH, nWidth )
|
||||
Hb_GtInfo( HB_GTI_FONTSIZE , nHeight )
|
||||
#endif
|
||||
|
||||
Hb_GtInfo( HB_GTI_CODEPAGE, 255 )
|
||||
SetCursor( 0 )
|
||||
SetColor( "n/w" )
|
||||
|
||||
DispScreen()
|
||||
|
||||
Hb_GtInfo( HB_GTI_ICONFILE, 'test.ico' )
|
||||
|
||||
DO WHILE .T.
|
||||
nKey := Inkey(0.1, INKEY_ALL )
|
||||
if nKey == K_ESC
|
||||
exit
|
||||
ENDIF
|
||||
#if 0
|
||||
IF nKey != 0
|
||||
hb_OutDebug( "nKey %i %s", nKey, chr( nKey ) )
|
||||
ENDIF
|
||||
#endif
|
||||
IF nn < 80
|
||||
@ maxrow()-1, nn SAY substr( cc, nn+1, 1 )
|
||||
nn++
|
||||
endif
|
||||
|
||||
DO CASE
|
||||
CASE nKey == K_ENTER
|
||||
Alert( "<Enter> Pressed" )
|
||||
|
||||
CASE nKey == K_F2
|
||||
lMark := Hb_GtInfo( HB_GTI_SELECTCOPY )
|
||||
Hb_GtInfo( HB_GTI_SELECTCOPY, !lMark )
|
||||
|
||||
CASE nKey == K_F3
|
||||
lResize := Hb_GtInfo( HB_GTI_RESIZABLE )
|
||||
Hb_GtInfo( HB_GTI_RESIZABLE, !lResize )
|
||||
|
||||
CASE nKey == K_F4
|
||||
lClose := Hb_GtInfo( HB_GTI_CLOSABLE )
|
||||
hb_GtInfo( HB_GTI_CLOSABLE, !lClose )
|
||||
|
||||
CASE nKey == K_F5
|
||||
SetPalette( 1 )
|
||||
|
||||
CASE nKey == K_F6
|
||||
SetPalette( 0 )
|
||||
|
||||
CASE nKey == K_F7
|
||||
SetPaletteIndex()
|
||||
|
||||
CASE nKey == K_F8
|
||||
#include "setcurs.ch"
|
||||
SetCursor( 2 )
|
||||
SetKey( K_F12, {|| SetCursor( 2 ) } )
|
||||
@ maxrow()-6, 5 GET cVar COLOR 'W+/B'
|
||||
@ maxrow()-5, 5 GET cVar1 COLOR 'W+/R'
|
||||
READ
|
||||
@ maxrow()-3, 5 SAY cVar COLOR 'W+/W'
|
||||
|
||||
ENDCASE
|
||||
ENDDO
|
||||
|
||||
RETURN NIL
|
||||
//----------------------------------------------------------------------//
|
||||
STATIC FUNCTION MyNotifier( nEvent, ... )
|
||||
|
||||
DO CASE
|
||||
|
||||
CASE nEvent == HB_GTE_SETFOCUS
|
||||
DispScreen()
|
||||
DispOutAt( maxrow(), 35, "In Focus", "B/G*" )
|
||||
|
||||
CASE nEvent == HB_GTE_KILLFOCUS
|
||||
DispScreen()
|
||||
DispOutAt( maxrow(), 35, "Out Focus", "B/G*" )
|
||||
|
||||
CASE nEvent == HB_GTE_CLOSE
|
||||
DispScreen()
|
||||
if Alert( "Close Application", {"Yes","No" } ) == 2
|
||||
Return 1
|
||||
endif
|
||||
|
||||
ENDCASE
|
||||
|
||||
RETURN 0
|
||||
//----------------------------------------------------------------------//
|
||||
STATIC FUNCTION DispScreen()
|
||||
Local nRow := 12, nCol := 28
|
||||
Local cColor := "N/W"
|
||||
Local nMaxCol := MaxCol()+1
|
||||
|
||||
DispBegin()
|
||||
|
||||
CLS
|
||||
DispOutAt( 0, 0,padc( "Harbour GTQTC - QT based Terminal Driver", maxcol()+1 ), "N/GR*" )
|
||||
|
||||
// Contributed by Massimo Belgrano
|
||||
DispOutAt( 2, 0, padc( "______ __ ______________________ ",nMaxCol ), "W+/W" )
|
||||
DispOutAt( 3, 0, padc( "___ / / /_____ ___________ /___________ _________ __ ____/____/",nMaxCol ), "W+/W" )
|
||||
DispOutAt( 4, 0, padc( "__ /_/ /_ __ `/_ ___/_ __ \ __ \ / / /_ ___/ _ / __ __/ ",nMaxCol ), "W+/W" )
|
||||
DispOutAt( 5, 0, padc( "_ __ / / /_/ /_ / _ /_/ / /_/ / /_/ /_ / / /_/ / _ / ",nMaxCol ), "W+/W" )
|
||||
DispOutAt( 6, 0, padc( "/_/ /_/ \__,_/ /_/ /_.___/\____/\__,_/ /_/ \____/ /_/ ",nMaxCol ), "W+/W" )
|
||||
|
||||
#if 1
|
||||
DispOutAt( ++nRow, nCol, "< F2 MarkCopy Toggle >", cColor )
|
||||
DispOutAt( ++nRow, nCol, "< F3 Resize Toggle >", cColor )
|
||||
DispOutAt( ++nRow, nCol, "< F4 Closable Toggle >", cColor )
|
||||
DispOutAt( ++nRow, nCol, "< F5 Palette L Repeat >", cColor )
|
||||
DispOutAt( ++nRow, nCol, "< F6 Palette D Repeat >", cColor )
|
||||
DispOutAt( ++nRow, nCol, "< F7 Palette By Index R >", cColor )
|
||||
//DispOutAt( ++nRow, nCol, "< F8 MarkCopy menu text >", cColor )
|
||||
DispOutAt( ++nRow, nCol, "< F8 GET >", cColor )
|
||||
DispOutAt( ++nRow, nCol, "< Enter - Alert() >", cColor )
|
||||
DispOutAt( ++nRow, nCol, "< Click X Button >", cColor )
|
||||
#endif
|
||||
|
||||
DispOutAt( maxrow(), 0, Space( maxcol()+1 ), "N/G*" )
|
||||
|
||||
DispOutAt( 0, 0 , "TL", "N/GR*" )
|
||||
DispOutAt( 0, MaxCol() - 1 , "TR", "N/GR*" )
|
||||
DispOutAt( MaxRow(), 0 , "BL", "N/G*" )
|
||||
DispOutAt( MaxRow(), MaxCol() - 1, "BR", "N/G*" )
|
||||
|
||||
DispEnd()
|
||||
RETURN NIL
|
||||
//----------------------------------------------------------------------//
|
||||
PROCEDURE HB_GTSYS()
|
||||
REQUEST HB_GT_QTC_DEFAULT
|
||||
RETURN
|
||||
//----------------------------------------------------------------------//
|
||||
FUNCTION SetPalette( nMode )
|
||||
Local aPalette := Hb_GtInfo( HB_GTI_PALETTE )
|
||||
|
||||
static nR := 198
|
||||
static nG := 198
|
||||
static nB := 198
|
||||
|
||||
nR += iif( nMode == 0, -5, 5 )
|
||||
nG += iif( nMode == 0, -5, 5 )
|
||||
nB += iif( nMode == 0, -5, 5 )
|
||||
|
||||
// Change "W" to slightly gray everytime you press F5
|
||||
//
|
||||
aPalette[ 8 ] := RGB( nR, nG, nB )
|
||||
|
||||
Hb_GtInfo( HB_GTI_PALETTE, aPalette )
|
||||
DispScreen()
|
||||
|
||||
RETURN NIL
|
||||
//----------------------------------------------------------------------//
|
||||
FUNCTION SetPaletteIndex()
|
||||
|
||||
Hb_GtInfo( HB_GTI_PALETTE, 8, RGB( 120, 200, 240 ) )
|
||||
DispScreen()
|
||||
|
||||
RETURN NIL
|
||||
//----------------------------------------------------------------------//
|
||||
PROCEDURE thFunc()
|
||||
Local cTitle, oBrowse, lEnd, nKey, i, aStruct, pGT1, pGT, hWnd
|
||||
Local aColor := { 'W+/N', 'W+/B', 'W+/G', 'W+/BG', 'W+/N*', 'W+/RB', 'N/W*', 'N/GR*' }
|
||||
|
||||
static nBrowser := 0
|
||||
static nZx := 0
|
||||
static nZy := 0
|
||||
|
||||
ErrorBlock( {|oErr| MyErrorSys( oErr ) } )
|
||||
|
||||
nBrowser++
|
||||
nZx += 20
|
||||
nZy += 20
|
||||
|
||||
/* allocate own GT driver */
|
||||
hb_gtReload( 'WVT' )
|
||||
Hb_GtInfo( HB_GTI_PALETTE, 8, RGB( 120, 200, 240 ) )
|
||||
|
||||
if ( nBrowser % 2 ) != 0
|
||||
Hb_GtInfo( HB_GTI_RESIZEMODE, HB_GTI_RESIZEMODE_ROWS )
|
||||
endif
|
||||
Hb_GtInfo( HB_GTI_WINTITLE, 'Test.dbf ['+if( ( nBrowser % 2 ) != 0, 'RESIZABLE_BY_ROWS', 'RESIZABLE_BY_FONT' )+']' )
|
||||
|
||||
SetCursor( 0 )
|
||||
|
||||
nColorIndex++
|
||||
if nColorIndex > len( aColor )
|
||||
nColorIndex := 1
|
||||
endif
|
||||
|
||||
nRows++
|
||||
nCols += 2
|
||||
|
||||
SetMode( nRows,nCols )
|
||||
SetColor( aColor[ nColorIndex ] )
|
||||
Hb_GtInfo( HB_GTI_WINTITLE, cTitle )
|
||||
CLS
|
||||
Hb_GtInfo( HB_GTI_SETPOS_XY, nZx, nZy )
|
||||
|
||||
cTitle := 'New Window with '+ltrim( str( MaxRow() ) )+;
|
||||
' Rows and '+ltrim( str( MaxCol() ) )+' Columns'
|
||||
DispOutAt( 0, 0, padc( cTitle, maxcol()+1 ), 'N/GR*' )
|
||||
cTitle := '<F11> Modal Dialog <ReSize> <Maximize> <ESC>'
|
||||
DispOutAt( MaxRow(), 0, padc( cTitle, maxcol()+1 ), 'W+/R*' )
|
||||
|
||||
use test shared
|
||||
aStruct := DbStruct()
|
||||
|
||||
oBrowse := TBrowse():New( 1, 0, maxrow()-1, maxcol() )
|
||||
|
||||
oBrowse:ColSep := " ³ "
|
||||
oBrowse:HeadSep := "ÄÂÄ"
|
||||
oBrowse:GoTopBlock := { || dbGoTop() }
|
||||
oBrowse:GoBottomBlock := { || dbGoBottom() }
|
||||
oBrowse:SkipBlock := { | nSkip | dbSkipBlock( nSkip,oBrowse ) }
|
||||
|
||||
for i := 1 to len( aStruct )
|
||||
oBrowse:AddColumn( TBColumnNew( aStruct[ i,1 ], BlockField( i ) ) )
|
||||
next
|
||||
|
||||
oBrowse:configure()
|
||||
|
||||
lEnd := .f.
|
||||
While !lEnd
|
||||
oBrowse:ForceStable()
|
||||
|
||||
nKey := InKey( 0, INKEY_ALL )
|
||||
|
||||
if BrwHandleKey( oBrowse, nKey, @lEnd )
|
||||
//
|
||||
else
|
||||
if nKey == HB_K_RESIZE
|
||||
cTitle := 'New Window with '+ltrim( str( MaxRow() ) )+;
|
||||
' Rows and '+ltrim( str( MaxCol() ) )+' Columns'
|
||||
DispOutAt( 0, 0, padc( cTitle, maxcol()+1 ), 'N/GR*' )
|
||||
cTitle := '<F11> Modal Dialog <ReSize> <Maximize> <ESC>'
|
||||
DispOutAt( MaxRow(), 0, padc( cTitle, maxcol()+1 ), 'W+/R*' )
|
||||
|
||||
oBrowse:nBottom := MaxRow()-1
|
||||
oBrowse:nRight := MaxCol()
|
||||
oBrowse:Configure()
|
||||
oBrowse:RefreshAll()
|
||||
|
||||
elseif nKey == K_F11
|
||||
// Initialization Phase . Can be a Dialog Class
|
||||
// LIKE in Xbase++:
|
||||
// oWnd := gtDialog():New( oParent, oOwner, aSize, aPos, aPresParam, lVisible )
|
||||
//
|
||||
hWnd := hb_gtInfo( HB_GTI_WINHANDLE )
|
||||
|
||||
pGT1 := hb_gtCreate( 'WVT' )
|
||||
pGT := hb_gtSelect( pGT1 )
|
||||
SetMode( 7,40 )
|
||||
hb_gtInfo( HB_GTI_SETPARENT , hWnd )
|
||||
hb_gtInfo( HB_GTI_SETPOS_ROWCOL , 4, 8 )
|
||||
hb_gtInfo( HB_GTI_WINTITLE , 'Modal Dialog [ Row:4 Col:8 ]' )
|
||||
hb_gtInfo( HB_GTI_RESIZABLE , .F. )
|
||||
|
||||
// Program Flow
|
||||
SetColor( 'N/W' )
|
||||
CLS
|
||||
Alert( 'I am in Child Window', {'Good','Bad'} )
|
||||
|
||||
// Cleanup
|
||||
pGT1 := NIL
|
||||
hb_gtSelect( pGT )
|
||||
|
||||
elseif nKey == K_F12
|
||||
pGT1 := NIL
|
||||
|
||||
endif
|
||||
endif
|
||||
end
|
||||
|
||||
DbCloseArea()
|
||||
|
||||
RETURN
|
||||
//----------------------------------------------------------------------//
|
||||
STATIC FUNCTION DbSkipBlock( n, oTbr )
|
||||
|
||||
LOCAL nSkipped := 0
|
||||
|
||||
if n == 0
|
||||
DBSkip( 0 )
|
||||
|
||||
elseif n > 0
|
||||
do while nSkipped != n .and. TBNext( oTbr )
|
||||
nSkipped++
|
||||
enddo
|
||||
else
|
||||
do while nSkipped != n .and. TBPrev( oTbr )
|
||||
nSkipped--
|
||||
enddo
|
||||
endif
|
||||
|
||||
RETURN nSkipped
|
||||
//-------------------------------------------------------------------//
|
||||
STATIC FUNCTION TBNext( oTbr )
|
||||
|
||||
LOCAL nSaveRecNum := recno()
|
||||
LOCAL lMoved := .T.
|
||||
|
||||
HB_SYMBOL_UNUSED( oTbr )
|
||||
|
||||
if Eof()
|
||||
lMoved := .F.
|
||||
else
|
||||
DBSkip( 1 )
|
||||
if Eof()
|
||||
lMoved := .F.
|
||||
DBGoTo( nSaveRecNum )
|
||||
endif
|
||||
endif
|
||||
|
||||
RETURN lMoved
|
||||
//-------------------------------------------------------------------//
|
||||
STATIC FUNCTION TBPrev( oTbr )
|
||||
LOCAL nSaveRecNum := Recno()
|
||||
LOCAL lMoved := .T.
|
||||
|
||||
HB_SYMBOL_UNUSED( oTbr )
|
||||
|
||||
DBSkip( -1 )
|
||||
|
||||
if Bof()
|
||||
DBGoTo( nSaveRecNum )
|
||||
lMoved := .F.
|
||||
endif
|
||||
|
||||
RETURN lMoved
|
||||
//-------------------------------------------------------------------//
|
||||
STATIC FUNCTION BlockField( i )
|
||||
RETURN {|| fieldget( i ) }
|
||||
//-------------------------------------------------------------------//
|
||||
STATIC FUNCTION BrwHandleKey( oBrowse, nKey, lEnd )
|
||||
LOCAL lRet := .t.
|
||||
|
||||
do case
|
||||
case nKey == K_ESC
|
||||
lEnd := .t.
|
||||
|
||||
case nKey == K_ENTER
|
||||
lEnd := .t.
|
||||
|
||||
case nKey == K_DOWN
|
||||
oBrowse:Down()
|
||||
|
||||
case nKey == K_UP
|
||||
oBrowse:Up()
|
||||
|
||||
case nKey == K_LEFT
|
||||
oBrowse:Left()
|
||||
|
||||
case nKey == K_RIGHT
|
||||
oBrowse:Right()
|
||||
|
||||
case nKey == K_PGDN
|
||||
oBrowse:pageDown()
|
||||
|
||||
case nKey == K_PGUP
|
||||
oBrowse:pageUp()
|
||||
|
||||
case nKey == K_CTRL_PGUP
|
||||
oBrowse:goTop()
|
||||
|
||||
case nKey == K_CTRL_PGDN
|
||||
oBrowse:goBottom()
|
||||
|
||||
case nKey == K_HOME
|
||||
oBrowse:home()
|
||||
|
||||
case nKey == K_END
|
||||
oBrowse:end()
|
||||
|
||||
case nKey == K_CTRL_LEFT
|
||||
oBrowse:panLeft()
|
||||
|
||||
case nKey == K_CTRL_RIGHT
|
||||
oBrowse:panRight()
|
||||
|
||||
case nKey == K_CTRL_HOME
|
||||
oBrowse:panHome()
|
||||
|
||||
case nKey == K_CTRL_END
|
||||
oBrowse:panEnd()
|
||||
|
||||
case nKey == K_MWBACKWARD
|
||||
oBrowse:down()
|
||||
|
||||
case nKey == K_MWFORWARD
|
||||
oBrowse:up()
|
||||
|
||||
otherwise
|
||||
lRet := .f.
|
||||
|
||||
endcase
|
||||
|
||||
RETURN lRet
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
FUNCTION Qtc_Out( cMsg )
|
||||
|
||||
HB_SYMBOL_UNUSED( cMsg )
|
||||
|
||||
//RETURN Qtc_OutputDebugString( cMsg )
|
||||
RETURN NIL
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
PROCEDURE MyErrorSys( oError )
|
||||
|
||||
//Qtc_Out( oError:Description )
|
||||
Qtc_Out( oError:args )
|
||||
Qtc_Out( oError:genCode )
|
||||
Qtc_Out( oError:operation )
|
||||
|
||||
Qtc_Out( procname( 1 ) )
|
||||
Qtc_Out( str( procline( 1 ) ) )
|
||||
Qtc_Out( procname( 2 ) )
|
||||
Qtc_Out( str( procline( 2 ) ) )
|
||||
|
||||
RETURN
|
||||
//----------------------------------------------------------------------//
|
||||
@@ -1,7 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
../gtqtc.hbc
|
||||
|
||||
-w3 -es2
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 766 B |
Reference in New Issue
Block a user