//--------------------------------------------------------------
//
//  VDBASE.H
//
//  This is a header file containing definitions for various
//  numeric constants used by Visual dBASE commands and
//  functions as well as numeric properties of form controls.
//
//  This file replaces UTIL.H, ENUM.H, and MESSDLG.H which
//  appeared in prior versions of Visual dBASE.
//
//  dBASE Samples Group
//
//  $Revision:   1.4  $
//
//  Copyright (c) 1997-1998, Borland International, Inc. 
//  Copyright (c) 2000, dBASE, Inc.
//  All rights reserved.
//
//--------------------------------------------------------------

//  Defines happen once, even if file is #included multiple times

#ifndef VDBASE_H
#define VDBASE_H

// Define basic constants and macros

#define CFALSE 0
#define CTRUE  1

//  Common macros

#define ALLTRIM(s)  ltrim(rtrim(s))
#define TRIMSTR(n)  ltrim(str(n))

//  Macros for creating typed NULLs

#define BOOKMARK_NULL         (bookmark( NULL ))
#define CHARACTER_NULL        (upper( NULL ))
#define DATE_NULL             (ctod( NULL ))
#define LOGICAL_NULL          (isupper( NULL ))
#define NUMERIC_NULL          (abs( NULL ))

//  Constants used by dB2K Commands and Functions

// Constants for ADEL(), AGROW(), AINS(), ALEN(), ASUBSCRIPT()
// Also used by the Array class methods of similar names
#define ARRAY_ELEMENT 0        // Used only by ALEN()
#define ARRAY_ROW     1
#define ARRAY_COLUMN  2

// Constants for ARESIZE()
#define ARRAY_REARRANGE   0
#define ARRAY_NOREARRANGE 1

// Constants for ASORT()
#define ARRAY_ASCENDING  0
#define ARRAY_DESCENDING 1

// Constants for BEGINTRANS()
#define ISO_DEFAULT         0
#define ISO_DIRTY_READ      1
#define ISO_READ_COMMITTED  2
#define ISO_REPEATABLE_READ 3

// Constants for BINTYPE(), REPLACE BINARY,
#define BIN_AUDIO 32768
#define BIN_IMAGE 32769

// Constants for DISKSPACE()
#define DISK_SYSTEM  -1
#define DISK_DEFAULT 0
#define DISK_A       1
#define DISK_B       2
#define DISK_C       3
#define DISK_D       4
#define DISK_E       5
#define DISK_F       6
#define DISK_G       7
#define DISK_H       8
#define DISK_I       9
#define DISK_J       10
#define DISK_K       11
#define DISK_L       12
#define DISK_M       13
#define DISK_N       14
#define DISK_O       15
#define DISK_P       16
#define DISK_Q       17
#define DISK_R       18
#define DISK_S       19
#define DISK_T       20
#define DISK_U       21
#define DISK_V       22
#define DISK_W       23
#define DISK_X       24
#define DISK_Y       25
#define DISK_Z       26

// Constants returned by FCREATE(), 
// FOPEN(), FPUTS(), FSEEK(), FWRITE()
#define FERROR_ERROR -1

// Constants for FPUTS()
#define FERROR_UNSUCCESSFUL 0

// Constants returned by FERROR()
#define FERROR_FILENOTFOUND      2
#define FERROR_BADPATH           3
#define FERROR_NOFILEHANDLES     4
#define FERROR_CANNOTACCESS      5
#define FERROR_BADFILEHANDLE     6
#define FERROR_DIRECTORYFULL     8
#define FERROR_BADFILEPOINTER    9
#define FERROR_DISKFULL         13
#define FERROR_ENDOFFILE        14

// Constants for FKLABEL()
#define FK_F1    0
#define FK_F2    1
#define FK_F3    2
#define FK_F4    3
#define FK_F5    4
#define FK_F6    5
#define FK_F7    6
#define FK_F8    7
#define FK_F9    8
#define FK_F10   9
#define FK_CTRL  10        // Used in combination with FK_F1, FK_F2, ...
#define FK_SHIFT 20        // Used in combination with FK_F1, FK_F2, ...

// Constants for FSEEK()
#define FILE_BEGIN   0
#define FILE_CURRENT 1
#define FILE_END     2

// Constants for LKSYS()
#define LOCK_BUFFER_TIME   0
#define LOCK_BUFFER_DATE   1
#define LOCK_BUFFER_USER   2
#define LOCK_LAST_TIME     3
#define LOCK_LAST_DATE     4
#define LOCK_LAST_USER     5

// Constants for MSGBOX()
#define OK_BUTTON                   0
#define OK_CANCEL_BUTTONS           1
#define ABORT_RETRY_IGNORE_BUTTONS  2
#define YES_NO_CANCEL_BUTTONS       3
#define YES_NO_BUTTONS              4
#define RETRY_CANCEL_BUTTONS        5

#define PLAIN_MESSAGE               0  // ok/cancel
#define WARNING_MESSAGE            16
#define CONFIRMATION_MESSAGE       32
#define ALERT_MESSAGE              48
#define INFORMATION_MESSAGE        64

#define BUTTON_OK     1
#define BUTTON_CANCEL 2
#define BUTTON_ABORT  3
#define BUTTON_RETRY  4
#define BUTTON_IGNORE 5
#define BUTTON_YES    6
#define BUTTON_NO     7
//
//  The following appeared in messdlg.h in prior versions of
//  dB2K. The simple button names conflict with dB2K
//  commands, so they have been replaced with the button
//  constants above. You can uncomment these if existing applications
//  need them and they will not conflict in your application.
//
//#define OK                         1
//#define CANCEL                     2
//#define ABORT                      3
//#define RETRY                      4
//#define IGNORE                     5
//#define YES                        6
//#define NO                         7

//  Shortcut macros for common message boxes (from old messdlg.h)
//  m is message, t is title
#define PlainMessage(m,t)           msgBox(m,t,PLAIN_MESSAGE + OK_BUTTON)
#define WarningMessage(m,t)         msgBox(m,t,WARNING_MESSAGE + OK_CANCEL_BUTTONS)
#define ConfirmationMessage(m,t)    msgBox(m,t,CONFIRMATION_MESSAGE + YES_NO_BUTTONS)
#define ConfirmOrCancelMessage(m,t) msgBox(m,t,CONFIRMATION_MESSAGE + YES_NO_CANCEL_BUTTONS)
#define AlertMessage(m,t)           msgBox(m,t,ALERT_MESSAGE + OK_BUTTON)
#define InformationMessage(m,t)     msgBox(m,t,INFORMATION_MESSAGE + OK_BUTTON)

// Constants for OS()
#define OS_SYSTEM
#define OS_WINDOWS 1

// Constants for PROGRAM()
#define PROGRAM_NOPATH
#define PROGRAM_WITHPATH 1

// Constants for RUN()
#define RUN_WINDOWS .T.
#define RUN_DOS     .F.

// Constants for SHELL()
#define SHELL_HIDE    .F.
#define SHELL_RESTORE .T.
#define SHELL_DISABLE .F.,.T.

//
//  Constants for the enumerated properties of stock objects
//

// Rowset Class State property values
#define STATE_CLOSED   0
#define STATE_BROWSE   1
#define STATE_EDIT     2
#define STATE_APPEND   3
#define STATE_FILTER   4
#define STATE_LOCATE   5

// Image Class Alignment property values
#define I_ALIGNMENT_STRETCH         0
#define I_ALIGNMENT_TOP_LEFT        1
#define I_ALIGNMENT_CENTER          2
#define I_ALIGNMENT_ASPECT_STRETCH  3

// Text Class Alignment property values
#define ALIGNMENT_TOP_LEFT      0
#define ALIGNMENT_TOP_CENTER    1
#define ALIGNMENT_TOP_RIGHT     2
#define ALIGNMENT_CENTER_LEFT   3
#define ALIGNMENT_CENTER        4
#define ALIGNMENT_CENTER_RIGHT  5
#define ALIGNMENT_BOTTOM_LEFT   6
#define ALIGNMENT_BOTTOM_CENTER 7
#define ALIGNMENT_BOTTOM_RIGHT  8
#define ALIGNMENT_WRAP_LEFT     9
#define ALIGNMENT_WRAP_CENTER   10
#define ALIGNMENT_WRAP_RIGHT    11

// Tabbox Class Anchor property values
#define ANCHOR_BOTTOM 1

// Rectangle Class BorderStyle property values
#define BORDERSTYLE_NORMAL      0
#define BORDERSTYLE_RAISED      1
#define BORDERSTYLE_LOWERED     2

// Browse Class Mode property values
#define MODE_BROWSE             0
#define MODE_FORM_EDIT          1
#define MODE_COLUMNAR_EDIT      2

// Different control classes MousePointer property values
#define MOUSE_POINTER_DEFAULT   0
#define MOUSE_POINTER_ARROW     1
#define MOUSE_POINTER_CROSS     2
#define MOUSE_POINTER_IBEAM     3
#define MOUSE_POINTER_ICON      4
#define MOUSE_POINTER_SIZE      5
#define MOUSE_POINTER_SIZE_NECW 6    && Error from prior version
#define MOUSE_POINTER_SIZE_NESW 6
#define MOUSE_POINTER_SIZE_S    7
#define MOUSE_POINTER_SIZE_NWSE 8
#define MOUSE_POINTER_SIZE_E    9
#define MOUSE_POINTER_UP_ARROW  10
#define MOUSE_POINTER_WAIT      11

// Rectangle Class Patternstyle property values
#define PATTERNSTYLE_SOLID      0
#define PATTERNSTYLE_BDIAGONAL  1
#define PATTERNSTYLE_CROSS      2
#define PATTERNSTYLE_DIAGCROSS  3
#define PATTERNSTYLE_FDIAGONAL  4
#define PATTERNSTYLE_HORIZONTAL 5
#define PATTERNSTYLE_VERTICAL   6

// Line Class Pen property values
// Shape Class PenStyle property values
#define PEN_SOLID               0
#define PEN_DASH                1
#define PEN_DOT                 2
#define PEN_DASH_DOT            3
#define PEN_DASH_DOT_DOT        4


// Form/Editor class Scrollbar property values
#define SCROLLBAR_OFF           0
#define SCROLLBAR_ON            1
#define SCROLLBAR_AUTO          2
#define SCROLLBAR_DISABLED      3

// Shape Class ShapeStyle property values
#define SHAPE_ROUND_RECTANGLE   0
#define SHAPE_RECTANGLE         1
#define SHAPE_ELLIPSE           2
#define SHAPE_CIRCLE            3
#define SHAPE_ROUND_SQUARE      4
#define SHAPE_SQUARE            5

// Combobox class Style property values
#define STYLE_SIMPLE            0
#define STYLE_DROPDOWN          1
#define STYLE_DROPDOWN_LIST     2

// Form class WindowState property values
#define WINDOWSTATE_NORMAL      0
#define WINDOWSTATE_MINIMIZED   1
#define WINDOWSTATE_MAXIMIZED   2

//
//   Constants and Macros for the stock object events
//

// NType parameter setting for the OnSize event handler of forms
#define SIZE_RESTORED   0
#define SIZE_MINIMIZED  1
#define SIZE_MAXIMIZED  2
#define SIZE_MAX_OTHER  3
#define SIZE_MIN_OTHER  4
#define SIZE_MAXSHOW    SIZE_MAX_OTHER
#define SIZE_MAXHIDE    SIZE_MIN_OTHER

// Mouse and keyboard event flags, these macros evaluate to a logical type
#define FLAG_LEFT_MOUSE(f)      (BITSET(f,0))
#define FLAG_RIGHT_MOUSE(f)     (BITSET(f,1))
#define FLAG_SHIFT(f)           (BITSET(f,2))
#define FLAG_CTRL(f)            (BITSET(f,3))
#define FLAG_MIDDLE_MOUSE(f)    (BITSET(f,4))

#endif
