mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-02 15:11:00 +00:00
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:
parent
33b7008612
commit
0fe5f8dae5
4 changed files with 83 additions and 2 deletions
|
@ -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>
|
Fri Jan 31 05:30:40 1997 Scott Christley <scottc@net-community.com>
|
||||||
|
|
||||||
* Move and install resources to a more appropriate place.
|
* Move and install resources to a more appropriate place.
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include <AppKit/stdappkit.h>
|
#include <AppKit/stdappkit.h>
|
||||||
#include <AppKit/NSControl.h>
|
#include <AppKit/NSControl.h>
|
||||||
#include <Foundation/NSCoder.h>
|
#include <Foundation/NSCoder.h>
|
||||||
|
#include <AppKit/NSColor.h>
|
||||||
|
|
||||||
@interface NSColorWell : NSControl <NSCoding>
|
@interface NSColorWell : NSControl <NSCoding>
|
||||||
|
|
||||||
|
@ -40,6 +41,9 @@
|
||||||
NSColor *the_color;
|
NSColor *the_color;
|
||||||
BOOL is_active;
|
BOOL is_active;
|
||||||
BOOL is_bordered;
|
BOOL is_bordered;
|
||||||
|
|
||||||
|
// Reserved for back-end use
|
||||||
|
void *be_cwell_reserved;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -75,4 +79,13 @@
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
//
|
||||||
|
// GNUstep backend methods
|
||||||
|
//
|
||||||
|
@interface NSColorWell (GNUstepBackend)
|
||||||
|
|
||||||
|
- (void)drawBorderRect:(NSRect)aRect;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
#endif // _GNUstep_H_NSColorWell
|
#endif // _GNUstep_H_NSColorWell
|
||||||
|
|
|
@ -45,14 +45,30 @@
|
||||||
//
|
//
|
||||||
// Instance methods
|
// Instance methods
|
||||||
//
|
//
|
||||||
|
- initWithFrame:(NSRect)frameRect
|
||||||
|
{
|
||||||
|
[super initWithFrame: frameRect];
|
||||||
|
|
||||||
|
is_bordered = YES;
|
||||||
|
is_active = NO;
|
||||||
|
the_color = [NSColor blackColor];
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Drawing
|
// Drawing
|
||||||
//
|
//
|
||||||
- (void)drawRect:(NSRect)rect
|
- (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];
|
[self drawWellInside: rect];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,3 +149,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
//
|
||||||
|
// GNUstep backend methods
|
||||||
|
//
|
||||||
|
@implementation NSColorWell (GNUstepBackend)
|
||||||
|
|
||||||
|
- (void)drawBorderRect:(NSRect)aRect
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
|
@ -194,10 +194,22 @@ NSString *NSViewFocusChangedNotification;
|
||||||
- (void)addSubview:(NSView *)aView
|
- (void)addSubview:(NSView *)aView
|
||||||
{
|
{
|
||||||
// Not a NSView --then forget it
|
// 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]])
|
if (![aView isKindOfClass:[NSView class]])
|
||||||
{
|
{
|
||||||
return;
|
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
|
// retain the object
|
||||||
[aView retain];
|
[aView retain];
|
||||||
|
@ -214,9 +226,14 @@ NSString *NSViewFocusChangedNotification;
|
||||||
relativeTo:(NSView *)otherView
|
relativeTo:(NSView *)otherView
|
||||||
{
|
{
|
||||||
// Not a NSView --then forget it
|
// 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;
|
if (![aView isKindOfClass:[NSView class]]) return;
|
||||||
|
#endif
|
||||||
|
|
||||||
// retain the object
|
// retain the object
|
||||||
[aView retain];
|
[aView retain];
|
||||||
|
|
||||||
// Add to our subview list
|
// Add to our subview list
|
||||||
|
@ -245,7 +262,12 @@ NSString *NSViewFocusChangedNotification;
|
||||||
BOOL found = NO;
|
BOOL found = NO;
|
||||||
|
|
||||||
// Not a NSView --then forget it
|
// 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;
|
if (![aView isKindOfClass:[NSView class]]) return NO;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Quick check
|
// Quick check
|
||||||
if (aView == self) return YES;
|
if (aView == self) return YES;
|
||||||
|
@ -287,7 +309,12 @@ NSString *NSViewFocusChangedNotification;
|
||||||
NSView *v;
|
NSView *v;
|
||||||
|
|
||||||
// Not a NSView --then forget it
|
// 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;
|
if (![newView isKindOfClass:[NSView class]]) return;
|
||||||
|
#endif
|
||||||
|
|
||||||
j = [sub_views count];
|
j = [sub_views count];
|
||||||
for (i = 0;i < j; ++i)
|
for (i = 0;i < j; ++i)
|
||||||
|
@ -325,7 +352,12 @@ NSString *NSViewFocusChangedNotification;
|
||||||
- (void)setSuperview:(NSView *)superview
|
- (void)setSuperview:(NSView *)superview
|
||||||
{
|
{
|
||||||
// Not a NSView --then forget it
|
// 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;
|
if (![superview isKindOfClass:[NSView class]]) return;
|
||||||
|
#endif
|
||||||
|
|
||||||
super_view = superview;
|
super_view = superview;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue