Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[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


Back to the top