Fill out implementation of NSColorWell.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@2178 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Scott Christley 1997-02-07 03:35:22 +00:00
parent 3db608f74f
commit 4fc633ec79
4 changed files with 83 additions and 2 deletions

View file

@ -1,3 +1,12 @@
Thu Feb 6 19:31:54 1997 GNUstep Development <gnustep@net-community.com>
* Fill out implementation of NSColorWell.
* Headers/gnustep/gui/NSColorWell.h: Add backend instance variable
and backend method.
* Source/NSColorWell.m: Initial implementation.
* NSView.m: Don't use -isKindOfClass: because it isn't working
as we expect with the backend classes doing a +poseAs:
Fri Jan 31 05:30:40 1997 Scott Christley <scottc@net-community.com>
* Move and install resources to a more appropriate place.

View file

@ -32,6 +32,7 @@
#include <AppKit/stdappkit.h>
#include <AppKit/NSControl.h>
#include <Foundation/NSCoder.h>
#include <AppKit/NSColor.h>
@interface NSColorWell : NSControl <NSCoding>
@ -40,6 +41,9 @@
NSColor *the_color;
BOOL is_active;
BOOL is_bordered;
// Reserved for back-end use
void *be_cwell_reserved;
}
//
@ -75,4 +79,13 @@
@end
//
// GNUstep backend methods
//
@interface NSColorWell (GNUstepBackend)
- (void)drawBorderRect:(NSRect)aRect;
@end
#endif // _GNUstep_H_NSColorWell

View file

@ -45,14 +45,30 @@
//
// Instance methods
//
- initWithFrame:(NSRect)frameRect
{
[super initWithFrame: frameRect];
is_bordered = YES;
is_active = NO;
the_color = [NSColor blackColor];
return self;
}
//
// Drawing
//
- (void)drawRect:(NSRect)rect
{
// xxx Draw border
NSLog(@"NSColorWell drawRect: %f %f %f %f\n", rect.origin.x, rect.origin.y,
rect.size.width, rect.size.height);
// Draw border
if (is_bordered)
[self drawBorderRect: rect];
// Draw the color inside
[self drawWellInside: rect];
}
@ -133,3 +149,14 @@
}
@end
//
// GNUstep backend methods
//
@implementation NSColorWell (GNUstepBackend)
- (void)drawBorderRect:(NSRect)aRect
{
}
@end

View file

@ -194,10 +194,22 @@ NSString *NSViewFocusChangedNotification;
- (void)addSubview:(NSView *)aView
{
// Not a NSView --then forget it
// xxx but NSView will really be the backend class
// so how do we check that its really a subclass of NSView
// and not of the backend class?
#if 0
if (![aView isKindOfClass:[NSView class]])
{
return;
}
#endif
// make sure we aren't making ourself a subview of ourself
if (self == aView)
{
NSLog(@"Attempt to make view a subview of itself\n");
return;
}
// retain the object
[aView retain];
@ -214,9 +226,14 @@ NSString *NSViewFocusChangedNotification;
relativeTo:(NSView *)otherView
{
// Not a NSView --then forget it
// xxx but NSView will really be the backend class
// so how do we check that its really a subclass of NSView
// and not of the backend class?
#if 0
if (![aView isKindOfClass:[NSView class]]) return;
#endif
// retain the object
// retain the object
[aView retain];
// Add to our subview list
@ -245,7 +262,12 @@ NSString *NSViewFocusChangedNotification;
BOOL found = NO;
// Not a NSView --then forget it
// xxx but NSView will really be the backend class
// so how do we check that its really a subclass of NSView
// and not of the backend class?
#if o
if (![aView isKindOfClass:[NSView class]]) return NO;
#endif
// Quick check
if (aView == self) return YES;
@ -287,7 +309,12 @@ NSString *NSViewFocusChangedNotification;
NSView *v;
// Not a NSView --then forget it
// xxx but NSView will really be the backend class
// so how do we check that its really a subclass of NSView
// and not of the backend class?
#if 0
if (![newView isKindOfClass:[NSView class]]) return;
#endif
j = [sub_views count];
for (i = 0;i < j; ++i)
@ -325,7 +352,12 @@ NSString *NSViewFocusChangedNotification;
- (void)setSuperview:(NSView *)superview
{
// Not a NSView --then forget it
// xxx but NSView will really be the backend class
// so how do we check that its really a subclass of NSView
// and not of the backend class?
#if 0
if (![superview isKindOfClass:[NSView class]]) return;
#endif
super_view = superview;
}