Gtk.Button: resize internal padding

View: New views
5 Messages — Rating Filter:   Alert me  

Gtk.Button: resize internal padding

by alessiofachechi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, I'm creating a notebook widget with custom tab in which there is a close button. The problem is that there is a padding between button border and the contained icon image. How can I set it? This is my code:
public partial class EditorTab: Gtk.HBox
{
	private Label Title_ = new Label("");
	
	public string Title
	{
		get { return Title_.Text.ToString(); }
		set { Title_.Text = value; }
	}
	
	public EditorTab()
	{
		HBox DocIconBox = new HBox(false, 4);
		Image DocIcon = new Image("gtk-file", IconSize.Menu);
		DocIconBox.PackStart(DocIcon);
		DocIconBox.PackStart(Title_);
		
		Button CloseButton = new Button();
		CloseButton.Relief = ReliefStyle.None;
		CloseButton.FocusOnClick = false;
		CloseButton.Image = new Image("gtk-close", IconSize.Menu);
		//CloseButton.Clicked += delegate {};
		
		this.PackStart(DocIconBox);
		this.PackStart(CloseButton);
		this.ShowAll();
	}
}
I add all the class code for information. The close button is "CloseButton". I want to resize the padding like monodevelop tabs, firefox etc. How can I do this? Thanks..

Re: Gtk.Button: resize internal padding

by Chris Howie :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Jun 23, 2009 at 9:53 AM,
alessiofachechi<alessio.fachechi@...> wrote:
> Hi, I'm creating a notebook widget with custom tab in which there is a close
> button. The problem is that there is a padding between button border and the
> contained icon image. How can I set it? This is my code:

Try CloseButton.BorderWidth = 0;

--
Chris Howie
http://www.chrishowie.com
http://en.wikipedia.org/wiki/User:Crazycomputers
_______________________________________________
Gtk-sharp-list maillist  -  Gtk-sharp-list@...
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

Re: Gtk.Button: resize internal padding

by alessiofachechi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

No Chris.. I tried that property but it didn't worked..

Chris Howie wrote:
On Tue, Jun 23, 2009 at 9:53 AM,
alessiofachechi<alessio.fachechi@gmail.com> wrote:
> Hi, I'm creating a notebook widget with custom tab in which there is a close
> button. The problem is that there is a padding between button border and the
> contained icon image. How can I set it? This is my code:

Try CloseButton.BorderWidth = 0;

--
Chris Howie
http://www.chrishowie.com
http://en.wikipedia.org/wiki/User:Crazycomputers
_______________________________________________
Gtk-sharp-list maillist  -  Gtk-sharp-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

Parent Message unknown Re: Gtk.Button: resize internal padding

by Andrew York-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm sorry to say I have never been able to completly get rid of the button border no matter what I tried. I would suggest creating a custom widget inherited from Gtk.DrawingArea add your image on the onexpose event and override the button click event. This would give you a much greater control over the size of the widget.

I'm trying to remember this from memory but if you would like me to try to explain it further I'll see if I can find an example.

SpoodyGoon


From: "alessiofachechi" <alessio.fachechi@...>
Sent: Wednesday, June 24, 2009 8:21 AM
To: gtk-sharp-list@...
Subject: Re: [Gtk-sharp-list] Gtk.Button: resize internal padding



No Chris.. I tried that property but it didn't worked.. >-(


Chris Howie wrote:

>
> On Tue, Jun 23, 2009 at 9:53 AM,
> alessiofachechi wrote:
>> Hi, I'm creating a notebook widget with custom tab in which there is a
>> close
>> button. The problem is that there is a padding between button border and
>> the
>> contained icon image. How can I set it? This is my code:
>
> Try CloseButton.BorderWidth = 0;
>
> --
> Chris Howie
> http://www.chrishowie.com
> http://en.wikipedia.org/wiki/User:Crazycomputers
> _______________________________________________
> Gtk-sharp-list maillist - Gtk-sharp-list@...
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
>
>

--
View this message in context: http://www.nabble.com/Gtk.Button%3A-resize-internal-padding-tp24166514p24183723.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.

_______________________________________________
Gtk-sharp-list maillist - Gtk-sharp-list@...
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list


_______________________________________________
Gtk-sharp-list maillist  -  Gtk-sharp-list@...
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

Re: Gtk.Button: resize internal padding

by Chris Howie :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Jun 24, 2009 at 8:20 AM,
alessiofachechi<alessio.fachechi@...> wrote:
> No Chris.. I tried that property but it didn't worked.. >-(

I peeked at the MD sources and basically what you need to do is mess
with the GTK+ styling mechanism to set the inner-border property to 0.
 The most apparent way to do this from managed land is
Gtk.Rc.ParseString.

--
Chris Howie
http://www.chrishowie.com
http://en.wikipedia.org/wiki/User:Crazycomputers
_______________________________________________
Gtk-sharp-list maillist  -  Gtk-sharp-list@...
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list