1 | /*-------------------------------------------------------------------------------------------------------*\ |
---|
2 | | Adium, Copyright (C) 2001-2005, Adam Iser (adamiser@mac.com | http://www.adiumx.com) | |
---|
3 | \---------------------------------------------------------------------------------------------------------/ |
---|
4 | | This program is free software; you can redistribute it and/or modify it under the terms of the GNU |
---|
5 | | General Public License as published by the Free Software Foundation; either version 2 of the License, |
---|
6 | | or (at your option) any later version. |
---|
7 | | |
---|
8 | | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even |
---|
9 | | the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
---|
10 | | Public License for more details. |
---|
11 | | |
---|
12 | | You should have received a copy of the GNU General Public License along with this program; if not, |
---|
13 | | write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
14 | \------------------------------------------------------------------------------------------------------ */ |
---|
15 | |
---|
16 | @interface NSWindow (AIWindowAdditions) |
---|
17 | - (void)setContentSize:(NSSize)aSize display:(BOOL)displayFlag animate:(BOOL)animateFlag; |
---|
18 | - (BOOL)isTextured; |
---|
19 | - (void)setIgnoresExpose:(BOOL)flag; |
---|
20 | - (BOOL)isBorderless; |
---|
21 | - (void)betterCenter; |
---|
22 | - (float)toolbarHeight; |
---|
23 | |
---|
24 | - (NSResponder *)earliestResponderWhichRespondsToSelector:(SEL)selector andIsNotOfClass:(Class)classToAvoid; |
---|
25 | - (NSResponder *)earliestResponderOfClass:(Class)targetClass; |
---|
26 | @end |
---|
27 | |
---|
28 | // The following code is Copyright (C) 2003, 2004 Richard J Wareham <richwareham@users.sourceforge.net>, |
---|
29 | // distributed under the GNU General Public License (see above). |
---|
30 | |
---|
31 | /* These functions all return a status code. Typical CoreGraphics replies are: |
---|
32 | kCGErrorSuccess = 0, |
---|
33 | kCGErrorFirst = 1000, |
---|
34 | kCGErrorFailure = kCGErrorFirst, |
---|
35 | kCGErrorIllegalArgument = 1001, |
---|
36 | kCGErrorInvalidConnection = 1002, |
---|
37 | */ |
---|
38 | |
---|
39 | // Internal CoreGraphics typedefs |
---|
40 | |
---|
41 | typedef UInt32 WindowTags; |
---|
42 | typedef void *CGSWindowID; |
---|
43 | typedef void *CGSConnectionID; |
---|
44 | typedef int CGSValue; |
---|
45 | |
---|
46 | @class CICGSFilter; |
---|
47 | |
---|
48 | //// CONSTANTS //// |
---|
49 | |
---|
50 | /* Window ordering mode. */ |
---|
51 | typedef enum _CGSWindowIDOrderingMode { |
---|
52 | kCGSOrderAbove = 1, // Window is ordered above target. |
---|
53 | kCGSOrderBelow = -1, // Window is ordered below target. |
---|
54 | kCGSOrderOut = 0 // Window is removed from the on-screen window list. |
---|
55 | } CGSWindowIDOrderingMode; |
---|
56 | |
---|
57 | // Internal CoreGraphics functions. |
---|
58 | |
---|
59 | /* Retrieve the workspace number associated with the workspace currently |
---|
60 | * being shown. |
---|
61 | * |
---|
62 | * cid -- Current connection. |
---|
63 | * workspace -- Pointer to int value to be set to workspace number. |
---|
64 | */ |
---|
65 | extern OSStatus CGSGetWorkspace(const CGSConnectionID cid, int *workspace); |
---|
66 | |
---|
67 | /* Retrieve workspace number associated with the workspace a particular window |
---|
68 | * resides on. |
---|
69 | * |
---|
70 | * cid -- Current connection. |
---|
71 | * wid -- Window number of window to examine. |
---|
72 | * workspace -- Pointer to int value to be set to workspace number. |
---|
73 | */ |
---|
74 | extern OSStatus CGSGetWindowWorkspace(const CGSConnectionID cid, const CGSWindowID wid, int *workspace); |
---|
75 | |
---|
76 | /* Show workspace associated with a workspace number. |
---|
77 | * |
---|
78 | * cid -- Current connection. |
---|
79 | * workspace -- Workspace number. |
---|
80 | */ |
---|
81 | extern OSStatus CGSSetWorkspace(const CGSConnectionID cid, int workspace); |
---|
82 | |
---|
83 | extern OSStatus CGSSetWindowTransform(const CGSConnectionID cid, CGSWindowID wid, CGAffineTransform transform); |
---|
84 | extern OSStatus CGSGetWindowTransform(const CGSConnectionID cid, CGSWindowID wid, CGAffineTransform *outTransform); |
---|
85 | |
---|
86 | |
---|
87 | typedef enum { |
---|
88 | CGSNone = 0, // No transition effect. |
---|
89 | CGSFade, // Cross-fade. |
---|
90 | CGSZoom, // Zoom/fade towards us. |
---|
91 | CGSReveal, // Reveal new desktop under old. |
---|
92 | CGSSlide, // Slide old out and new in. |
---|
93 | CGSWarpFade, // Warp old and fade out revealing new. |
---|
94 | CGSSwap, // Swap desktops over graphically. |
---|
95 | CGSCube, // The well-known cube effect. |
---|
96 | CGSWarpSwitch // Warp old, switch and un-warp. |
---|
97 | } CGSTransitionType; |
---|
98 | |
---|
99 | typedef enum { |
---|
100 | CGSDown, // Old desktop moves down. |
---|
101 | CGSLeft, // Old desktop moves left. |
---|
102 | CGSRight, // Old desktop moves right. |
---|
103 | CGSInRight, // CGSSwap: Old desktop moves into screen, |
---|
104 | // new comes from right. |
---|
105 | CGSBottomLeft = 5, // CGSSwap: Old desktop moves to bl, |
---|
106 | // new comes from tr. |
---|
107 | CGSBottomRight, // Old desktop to br, New from tl. |
---|
108 | CGSDownTopRight, // CGSSwap: Old desktop moves down, new from tr. |
---|
109 | CGSUp, // Old desktop moves up. |
---|
110 | CGSTopLeft, // Old desktop moves tl. |
---|
111 | |
---|
112 | CGSTopRight, // CGSSwap: old to tr. new from bl. |
---|
113 | CGSUpBottomRight, // CGSSwap: old desktop up, new from br. |
---|
114 | CGSInBottom, // CGSSwap: old in, new from bottom. |
---|
115 | CGSLeftBottomRight, // CGSSwap: old one moves left, new from br. |
---|
116 | CGSRightBottomLeft, // CGSSwap: old one moves right, new from bl. |
---|
117 | CGSInBottomRight, // CGSSwap: onl one in, new from br. |
---|
118 | CGSInOut // CGSSwap: old in, new out. |
---|
119 | } CGSTransitionOption; |
---|
120 | |
---|
121 | extern OSStatus CGSSetWorkspaceWithTransition(const CGSConnectionID cid, |
---|
122 | int workspaceNumber, CGSTransitionType transition, CGSTransitionOption subtype, |
---|
123 | float time); |
---|
124 | |
---|
125 | /* Get the default connection for the current process. */ |
---|
126 | extern CGSConnectionID _CGSDefaultConnection(void); |
---|
127 | |
---|
128 | // thirtyTwo must = 32 for some reason. tags is pointer to |
---|
129 | //array ot ints (size 2?). First entry holds window tags. |
---|
130 | // 0x0800 is sticky bit. |
---|
131 | OSStatus CGSSetWindowTags( CGSConnectionID cgsID, CGSWindowID theWindow, SInt32 *theTags, SInt32 tagSize); |
---|
132 | OSStatus CGSGetWindowTags( CGSConnectionID cgsID, CGSWindowID theWindow, SInt32 *theTags, SInt32 tagSize); |
---|
133 | OSStatus CGSClearWindowTags(CGSConnectionID cgsID, CGSWindowID theWindow, SInt32 *theTags, SInt32 tagSize); |
---|
134 | |
---|
135 | // Get on-screen window counts and lists. |
---|
136 | extern OSStatus CGSGetOnScreenWindowCount(const CGSConnectionID cid, CGSConnectionID targetCID, int* outCount); |
---|
137 | extern OSStatus CGSGetOnScreenWindowList(const CGSConnectionID cid, CGSConnectionID targetCID, |
---|
138 | int count, int* list, int* outCount); |
---|
139 | |
---|
140 | // Per-workspace window counts and lists. |
---|
141 | extern OSStatus CGSGetWorkspaceWindowCount(const CGSConnectionID cid, int workspaceNumber, int *outCount); |
---|
142 | extern OSStatus CGSGetWorkspaceWindowList(const CGSConnectionID cid, int workspaceNumber, int count, |
---|
143 | int* list, int* outCount); |
---|
144 | |
---|
145 | // Gets the level of a window |
---|
146 | extern OSStatus CGSGetWindowLevel(const CGSConnectionID cid, CGSWindowID wid, |
---|
147 | int *level); |
---|
148 | |
---|
149 | // Window ordering |
---|
150 | extern OSStatus CGSOrderWindow(const CGSConnectionID cid, const CGSWindowID wid, |
---|
151 | CGSWindowIDOrderingMode place, CGSWindowID relativeToWindowID /* can be NULL */); |
---|
152 | |
---|
153 | // Gets the screen rect for a window. |
---|
154 | extern OSStatus CGSGetScreenRectForWindow(const CGSConnectionID cid, CGSWindowID wid, |
---|
155 | CGRect *outRect); |
---|
156 | |
---|
157 | // Window appearance/position |
---|
158 | extern OSStatus CGSSetWindowAlpha(const CGSConnectionID cid, const CGSWindowID wid, float alpha); |
---|
159 | extern OSStatus CGSMoveWindow(const CGSConnectionID cid, const CGSWindowID wid, CGPoint *point); |
---|
160 | |
---|
161 | // extern OSStatus CGSConnectionIDGetPID(const CGSConnectionID cid, pid_t *pid, CGSConnectionID b); |
---|
162 | |
---|
163 | extern OSStatus CGSGetWindowProperty(const CGSConnectionID cid, CGSWindowID wid, CGSValue key, |
---|
164 | CGSValue *outValue); |
---|
165 | |
---|
166 | //extern OSStatus CGSWindowIDAddRectToDirtyShape(const CGSConnectionID cid, const CGSWindowID wid, CGRect *rect); |
---|
167 | extern OSStatus CGSUncoverWindow(const CGSConnectionID cid, const CGSWindowID wid); |
---|
168 | extern OSStatus CGSFlushWindow(const CGSConnectionID cid, const CGSWindowID wid, int unknown /* 0 works */ ); |
---|
169 | |
---|
170 | extern OSStatus CGSGetWindowOwner(const CGSConnectionID cid, const CGSWindowID wid, CGSConnectionID *ownerCid); |
---|
171 | extern OSStatus CGSConnectionIDGetPID(const CGSConnectionID cid, pid_t *pid, const CGSConnectionID ownerCid); |
---|
172 | |
---|
173 | // Values |
---|
174 | extern CGSValue CGSCreateCStringNoCopy(const char *str); |
---|
175 | extern char* CGSCStringValue(CGSValue string); |
---|
176 | |
---|