#include "FiveWin.ch"
static oWndMain
function Main()
local oWnd,oFont
DEFINE WINDOW oWndMain FROM 0, 0 TO 23, 79 ;
MENU BuildMenu() ;
TITLE "test" ;
COLOR NIL, CLR_HGRAY ;
MENUINFO 9 ;
MDI
oWndMain:SetFont( oFont := TFont():New( GetSysFont(), 0, ;
If( LargeFonts(), -10, -12 ) ) )
oWndMain:SetIcon( TIcon():New( ,, "RTFPAD" ) )
setbar()
ACTIVATE WINDOW oWndMain ;
ON INIT NEW_WIND_CHILD()
return nil
function BuildMenu()
LOCAL oMenu
MENU oMenu 2015
MENUITEM "&File"
MENU
MENUITEM "&New" + Chr( 9 ) + "Ctrl+N" ;
RESOURCE "RTFNEW" MESSAGE "Creates a new document" ;
ACCELERATOR ACC_CONTROL, Asc( "N" ) ;
ACTION NIL
MENUITEM "&Open..." + Chr( 9 ) + "Ctrl+O" ;
RESOURCE "RTFOPEN" MESSAGE "Opens an existing document" ;
ACCELERATOR ACC_CONTROL, Asc( "O" ) ;
ACTION NIL
MENUITEM "&Close" RESOURCE "RTFCLOSE" MESSAGE "Closes the active document" ;
ACTION NIL
SEPARATOR
MENUITEM "&Save" + Chr( 9 ) + "Ctrl+S" ;
RESOURCE "RTFSAVE" MESSAGE "Saves the active document" ;
ACCELERATOR ACC_CONTROL, Asc( "S" ) ;
ACTION NIL
MENUITEM "Save &As..." MESSAGE "Saves the active document with a new name" ;
ACTION NIL
SEPARATOR
MENUITEM "&Print..." + Chr( 9 ) + "Ctrl+P" ;
RESOURCE "RTFPRINT" MESSAGE "Prints the active document" ;
ACCELERATOR ACC_CONTROL, Asc( "P" ) ;
ACTION NIL
MENUITEM "Print Pre&view" RESOURCE "RTFPREVIEW" ;
MESSAGE "Displays full pages" ;
ACTION NIL
MENUITEM "P&rint Setup..." MESSAGE "Changes the printer and printing options" ;
ACTION PrinterSetup()
MENUITEM "Page Set&up..." RESOURCE "RTFPAGE" ;
MESSAGE "Changes page layout settings" ;
ACTION NIL
SEPARATOR
MENUITEM "Sen&d..." RESOURCE "RTFMAIL" ;
MESSAGE "Sends the active document through electronic mail" ;
ACTION NIL
MENUITEM "Proper&ties..." RESOURCE "RTFPROPERTY" ;
MESSAGE "Shows the properties of the active document" ;
ACTION NIL
MENUITEM "&Recent Files "
MENUITEM "&Exit" RESOURCE "RTFEXIT" ;
MESSAGE "Exit from the application" ACTION NIL
ENDMENU
//--------------------------------------------------------------------------------------------------------//
MENUITEM "&Edit"
MENU
MENUITEM "&Undo" + Chr( 9 ) + "Ctrl+Z" ;
RESOURCE "RTFUndo" MESSAGE "Reverses the last action" ;
ACCELERATOR ACC_CONTROL, Asc( "Z" ) ;
ACTION NIL
MENUITEM "&Redo" + Chr( 9 ) + "Ctrl+Y" ;
RESOURCE "RTFRedo" MESSAGE "Carries out the previously undone action" ;
ACCELERATOR ACC_CONTROL, Asc( "Y" ) ;
ACTION NIL
SEPARATOR
MENUITEM "Cu&t" + Chr( 9 ) + "Ctrl+X" ;
RESOURCE "RTFCut" MESSAGE "Cuts the selection and puts it on the Clipboard" ;
ACCELERATOR ACC_CONTROL, Asc( "X" ) ;
ACTION NIL
MENUITEM "&Copy" + Chr( 9 ) + "Ctrl+C" ;
RESOURCE "RTFCopy" MESSAGE "Copies the selection and puts it on the Clipboard" ;
ACCELERATOR ACC_CONTROL, Asc( "C" ) ;
ACTION NIL
MENUITEM "&Paste" + Chr( 9 ) + "Ctrl+V" ;
RESOURCE "RTFPaste" MESSAGE "Inserts Clipboard contents" ;
ACCELERATOR ACC_CONTROL, Asc( "V" ) ;
ACTION NIL
MENUITEM "Paste &Special..." ;
MESSAGE "Inserts Clipboard contents with options" ;
ACTION NIL
SEPARATOR
MENUITEM "Select A&ll" + Chr( 9 ) + "Ctrl+A" ;
RESOURCE "SelAll" MESSAGE "Selects the entire document" ;
ACCELERATOR ACC_CONTROL, Asc( "A" ) ;
ACTION NIL
MENUITEM "&Delete" + Chr( 9 ) + "Del" ;
RESOURCE "Del" MESSAGE "Erases the selection" ;
ACTION NIL
SEPARATOR
MENUITEM "&Find..." + Chr( 9 ) + "Ctrl+F" ;
RESOURCE "RTFFind" MESSAGE "Finds the specified text" ;
ACCELERATOR ACC_CONTROL, Asc( "F" ) ;
ACTION NIL
MENUITEM "R&eplace..." + Chr( 9 ) + "Ctrl+H" ;
RESOURCE "RTFREPLACE" MESSAGE "Replaces specific text with diferent text" ;
ACCELERATOR ACC_CONTROL, Asc( "H" ) ;
ACTION NIL
ENDMENU
//--------------------------------------------------------------------------------------------------------//
MENUITEM "F&onts"
MENU
MENUITEM "F&ont..." RESOURCE "RTFFONT" ;
MESSAGE "Formats the selection with a font" ;
ACTION NIL
MENUITEM "Styles..."
MENU
MENUITEM "Bold..." RESOURCE "RTFBold"
MENUITEM "Italic..." RESOURCE "RTFItalic"
MENUITEM "Underline..." RESOURCE "RTFUnderLINE"
MENUITEM "Strikeout..." RESOURCE "RTFSTRIKE"
SEPARATOR
MENUITEM "All Capitals..." RESOURCE "Upper" ;
MESSAGE "Formats the selection to capital letters (toggle)" ;
ACTION NIL
* ::oMnuUpp:lChecked := .F.
ENDMENU
MENUITEM "Size..."
MENU
ENDMENU
MENUITEM "Text -6color..." RESOURCE "RTFColour" ;
MESSAGE "Formats the selection with a color" ;
ACTION NIL
MENUITEM "&Text Background color..." RESOURCE "RTFHlight" ;
MESSAGE "Highlights the selection with a color" ;
ACTION NIL
ENDMENU
//--------------------------------------------------------------------------------------------------------//
MENUITEM "&Paragraph"
MENU
MENUITEM "F&ont..." RESOURCE "RTFFONT" ;
MESSAGE "Formats the selection with a font" ;
ACTION NIL
MENUITEM "&Paragraph..." RESOURCE "RTFPARAGRAPH" ;
MESSAGE "Formats current or selected paragraph(s)" ;
ACTION NIL
SEPARATOR
MENUITEM "&Numbering" RESOURCE "RTFNumber" ;
MESSAGE "Inserts a numbering on this line" ;
ACTION NIL
* ::oMnuNum:lChecked := .F.
MENUITEM "B&ullets" RESOURCE "RTFBullet" ;
MESSAGE "Inserts a bullet on this line" ;
ACTION NIL
* ::oMnuBul:lChecked := .F.
SEPARATOR
MENUITEM "&Font Color..." RESOURCE "RTFColour" ;
MESSAGE "Formats the selection with a color" ;
ACTION NIL
MENUITEM "&Highlight Color..." RESOURCE "RTFHlight" ;
MESSAGE "Highlights the selection with a color" ;
ACTION NIL
SEPARATOR
MENUITEM "&Superscript" RESOURCE "Superscript" CHECKED ;
MESSAGE "Formats the selection by rising it above the normal text (toggle)" ;
ACTION NIL
* ::oMnuSup:lChecked := .F.
MENUITEM "Su&bscript" RESOURCE "Subscript" CHECKED ;
MESSAGE "Formats the selection by lowering it below the normal text (toggle)" ;
ACTION NIL
* ::oMnuSub:lChecked := .F.
SEPARATOR
MENUITEM "&Upper characters" RESOURCE "Upper" ;
MESSAGE "Formats the selection to capital letters (toggle)" ;
ACTION NIL
* ::oMnuUpp:lChecked := .F.
ENDMENU
MENUITEM "F&ormat"
MENU
ENDMENU
//--------------------------------------------------------------------------------------------------------//
MENUITEM "&Insert"
MENU
MENUITEM "&File..." RESOURCE "RTFFile" ;
MESSAGE "Inserts a file" ;
ACTION NIL
SEPARATOR
MENUITEM "&Date/time..." RESOURCE "RTFDate" ;
MESSAGE "Inserts today's date and/or time" ;
ACTION NIL
SEPARATOR
MENUITEM "&Picture..." RESOURCE "RTFIMAGE" ;
MESSAGE "Inserts a picture from a file" ;
ACTION NIL
SEPARATOR
MENUITEM "&Bitmap" RESOURCE "RTFBMP" ;
MESSAGE "Inserts a bitmap from resource" ;
ACTION NIL
SEPARATOR
MENUITEM "&Object..." RESOURCE "RTFOBJ" ;
MESSAGE "Inserts a new embedded object" ;
ACTION NIL
MENUITEM "&Table..." RESOURCE "RTFOBJ" ;
MESSAGE "Inserts a table" ;
ACTION NIL
ENDMENU
//--------------------------------------------------------------------------------------------------------//
MENUITEM "&Table"
MENU
MENUITEM "&Table..." ;
RESOURCE "RTFTABLE" MESSAGE "Inserts a table" ;
ACTION NIL
ENDMENU
MENUITEM "O&ptions"
MENU
MENUITEM "&Numbering" RESOURCE "RTFNumber" ;
MESSAGE "Inserts a numbering on this line" ;
ACTION NIL
MENUITEM "&Numbering" RESOURCE "RTFNumber" ;
MESSAGE "Inserts a numbering on this line" ;
ACTION NIL //::RTFNumering2()
ENDMENU
MENUITEM "&Window"
MENU
MENUITEM "&Cascade" RESOURCE "WND_CAS" ;
MESSAGE "Organizes windows on cascade" ;
ACTION NIL
MENUITEM "&Horizontal mosaic" RESOURCE "WND_MOH" ;
MESSAGE "Organizes windows on horizontal mosaic" ;
ACTION NIL
MENUITEM "&Vertical mosaic" RESOURCE "WND_MOV" ;
MESSAGE "Organizes windows on vertical mosaic" ;
ACTION NIL
MENUITEM "&Minimize Windows" RESOURCE "WND_MIN" ;
MESSAGE "Minimizes all Windows" ;
ACTION NIL
MENUITEM "&Restore all windows" RESOURCE "WND_MAX" ;
MESSAGE "Restores all windows" ;
ACTION NIL
MENUITEM "C&lose windows" RESOURCE "WND_CLO" ;
MESSAGE "Closes all windows" ;
ACTION NIL
MENUITEM "&Organize Icons";
MESSAGE "Organize minimized windows" ;
ACTION NIL
ENDMENU
//--------------------------------------------------------------------------------------------------------//
MENUITEM "&Help"
MENU
MENUITEM "&About FivePad..." RESOURCE "Help" ;
MESSAGE "Displays program information, version number and " + ;
"copyright" ;
ACTION NIL
MENUITEM "&Statistic." RESOURCE "Help" ;
MESSAGE " " ;
ACTION NIL
ENDMENU
ENDMENU
RETURN oMenu
//------------------------------------------------------------------------------------------
FUNCTION NEW_WIND_CHILD()
DEFINE WINDOW oWnd FROM 0, 0 TO 300, 650 PIXEL ;
MDICHILD OF oWndmain ;
COLOR CLR_WHITE,CLR_WHITE
oWnd:SetIcon( TIcon():New( ,, "RTFDOC" ) )
ACTIVATE WINDOW oWnd maximized
return nil
//--------------------------------------------------------------------------------------------//
Function setbar ()
LOCAL oBar, oCursor
local oBar1,oBar2
DEFINE CURSOR oCursor HAND
DEFINE BUTTONBAR oBar OF oWndMain 3D SIZE 26, 84
oBar:bLClicked := { || NIL }
oBar:bRClicked := { || NIL }
@ -1, -1 BUTTONBAR oBar1 OF oBar 3D SIZE oBar:nWidth - 1, 29 ;
BUTTONSIZE 26, 27
DEFINE BUTTON RESOURCE "RTFNEW" OF oBar1 GROUP ;
MESSAGE "Creates a new document" ;
TOOLTIP "New" NOBORDER ;
ACTION NIL
DEFINE BUTTON RESOURCE "RTFOPEN" OF oBar1 ;
MESSAGE "Opens an existing document" ;
TOOLTIP "Open" NOBORDER ;
ACTION NIL
oBar1:bLClicked := { || NIL }
oBar1:bRClicked := { || NIL }
AEval( oBar1:aControls, { |x| x:oCursor := oCursor } )
@ 26, -1 BUTTONBAR oBar2 OF oBar 3D SIZE oBar:nWidth - 1, 29 ;
BUTTONSIZE 26, 27
DEFINE BUTTON RESOURCE "RTFNEW" OF oBar2 GROUP ;
MESSAGE "Creates a new document" ;
TOOLTIP "New" NOBORDER ;
ACTION NIL
DEFINE BUTTON RESOURCE "RTFOPEN" OF oBar2 ;
MESSAGE "Opens an existing document" ;
TOOLTIP "Open" NOBORDER ;
ACTION NIL
oBar2:bLClicked := { || NIL }
oBar2:bRClicked := { || NIL }
AEval( oBar2:aControls, { |x| x:oCursor := oCursor, ;
x:nLeft += 219, x:nRight += 219 } ) // to init on this point
oBar1:l2015:=.t.
oBar2:l2015:=.t.
//test1
oBar2:bClrGrad := { | lMouseOver | If( ! lMouseOver,;
{ { 0.5, 14277043, 16053482 }, { 0.5, 16053482, 14277043 } }, ;
{ { 0.5, 14342911, 16119295 }, { 0.5, 16119295, 14342911 } } ) }
//test2
oBar1:bClrGrad := { | lPressed | If( ! lPressed,;
{ { 1, nRGB( 253, 254, 255 ), nRGB( 179, 217, 255 ) } },;
{ { 1, nRGB( 179, 217, 255 ), nRGB( 253, 254, 255 ) } } ) }
return nil
Remember that the pixel color at 0, 0 of the bitmap is used to specify the transparent color to use.
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 47 guests