Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] Cocoa Buttons and vertical size

Kristian,
Thanks for the patches and continuing work. Sorry I haven't had a chance to review your work yet. Getting 3.4 out the door has been taking up all of our time recently.

As to where we change the style of the button, the answer is simple - we don't. That's a carbon behavior that we're getting for free. If I remember correctly Cocoa will just center the button in the space you specify.

In Control textExtent, we would probably not use instance variables, but just create the Cocoa objects as we need them. That decision could be revisited if performance became a problem, but we normally try to avoid instance variables when we can.
Kevin



Inactive hide details for Kristian Duske <4815162342n@xxxxxxxxx>Kristian Duske <4815162342n@xxxxxxxxx>


          Kristian Duske <4815162342n@xxxxxxxxx>
          Sent by: platform-swt-dev-bounces@xxxxxxxxxxx

          05/05/2008 12:35 PM

          Please respond to
          "Eclipse Platform SWT component developers list." <platform-swt-dev@xxxxxxxxxxx>

To

platform-swt-dev@xxxxxxxxxxx

cc


Subject

[platform-swt-dev] Cocoa Buttons and vertical size

Hi everyone,

I thought I'd help out with the Cocoa port. So far I have submitted a  
patch for
https://bugs.eclipse.org/bugs/show_bug.cgi?id=223390

and I'm working on
https://bugs.eclipse.org/bugs/show_bug.cgi?id=223391

I noticed that Cocoa push buttons don't support changing their  
vertical size, and in Carbon there is a workaround by changing the  
button style to flat, since flat buttons can be resized vertically. I  
am having a hard time to find out where this change in style is  
happening though - could someone give me a pointer? Does it happend  
somewhere in the Button class or is the layout manager responsible?

Also, in order to properly implement Button#computeSize(int, int,  
boolean), I had to implement Control#textExtent(NSAttributedString,  
int). I am using the Cocoa Text system for this, but that means  
creating a bunch of Cocoa objects each time the method is called.  
These objects can easily be reused to speed things up. I am wondering  
which of the following approaches is best:

- Store the objects as instance variables of the control object.
- Create an extra Class that offers a simpler interface for these  
kinds of calculations and store an instance of this class as an  
instance variable. (In which package should a utility class like this  
exist?)
- Don't use instance variables anywhere and do something else.

I'd be very thankful if some more experienced SWT programmers could  
give me some pointers.

Best regards
Kristian
_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev

GIF image

GIF image

GIF image


Back to the top