Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

RemoveGadgetColor command added with Cocoa support

git-svn-id: https://maxgui.svn.sourceforge.net/svnroot/maxgui/trunk/maxgui.mod@10 e5cd03ac-f51b-44fd-988a-b6ea32b73a2e
  • Loading branch information...
commit a2d8d57fba222d6832bf1784a6a32bdc6148b563 1 parent 3087cdf
skidracer authored
View
45 cocoamaxgui.mod/cocoa.macos.m
@@ -774,9 +774,14 @@ -(BOOL)mouseDownCanMoveWindow{
return NO;
}
-(void)setColor:(NSColor *)rgb{
- if (color) [color release];
- color=[rgb colorWithAlphaComponent:1.0];
- [color retain];
+ if (color){
+ [color release];
+ color=0;
+ }
+ if(rgb){
+ color=[rgb colorWithAlphaComponent:1.0];
+ [color retain];
+ }
[self setNeedsDisplay:YES];
}
-(void)setImage:(NSImage *)img withFlags:(int)flags{
@@ -1529,7 +1534,12 @@ -(void)setTextColor:(NSColor*)color{
[self setInsertionPointColor:color];
}
-(void)setColor:(NSColor*)color{
- [self setBackgroundColor:color];
+ if(color){
+ [self setBackgroundColor:color];
+ [self setDrawsBackground:true];
+ }else{
+ [self setDrawsBackground:false];
+ }
}
-(void)setFont:(NSFont*)font{
[styles setObject:font forKey:NSFontAttributeName];
@@ -3294,6 +3304,32 @@ void NSRethink(nsgadget *gadget){
[view setNeedsDisplay:YES];
}
+void NSRemoveColor(nsgadget *gadget){
+ switch (gadget->internalclass){
+ case GADGET_BUTTON:
+ if ([[gadget->handle cell] respondsToSelector:@selector(setDrawsBackground)]){
+ [[gadget->handle cell] setDrawsBackground:false];
+ }
+ break;
+ case GADGET_WINDOW:
+ [gadget->handle setBackgroundColor:nil];
+ [gadget->handle display];
+ break;
+ case GADGET_LABEL:
+ if((gadget->style&3)==LABEL_SEPARATOR) break;
+ case GADGET_COMBOBOX:
+ case GADGET_TEXTFIELD:
+ [gadget->handle setDrawsBackground:false];
+ break;
+ case GADGET_LISTBOX:
+ case GADGET_TREEVIEW:
+ case GADGET_PANEL:
+ case GADGET_TEXTAREA:
+ [gadget->handle setColor:nil];
+ break;
+ }
+}
+
void NSSetColor(nsgadget *gadget,int r,int g,int b){
NSColor *color;
@@ -3303,6 +3339,7 @@ void NSSetColor(nsgadget *gadget,int r,int g,int b){
case GADGET_BUTTON:
if ([[gadget->handle cell] respondsToSelector:@selector(setBackgroundColor)]) [[gadget->handle cell] setBackgroundColor:color];
break;
+ case GADGET_COMBOBOX:
case GADGET_WINDOW:
[gadget->handle setBackgroundColor:color];
[gadget->handle display];
View
5 cocoamaxgui.mod/cocoagui.bmx
@@ -69,6 +69,7 @@ Extern
Function NSUnlockText(gadget:TNSGadget)
Function NSSetTabs(gadget:TNSGadget,tabs)
Function NSSetColor(gadget:TNSGadget,r,g,b)
+ Function NSRemoveColor(gadget:TNSGadget)
Function NSSetAlpha(gadget:TNSGadget,alpha#)
Function NSSetTextColor(gadget:TNSGadget,r,g,b)
Function NSGetCursorPos(gadget:TNSGadget,units)
@@ -581,6 +582,10 @@ Type TNSGadget Extends TGadget
NSSetColor Self,r,g,b
End Method
+ Method RemoveColor()
+ NSRemoveColor Self
+ End Method
+
Method SetAlpha(alpha#)
NSSetAlpha Self,alpha
End Method
View
1  cocoamaxgui.mod/cocoamaxgui.bmx
@@ -19,6 +19,7 @@ ModuleInfo "License: BSD License"
ModuleInfo "Copyright: Blitz Research Ltd."
ModuleInfo "History: 1.54 Release"
+ModuleInfo "History: Added RemoveGadgetColor support"
ModuleInfo "History: Removed use of NSPopoupButton for non editable ComboBoxes /topic=91200"
ModuleInfo "History: Reduced ambiguous use of gadget.(arg)name$ /topic=91292"
ModuleInfo "History: 1.53 Release"
Please sign in to comment.
Something went wrong with that request. Please try again.