Skip to content

Commit 38d97e6

Browse files
committed
Merge branch 'master' of https://github.com/rawcreative/MacGap2
2 parents 0e4082e + 1570899 commit 38d97e6

File tree

1 file changed

+3
-180
lines changed

1 file changed

+3
-180
lines changed

README.md

Lines changed: 3 additions & 180 deletions
Original file line numberDiff line numberDiff line change
@@ -1,182 +1,5 @@
1+
# Welcome to MacGap 2.
12

3+
For usage notes and API documentation, visit http://docs.macgap.com.
24

3-
# Notes
4-
5-
6-
7-
## Commands
8-
9-
All commands in the MacGap property are now capitalized except the base MacGap object, not sure if I should change this or not.
10-
11-
12-
### MacGap
13-
14-
Properties | description
15-
---------- | -----------
16-
applicationPath |
17-
resourcePath |
18-
documentsPath |
19-
libraryPath |
20-
homePath |
21-
tempPath |
22-
idleTime |
23-
24-
25-
26-
Methods | Arguments | description
27-
-------- | --------- | ------------
28-
activate | none |
29-
terminate | none |
30-
hide | none |
31-
unhide | none |
32-
beep | none |
33-
bounce | none |
34-
setUserAgent | string |
35-
36-
37-
### MacGap.Window
38-
39-
Properties | description
40-
---------- | -----------
41-
x | current X coord
42-
y | current Y corrd
43-
isMaximized |
44-
45-
46-
Methods | Arguments | description
47-
-------- | --------- | ------------
48-
move | (int) x, (int) y |
49-
resize | (int) width, (int) height |
50-
title | (string) title |
51-
minimize | none |
52-
maximize | none |
53-
restore | none |
54-
toggleFullscreen | none |
55-
56-
57-
### MacGap.Menu
58-
59-
Properties | description
60-
---------- | -----------
61-
menuItems | list of current menu's items
62-
type | type of menu
63-
64-
65-
Methods | Arguments | description
66-
-------- | --------- | ------------
67-
addItem | (*object*) { label: "Title", keys: "cmd+g", index: 1, callback: function() { ... } } |
68-
getItem | (*string*) Name OR (*int*) Index |
69-
addSeparator | none |
70-
create | (string) title, (string) type | type is optional except for status bar menus, for those type must be 'statusbar'
71-
72-
73-
74-
### MacGap.MenuItem
75-
76-
Properties | description
77-
---------- | -----------
78-
submenu | gets or sets menu items submenu
79-
80-
81-
82-
Methods | Arguments | description
83-
-------- | --------- | ------------
84-
addSubmenu | (string) title |
85-
setKey | (string) keys | sets menu's accelerator keys
86-
setLabel | (string) label | sets/changes menu item's label
87-
remove | none |
88-
89-
90-
91-
92-
### MacGap.StatusItem
93-
94-
Properties | description
95-
---------- | -----------
96-
menu | gets/sets the status items menu
97-
98-
99-
Methods | Arguments | description
100-
-------- | --------- | ------------
101-
createItem | (*object*) { image: "path/to/image", alternateImage: "path/to/alt/image", onClick: function() { ... } } |
102-
103-
104-
105-
106-
### MacGap.Dialog
107-
108-
Methods | Arguments | description
109-
-------- | --------- | ------------
110-
openDialog | (*object*) { files: true, multiple: true, directories: true, callback: function() {...} } | all params are optional and default to false
111-
saveDialog | (*object*) { {title:"Sheet Title", prompt: "Button Text", message: "Sheet Message", filename: "myfile.txt", createDirs: true, allowedTypes: ['txt', 'doc', 'js'], callback: function(result) { console.log(result); }}} |
112-
113-
### MacGap.Task
114-
115-
Properties | description
116-
---------- | -----------
117-
isRunning | is task currently running, returns boolean
118-
waitUntilExit | primarily used as a setter, see NSTask reference for what this is
119-
arguments | set/get arguments to pass to task. Passed arguments need to be in the form of an array, i.e. task.arguments = ['arg1', 3, 'whatever'];
120-
environment | set's the tasks environment, defaults to app's environment
121-
122-
123-
Methods | Arguments | description
124-
-------- | --------- | ------------
125-
create | (string) path, (func) callback | path argument is to the executable for the task
126-
launch | none | launches task
127-
terminate | none | kills currently running task
128-
129-
130-
131-
### MacGap.Defaults
132-
133-
Properties | description
134-
---------- | -----------
135-
defaults | get defined defaults as js object
136-
137-
Methods | Arguments | description
138-
-------- | --------- | ------------
139-
set | (string) key, (any) value, (string) type | key and value are required, if type is omitted, the value is saved as a string.
140-
get | (string) key, (string) type | type is optional, if not defined, will return the keys value as a string. Accepted types are: "string", "int", "bool", "float", "url", "object"
141-
142-
143-
144-
## API Usage
145-
146-
147-
### Menus
148-
//add main menu item to a menu - everything but label is optional
149-
var myMenu = MacGap.Menu.addItem({label: 'My Label', index: 1 });
150-
151-
//add item to newly created menu
152-
myMenu.addItem({label: 'My Label', keys: 'cmd+t', callback: function() { ... } });
153-
154-
//add submenu to myMenu
155-
var sub = myMenu.addSubmenu('My Title');
156-
//add items
157-
sub.addItem({ ... });
158-
159-
160-
more to follow
161-
162-
163-
### StatusBar
164-
165-
//create simple status item
166-
MacGap.StatusItem.create({image:"path/to/image", alternateImage: "path/to/altimage"});
167-
168-
//create status item with click callback
169-
MacGap.StatusItem.create({image:"path/to/image", alternateImage: "path/to/altimage", onClick: function() { ... } });
170-
171-
//Create and add a menu to the statusbar. Note that adding a menu to a status item disables any onClick events
172-
// Setting the second 'type' parameter in the create method to 'statusbar' keeps MacGap from automatically adding sub-menus to the menu items you create (this is because the status items don't have a supermenu like the main menu)
173-
var menu = MacGap.Menu.create('My Menu', 'statusbar');
174-
175-
// add items to the menu
176-
menu.addItem('My Menu Item', '', 0, function() { alert('I was clicked!'); });
177-
menu.addItem('Another Menu Item', '', 1, function() { ... });
178-
179-
//add the menu to the status item
180-
MacGap.StatusItem.menu = menu;
181-
182-
5+
To submit an issue or ask for help, go to the GitHub issue queue at https://github.com/MacGapProject/MacGap2/issues

0 commit comments

Comments
 (0)