gnustep-dev
[Top][All Lists]
Advanced

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

Re: [Gnustep-cvs] gnustep/core/gui ChangeLog Source/NSButtonCell.m


From: Quentin Mathé
Subject: Re: [Gnustep-cvs] gnustep/core/gui ChangeLog Source/NSButtonCell.m
Date: Mon, 8 Nov 2004 14:39:34 +0100

Le 8 nov. 04, à 13:19, Fred Kiefer a écrit :

Quentin Mathé wrote:

CVSROOT:        /cvsroot/gnustep Module name:   gnustep Branch: Changes by:
Quentin Mathé <address@hidden>    04/11/08 02:20:11
Modified files: core/gui       : ChangeLog core/gui/Source:
NSButtonCell.m
Log message: Fixed the possibility to call -setImagePosition: after
-setImage: broke with the previous commit

Hi Fred,

would you mind to explain these changes a bit? I remember well from your original patch, what you wanted to achive, which was as the possibility to have images and text in a button at the same time.

I don't understand what you mean here because it has always been possible to have a button which uses both an image and a text. My original patch was to have the possibility to call -image after -setTitle: or -setFont:, theses last two methods previously switched the cell to a text celland -image returns nil when the cell isn't an image cell… With your commit (NSButtonCell.m revision 1.90) the type is no more altered when you call -setTitle:, -setFont: or -setImage:, but there are still two problems :
- by default NSButtonCell uses a text cell then -image still returns nil
- setImagePosition: doesn't release the cell image when you call it with NSNoImage (this is the Cocoa behavior)
Next part, below…

From looking at the changed code I would say that this is still not possible, if you use setImagePosition: and setImage: or setTitle: in the wrong order.

It is now possible with the changed code, otherwise many -gui images wouldn't be used because it is a common practice to call -setImage: before -setImagePosition: in -gui.

Are you sure that changing the button cell type in setImagePosition: is what Apple does? If not we shouldn't be doing it ourselves.

I told you previously that Apple doesn't change the cell type in -setImagePosition: but I explained why it was a better solution in my opinion, and it seemed you agreed on this point.

From the original bug report (#10595) I would have guessed that overwritting the method image on NSBUttonCell to return what ever image is there, regardless of the cell type, would have done the trick. (If the requested behaviour is actually there on Cocoa)

It was my first idea when I attempted to solve the problem in February (Apple is doing that), may be we should do that and add code to just release the cell image when NSNoImage is set with setImagePosition:, but I tried to implement something nicer by binding the cell type -setImagePosition: value, and this change permits to release the cell image when NSNoImage is used by just switching the cell to a text cell (I call -[NSCell setType:] to do that) which seems logical…

This might look over simplistic, but why write loads of code, if a few lines could do? But than I don't have a Cocoa system to test this, so I may be totally off.

No, you aren't totally off :-). If you want to use the implementation you suggested because it is simpler than mine, well why not… I'm not against it… I thought I was able to do the best choice by being smarter, but may be the simplicity is the right solution ;-). It's up to you and Alex M. to decide on this point.

Quentin.

--
Quentin Mathé
address@hidden




reply via email to

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