Re: [Java-gnome-developer] Potential API issue with Table.attach() & AttachOptions?
Brought to you by:
afcowie
From: Stefan P. <pr...@tz...> - 2009-03-19 20:41:20
|
Hi Jacek, Am Donnerstag, den 19.03.2009, 15:42 -0400 schrieb Jacek Furmankiewicz: > I was looking at the Table.attach() method. I need to pass in a > combination of AttachOptions (e.g. FILL | EXPAND), just like you can > in Glade. Interesting. I admit I wasn't aware of the fact that you could combine the options. >From what I can say the fastest way would be to make the AttachOptions constructor public. Currently it is defined as private AttachOptions(int ordinal, String nickname) { super(ordinal, nickname); } I guess that the "ordinal" parameter should be the integer you are talking about. So you would use the class like this new AttachOptions(GtkAttachOptions.FILL|GtkAttachOptions.SHRINK, "FILL|SHRINK") Please, just make the constructor public, try it and give us feedback if this workaround would solve your problem. This has two drawbacks: 1. I am not sure how to deal with the "nickname" parameter in such a case. "FILL|SHRINK" was just a guess of mine. 2. It is extremly unelegant. Better perhaps would be to let AttachOptions have int constants and calculate a nickname within the constructor: public final static int SHRINK = GtkAttachOptions.SHRINK; public AttachOptions(int ordinal) { super(ordinal, AttachOptions.getNicknameFor(ordinal)); } private final static String getNicknameFor(int ordinal) { .. some StringBuffer magic ... } RFC Stefan |