1 /*
2  *  R : A Computer Language for Statistical Data Analysis
3  *  Copyright (C) 1998, 1999  Guido Masarotto and Brian Ripley
4  *  Copyright (C) 2004        The R Foundation
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, a copy is available at
18  *  https://www.R-project.org/Licenses/
19  */
20 
21 #define RW_MDI         0x0001
22 #define RW_TOOLBAR     0x0010
23 #define RW_STATUSBAR   0x0100
24 #define RW_LARGEICONS   0x1000
25 
26 #define CASCADE 1
27 #define TILEHORIZ 2
28 #define TILEVERT 3
29 #define MINIMIZE 4
30 #define RESTORE 5
31 
32 extern int MDIset;
33 
34 #include <R_ext/Boolean.h>
35 #include <R_ext/libextern.h>
36 LibExtern int RguiMDI;
37 LibExtern window RConsole;
38 LibExtern window RFrame;
39 LibExtern int Rwin_graphicsx, Rwin_graphicsy;
40 LibExtern Rboolean AllDevicesKilled;
41 #undef LibExtern
42 
43 typedef struct {
44     menuitem m;
45     char *name;
46     char *action;
47 }  uitem;
48 typedef uitem *Uitem;
49 
50 typedef struct {
51     int numItems;
52     Uitem *mItems;
53 } menuItems;
54 
55 struct structHelpMenuItems {
56     menuitem mhelp, mmanintro, mmanref, mmandata,
57 	mmanext, mmanint, mmanlang, mmanadmin, mmanSweave,
58 	mman0, mapropos, mhelpstart,
59 	mhelpsearch, msearchRsite, mFAQ, mrwFAQ, mCRAN;
60     menu mman;
61 };
62 typedef struct structHelpMenuItems *HelpMenuItems;
63 
64 struct structPkgMenuItems {
65     menuitem mpkgl, mpkgm, mpkgi, mpkgil, mpkgu, mrepos;
66 };
67 typedef struct structPkgMenuItems *PkgMenuItems;
68 
69 #include <R_ext/Error.h> /* for R_ShowMessage */
70 int check_doc_file(const char *);
71 void internal_shellexec(const char *);
72 
73 int winaddmenu(const char * name, char *errmsg);
74 int winaddmenuitem(const char * item, const char * menu, const char * action, char *errmsg);
75 int windelmenu(const char * menu, char *errmsg); /* delete one menu and its items and submenus */
76 void windelmenus(const char * prefix); /* delete all menus which start with a certain prefix */
77 int windelmenuitem(const char * item,const  char * menu, char *errmsg);
78 
79 int numwinmenus(void);
80 char *getusermenuname(int pos);
81 menuItems *wingetmenuitems(const char *mname, char *errmsg);
82 void freemenuitems(menuItems *items);
83 
84 void Rwin_fpset(void);
85 
86 void Rgui_configure(void);
87 void readconsolecfg(void);
88 void breaktodebugger(void);
89 
90 #define USE_MDI 1
91 
92 #ifdef USE_MDI
93 int RgetMDIwidth(void);
94 int RgetMDIheight(void);
95 #endif
96 
97 void menuconfig(control m);
98 void menuclear(control m);
99 int RguiPackageMenu(PkgMenuItems pmenu);
100 void pkgmenuact(PkgMenuItems pmenu);
101 int RguiCommonHelp(menu m, HelpMenuItems hmenu);
102 void helpmenuact(HelpMenuItems hmenu);
103 void showstatusbar(void);
104 
105 menu getGraphMenu(const char *); /* from extra.c */
106