Button label centering with GTK+2
raananb
raanan at barzel.org
Tue May 20 14:25:41 PDT 2008
Tried different sequences, but no improvement. I did notice that the problem
is present with the larger font even if it is normal (not bold).
First try:
// existing code
gtk_button_set_label(GTK_BUTTON(m_widget), wxGTK_CONV(labelGTK));
gtk_button_set_use_stock(GTK_BUTTON(m_widget), FALSE);
// added code
float x_alignment = 0.5;
if (HasFlag(wxBU_LEFT))
x_alignment = 0.0;
else if (HasFlag(wxBU_RIGHT))
x_alignment = 1.0;
float y_alignment = 0.5;
if (HasFlag(wxBU_TOP))
y_alignment = 0.0;
else if (HasFlag(wxBU_BOTTOM))
y_alignment = 1.0;
gtk_button_set_alignment(GTK_BUTTON(m_widget), x_alignment,
y_alignment);
// existing code
ApplyWidgetStyle( false );
}
Second try:
// existing code
gtk_button_set_label(GTK_BUTTON(m_widget), wxGTK_CONV(labelGTK));
gtk_button_set_use_stock(GTK_BUTTON(m_widget), FALSE);
ApplyWidgetStyle( false );
// added code
float x_alignment = 0.5;
if (HasFlag(wxBU_LEFT))
x_alignment = 0.0;
else if (HasFlag(wxBU_RIGHT))
x_alignment = 1.0;
float y_alignment = 0.5;
if (HasFlag(wxBU_TOP))
y_alignment = 0.0;
else if (HasFlag(wxBU_BOTTOM))
y_alignment = 1.0;
gtk_button_set_alignment(GTK_BUTTON(m_widget), x_alignment,
y_alignment);
}
Third try:
// existing code
gtk_button_set_label(GTK_BUTTON(m_widget), wxGTK_CONV(labelGTK));
gtk_button_set_use_stock(GTK_BUTTON(m_widget), FALSE);
// added code
gtk_button_set_alignment(GTK_BUTTON(m_widget), 0.5, 0.5);
// existing code
ApplyWidgetStyle( false );
}
Vadim Zeitlin-4 wrote:
>
> On Mon, 19 May 2008 03:45:22 -0700 (PDT) raananb <raanan at barzel.org>
> wrote:
>
> r> Bold button label is rendered inadequately under GTK+2 (Ubuntu 8.04).
> r>
> r> In the picture Buttons.jpg both buttons have the same size and use the
> same
> r> font, the only difference is that the second is in bold. The label in
> bold
> r> is displayed off-center.
> r>
> r> Under Windows (Xp and Vista) both are centered correctly.
> r>
> r> http://erbarzel.club.fr/Buttons.jpg
>
> We probably need to call gtk_button_set_alignment() after changing the
> label, can you try if adding a call to it at the end of
> wxButton::SetLabel() helps?
>
> Thanks,
> VZ
>
> --
> TT-Solutions: wxWidgets consultancy and technical support
> http://www.tt-solutions.com/
>
> _______________________________________________
> wx-users mailing list
> wx-users at lists.wxwidgets.org
> http://lists.wxwidgets.org/mailman/listinfo/wx-users
>
>
--
View this message in context: http://www.nabble.com/Button-label-centering-with-GTK%2B2-tp17316490p17351255.html
Sent from the wxWidgets - Users mailing list archive at Nabble.com.
More information about the wx-users
mailing list