gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSButtonCell value, contents and cell type implementation rewritten


From: Fred Kiefer
Subject: Re: NSButtonCell value, contents and cell type implementation rewritten
Date: Wed, 01 Sep 2004 23:30:10 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040114

Quentin Mathé wrote:
Le 30 août 04, à 21:06, Fred Kiefer a écrit :

Quentin Mathé wrote:

Well, here is the NSButtonCell.m patch but without the new methods disposition in order to ease the comparison between the previous NSButtonCell.m version and this new version…


Hi Quentin,

most of this patch looks nice to me. At one place you did remove the braces of an if statement and I don't see any reason for that. The GNUstep coding style expects them to be there. This is not allways the case in your actual code, but removing them is surely not right.


hmm… Where it is ?

Problems reading your own patch file? :-)
Its in [NSButtonCell setAlternateTitle:].


The only question I have with this patch is, if it would not be simpler to use a call to the setType: method in the class NSCell, instead of the direct setting of _cell.type and just overwrite that method in NSButtonCell to do nothing.


Well it was my first idea, but it isn't possible.

OK, but why not? A bit of explanation might help me see the light.


This does not work easyly with the current implementation of [NSCell setType:], but if we takle care to convert the type first and than to set attributes it should do.


To convert the type to what ? And which attributes ?


Currently we use _cell.type = NSTextCellType a lot in the code, for example in [NSCell setStringValue:]. We could replace this line with a call to [NSCell setType:]. Fine here but in [NSCell setFont:] we first set the font and than do the conversion. This is the wrong order, we should call setType: first and only set the font after this. You understand? When we use the method we need to take care of the order, nothing more nothing less. Than it should work, thats why I don't belive "it isn't possible".

Could you please test if Cocoa does call the method or if everything is done on the same low level as we do it.


The Cocoa behavior is explained in the patch :

+ * On Mac OS X, the NSButtonCell cell type is NSTextCellType by default or + * NSImageCellType if the initialization has been done with -initImageCell:,
+    * it should be noted that the cell type never changes later.


Thats exaclty what I thought in the init method this method is not called, but I would expect it to be called later on, but not to have any side effect. This would just be the way to implement it I described in my mail.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]