mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 16:20:38 +00:00
Make _frame in -gui the window frame always. Add methods for converting to/from screen frames.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@19855 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d52db5f427
commit
8a4361bbae
7 changed files with 124 additions and 19 deletions
18
ChangeLog
18
ChangeLog
|
@ -1,3 +1,21 @@
|
|||
2004-08-09 14:38 Alexander Malmberg <alexander@malmberg.org>
|
||||
|
||||
* Headers/AppKit/NSWindow.h: _frame is the window frame.
|
||||
(+screenRectForFrameRect:styleMask:,
|
||||
+frameRectForScreenRect:styleMask:): New methods.
|
||||
* Source/GSDisplayServer.m (-window:::, -styleoffsets:::::):
|
||||
Update documentation.
|
||||
* Source/GSStandardWindowDecorationView.m
|
||||
(+screenOffsets::::forStyleMask:): Implement new method.
|
||||
* Source/GSWindowDecorationView.h (+screenRectForFrameRect:styleMask:,
|
||||
+frameRectForScreenRect:styleMask:): New methods.
|
||||
* Source/GSWindowDecorationView.m (+screenOffsets::::forStyleMask:,
|
||||
+screenRectForFrameRect:styleMask:,
|
||||
+frameRectForScreenRect:styleMask:): Implement them.
|
||||
* Source/NSWindow.m (+screenRectForFrameRect:styleMask:,
|
||||
+frameRectForScreenRect:styleMask:): Implement new methods.
|
||||
(-_initBackendWindow): Always update _wv's frame.
|
||||
|
||||
2004-08-08 Quentin Mathe <qmathe@club-internet.fr>
|
||||
|
||||
* Source/NSComboBox.m:
|
||||
|
|
|
@ -123,10 +123,12 @@ APPKIT_EXPORT NSSize NSTokenSize;
|
|||
|
||||
|
||||
To get coordinate transforms and stuff right wrt. OpenStep, we really want
|
||||
the window frame here. However, for hysterical reasons, _frame is actually
|
||||
the screen frame. (The other rectangles/sizes passed around in NSWindow
|
||||
methods are likely a mix of screen and window frames.) Only if -gui manages
|
||||
decorations will this match the semantics properly.
|
||||
the window frame here.
|
||||
|
||||
For hysterical reasons, _frame used to be the screen frame. However, the
|
||||
resulting inconsistencies caused a bunch of problems. Thus, _frame is the
|
||||
window frame. The other rectangles/sizes passed around in NSWindow
|
||||
methods are supposed to all be window frames.
|
||||
*/
|
||||
NSRect _frame;
|
||||
|
||||
|
@ -216,12 +218,22 @@ APPKIT_EXPORT NSSize NSTokenSize;
|
|||
/*
|
||||
* Computing frame and content rectangles
|
||||
*/
|
||||
|
||||
/* These methods convert between the various frames discussed above. */
|
||||
+ (NSRect) contentRectForFrameRect: (NSRect)aRect
|
||||
styleMask: (unsigned int)aStyle;
|
||||
|
||||
+ (NSRect) frameRectForContentRect: (NSRect)aRect
|
||||
styleMask: (unsigned int)aStyle;
|
||||
|
||||
+ (NSRect) screenRectForFrameRect: (NSRect)aRect
|
||||
styleMask: (unsigned int)aStyle;
|
||||
|
||||
+ (NSRect) frameRectForScreenRect: (NSRect)aRect
|
||||
styleMask: (unsigned int)aStyle;
|
||||
|
||||
/* Returns the smallest window width that will fit the given title and
|
||||
style. */
|
||||
+ (float) minFrameWidthWithTitle: (NSString *)aTitle
|
||||
styleMask: (unsigned int)aStyle;
|
||||
|
||||
|
|
|
@ -499,11 +499,13 @@ GSCurrentServer(void)
|
|||
|
||||
/** Creates a window whose location and size is described by frame and
|
||||
whose backing store is described by type. This window is not
|
||||
mapped to the screen by this call. Note that frame includes the title
|
||||
bar and all other window decorations. In many cases the window
|
||||
manager controls these aspects of the window. The actual drawable
|
||||
area of the window may vary depending on the window manager involved.
|
||||
Use -styleoffsets::::: to determine the extent of the window decorations.
|
||||
mapped to the screen by this call.
|
||||
|
||||
Note that frame is the frame of the drawable window and does not include
|
||||
any external window decorations. If handlesWindowDecorations returns YES,
|
||||
a window manager (or something equivalent) might add decorations outside
|
||||
the drawable window. Use -styleoffsets::::: to determine the extent of
|
||||
those decorations.
|
||||
*/
|
||||
- (int) window: (NSRect)frame : (NSBackingStoreType)type : (unsigned int)style
|
||||
{
|
||||
|
@ -654,9 +656,12 @@ GSCurrentServer(void)
|
|||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
/** Returns the dimensions of the window that are inside the window
|
||||
frame but are controlled by the window manager. For instance, t
|
||||
gives the height of the title bar for the window */
|
||||
/** Returns the dimensions of window decorations added outside the drawable
|
||||
window frame by a window manager or equivalent. For instance, t
|
||||
gives the height of the title bar for the window. The values returned
|
||||
may be approximations. If handlesWindowDecorations returns NO, there
|
||||
are no decorations outside the drawable window frame and this method
|
||||
shouldn't be called. */
|
||||
- (void) styleoffsets: (float*) l : (float*) r : (float*) t : (float*) b
|
||||
: (unsigned int) style
|
||||
{
|
||||
|
|
|
@ -64,6 +64,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
+(void) screenOffsets: (float *)l : (float *)r : (float *)t : (float *)b
|
||||
forStyleMask: (unsigned int)style
|
||||
{
|
||||
*l = *r = *r = *b = 0.0;
|
||||
}
|
||||
|
||||
+ (float) minFrameWidthWithTitle: (NSString *)aTitle
|
||||
styleMask: (unsigned int)aStyle
|
||||
{
|
||||
|
|
|
@ -39,6 +39,10 @@
|
|||
styleMask: (unsigned int)aStyle;
|
||||
- (NSRect) frameRectForContentRect: (NSRect)aRect
|
||||
styleMask: (unsigned int)aStyle;
|
||||
- (NSRect) screenRectForFrameRect: (NSRect)aRect
|
||||
styleMask: (unsigned int)aStyle;
|
||||
- (NSRect) frameRectForScreenRect: (NSRect)aRect
|
||||
styleMask: (unsigned int)aStyle;
|
||||
- (float) minFrameWidthWithTitle: (NSString *)aTitle
|
||||
styleMask: (unsigned int)aStyle;
|
||||
@end
|
||||
|
|
|
@ -74,6 +74,12 @@ GSWindowDecorationView implementation.
|
|||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
+(void) screenOffsets: (float *)l : (float *)r : (float *)t : (float *)b
|
||||
forStyleMask: (unsigned int)style
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
+ (NSRect) contentRectForFrameRect: (NSRect)aRect
|
||||
styleMask: (unsigned int)aStyle
|
||||
{
|
||||
|
@ -102,6 +108,34 @@ GSWindowDecorationView implementation.
|
|||
return aRect;
|
||||
}
|
||||
|
||||
+ (NSRect) screenRectForFrameRect: (NSRect)aRect
|
||||
styleMask: (unsigned int)aStyle
|
||||
{
|
||||
float t, b, l, r;
|
||||
|
||||
[self screenOffsets: &l : &r : &t : &b
|
||||
forStyleMask: aStyle];
|
||||
aRect.size.width += l + r;
|
||||
aRect.size.height += t + b;
|
||||
aRect.origin.x -= l;
|
||||
aRect.origin.y -= b;
|
||||
return aRect;
|
||||
}
|
||||
|
||||
+ (NSRect) frameRectForScreenRect: (NSRect)aRect
|
||||
styleMask: (unsigned int)aStyle
|
||||
{
|
||||
float t, b, l, r;
|
||||
|
||||
[self screenOffsets: &l : &r : &t : &b
|
||||
forStyleMask: aStyle];
|
||||
aRect.size.width -= l + r;
|
||||
aRect.size.height -= t + b;
|
||||
aRect.origin.x += l;
|
||||
aRect.origin.y += b;
|
||||
return aRect;
|
||||
}
|
||||
|
||||
+ (float) minFrameWidthWithTitle: (NSString *)aTitle
|
||||
styleMask: (unsigned int)aStyle
|
||||
{
|
||||
|
@ -265,9 +299,16 @@ Returns the content rect for a given window frame.
|
|||
|
||||
+(void) offsets: (float *)l : (float *)r : (float *)t : (float *)b
|
||||
forStyleMask: (unsigned int)style
|
||||
{
|
||||
*l = *r = *t = *b = 0.0;
|
||||
}
|
||||
|
||||
+(void) screenOffsets: (float *)l : (float *)r : (float *)t : (float *)b
|
||||
forStyleMask: (unsigned int)style
|
||||
{
|
||||
[GSCurrentServer() styleoffsets: l : r : t : b : style];
|
||||
}
|
||||
|
||||
+ (float) minFrameWidthWithTitle: (NSString *)aTitle
|
||||
styleMask: (unsigned int)aStyle
|
||||
{
|
||||
|
|
|
@ -609,6 +609,26 @@ static NSNotificationCenter *nc = nil;
|
|||
styleMask: aStyle];
|
||||
}
|
||||
|
||||
+ (NSRect) screenRectForFrameRect: (NSRect)aRect
|
||||
styleMask: (unsigned int)aStyle
|
||||
{
|
||||
if (!windowDecorator)
|
||||
windowDecorator = [GSWindowDecorationView windowDecorator];
|
||||
|
||||
return [windowDecorator screenRectForFrameRect: aRect
|
||||
styleMask: aStyle];
|
||||
}
|
||||
|
||||
+ (NSRect) frameRectForScreenRect: (NSRect)aRect
|
||||
styleMask: (unsigned int)aStyle
|
||||
{
|
||||
if (!windowDecorator)
|
||||
windowDecorator = [GSWindowDecorationView windowDecorator];
|
||||
|
||||
return [windowDecorator frameRectForScreenRect: aRect
|
||||
styleMask: aStyle];
|
||||
}
|
||||
|
||||
+ (float) minFrameWidthWithTitle: (NSString *)aTitle
|
||||
styleMask: (unsigned int)aStyle
|
||||
{
|
||||
|
@ -773,13 +793,12 @@ many times.
|
|||
_gstate = GSDefineGState(context);
|
||||
DPSgrestore(context);
|
||||
|
||||
if (NSIsEmptyRect([_wv frame]))
|
||||
{
|
||||
NSRect frame = _frame;
|
||||
frame.origin = NSZeroPoint;
|
||||
[_wv setFrame: frame];
|
||||
}
|
||||
[_wv setNeedsDisplay: YES];
|
||||
}
|
||||
|
||||
/* Ok, now add the drag types back */
|
||||
if (dragTypes)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue