void wxAboutBox(const wxAboutDialogInfo& info, wxWindow* WXUNUSED(parent))
{
+ // don't create another dialog if one is already present
+ if ( !gs_aboutDialog )
+ gs_aboutDialog = GTK_ABOUT_DIALOG(gtk_about_dialog_new());
+
+ GtkAboutDialog * const dlg = gs_aboutDialog;
+ gtk_about_dialog_set_program_name(dlg, wxGTK_CONV_SYS(info.GetName()));
+ if ( info.HasVersion() )
+ gtk_about_dialog_set_version(dlg, wxGTK_CONV_SYS(info.GetVersion()));
+ else
+ gtk_about_dialog_set_version(dlg, NULL);
+ if ( info.HasCopyright() )
+ gtk_about_dialog_set_copyright(dlg, wxGTK_CONV_SYS(info.GetCopyrightToDisplay()));
+ else
+ gtk_about_dialog_set_copyright(dlg, NULL);
+ if ( info.HasDescription() )
+ gtk_about_dialog_set_comments(dlg, wxGTK_CONV_SYS(info.GetDescription()));
+ else
+ gtk_about_dialog_set_comments(dlg, NULL);
+ if ( info.HasLicence() )
+ gtk_about_dialog_set_license(dlg, wxGTK_CONV_SYS(info.GetLicence()));
+ else
+ gtk_about_dialog_set_license(dlg, NULL);
+
+ wxIcon icon = info.GetIcon();
+ if ( icon.IsOk() )
+ gtk_about_dialog_set_logo(dlg, info.GetIcon().GetPixbuf());
+
+ if ( info.HasWebSite() )
{
- // don't create another dialog if one is already present
- if ( !gs_aboutDialog )
- gs_aboutDialog = GTK_ABOUT_DIALOG(gtk_about_dialog_new());
-
- GtkAboutDialog * const dlg = gs_aboutDialog;
- gtk_about_dialog_set_program_name(dlg, wxGTK_CONV_SYS(info.GetName()));
- if ( info.HasVersion() )
- gtk_about_dialog_set_version(dlg, wxGTK_CONV_SYS(info.GetVersion()));
- else
- gtk_about_dialog_set_version(dlg, NULL);
- if ( info.HasCopyright() )
- gtk_about_dialog_set_copyright(dlg, wxGTK_CONV_SYS(info.GetCopyrightToDisplay()));
- else
- gtk_about_dialog_set_copyright(dlg, NULL);
- if ( info.HasDescription() )
- gtk_about_dialog_set_comments(dlg, wxGTK_CONV_SYS(info.GetDescription()));
- else
- gtk_about_dialog_set_comments(dlg, NULL);
- if ( info.HasLicence() )
- gtk_about_dialog_set_license(dlg, wxGTK_CONV_SYS(info.GetLicence()));
- else
- gtk_about_dialog_set_license(dlg, NULL);
-
- wxIcon icon = info.GetIcon();
- if ( icon.IsOk() )
- gtk_about_dialog_set_logo(dlg, info.GetIcon().GetPixbuf());
-
- if ( info.HasWebSite() )
- {
#ifdef __WXGTK3__
- g_signal_connect(dlg, "activate-link", G_CALLBACK(activate_link), dlg);
+ g_signal_connect(dlg, "activate-link", G_CALLBACK(activate_link), dlg);
#else
- // NB: must be called before gtk_about_dialog_set_website() as
- // otherwise it has no effect (although GTK+ docs don't mention
- // this...)
- gtk_about_dialog_set_url_hook(wxGtkAboutDialogOnLink, NULL, NULL);
+ // NB: must be called before gtk_about_dialog_set_website() as
+ // otherwise it has no effect (although GTK+ docs don't mention
+ // this...)
+ gtk_about_dialog_set_url_hook(wxGtkAboutDialogOnLink, NULL, NULL);
#endif
- gtk_about_dialog_set_website(dlg, wxGTK_CONV_SYS(info.GetWebSiteURL()));
- gtk_about_dialog_set_website_label
- (
- dlg,
- wxGTK_CONV_SYS(info.GetWebSiteDescription())
- );
- }
- else
- {
- gtk_about_dialog_set_website(dlg, NULL);
- gtk_about_dialog_set_website_label(dlg, NULL);
+ gtk_about_dialog_set_website(dlg, wxGTK_CONV_SYS(info.GetWebSiteURL()));
+ gtk_about_dialog_set_website_label
+ (
+ dlg,
+ wxGTK_CONV_SYS(info.GetWebSiteDescription())
+ );
+ }
+ else
+ {
+ gtk_about_dialog_set_website(dlg, NULL);
+ gtk_about_dialog_set_website_label(dlg, NULL);
#ifdef __WXGTK3__
- g_signal_connect(dlg, "activate-link", G_CALLBACK(activate_link), NULL);
+ g_signal_connect(dlg, "activate-link", G_CALLBACK(activate_link), NULL);
#else
- gtk_about_dialog_set_url_hook(NULL, NULL, NULL);
+ gtk_about_dialog_set_url_hook(NULL, NULL, NULL);
#endif
- }
+ }
- if ( info.HasDevelopers() )
- gtk_about_dialog_set_authors(dlg, GtkArray(info.GetDevelopers()));
- else
- gtk_about_dialog_set_authors(dlg, GtkArray());
- if ( info.HasDocWriters() )
- gtk_about_dialog_set_documenters(dlg, GtkArray(info.GetDocWriters()));
- else
- gtk_about_dialog_set_documenters(dlg, GtkArray());
- if ( info.HasArtists() )
- gtk_about_dialog_set_artists(dlg, GtkArray(info.GetArtists()));
- else
- gtk_about_dialog_set_artists(dlg, GtkArray());
-
- wxString transCredits;
- if ( info.HasTranslators() )
- {
- const wxArrayString& translators = info.GetTranslators();
- const size_t count = translators.size();
- for ( size_t n = 0; n < count; n++ )
- {
- transCredits << translators[n] << wxT('\n');
- }
- }
- else // no translators explicitly specified
+ if ( info.HasDevelopers() )
+ gtk_about_dialog_set_authors(dlg, GtkArray(info.GetDevelopers()));
+ else
+ gtk_about_dialog_set_authors(dlg, GtkArray());
+ if ( info.HasDocWriters() )
+ gtk_about_dialog_set_documenters(dlg, GtkArray(info.GetDocWriters()));
+ else
+ gtk_about_dialog_set_documenters(dlg, GtkArray());
+ if ( info.HasArtists() )
+ gtk_about_dialog_set_artists(dlg, GtkArray(info.GetArtists()));
+ else
+ gtk_about_dialog_set_artists(dlg, GtkArray());
+
+ wxString transCredits;
+ if ( info.HasTranslators() )
+ {
+ const wxArrayString& translators = info.GetTranslators();
+ const size_t count = translators.size();
+ for ( size_t n = 0; n < count; n++ )
{
- // maybe we have translator credits in the message catalog?
- wxString translator = _("translator-credits");
-
- // gtk_about_dialog_set_translator_credits() is smart enough to
- // detect if "translator-credits" is untranslated and hide the
- // translators tab in that case, however it will still show the
- // "credits" button, (at least GTK 2.10.6) even if there are no
- // credits informations at all, so we still need to do the check
- // ourselves
- if ( translator != wxT("translator-credits") ) // untranslated!
- transCredits = translator;
+ transCredits << translators[n] << wxT('\n');
}
+ }
+ else // no translators explicitly specified
+ {
+ // maybe we have translator credits in the message catalog?
+ wxString translator = _("translator-credits");
+
+ // gtk_about_dialog_set_translator_credits() is smart enough to
+ // detect if "translator-credits" is untranslated and hide the
+ // translators tab in that case, however it will still show the
+ // "credits" button, (at least GTK 2.10.6) even if there are no
+ // credits informations at all, so we still need to do the check
+ // ourselves
+ if ( translator != wxT("translator-credits") ) // untranslated!
+ transCredits = translator;
+ }
- if ( !transCredits.empty() )
- gtk_about_dialog_set_translator_credits(dlg, wxGTK_CONV_SYS(transCredits));
- else
- gtk_about_dialog_set_translator_credits(dlg, NULL);
+ if ( !transCredits.empty() )
+ gtk_about_dialog_set_translator_credits(dlg, wxGTK_CONV_SYS(transCredits));
+ else
+ gtk_about_dialog_set_translator_credits(dlg, NULL);
- g_signal_connect(dlg, "response",
- G_CALLBACK(wxGtkAboutDialogOnClose), NULL);
+ g_signal_connect(dlg, "response",
+ G_CALLBACK(wxGtkAboutDialogOnClose), NULL);
- gtk_window_present(GTK_WINDOW(dlg));
- }
+ gtk_window_present(GTK_WINDOW(dlg));
}
#endif // wxUSE_ABOUTDLG
}
else // have both label and bitmap
{
- {
- image = gtk_button_get_image(GTK_BUTTON(m_widget));
- }
+ image = gtk_button_get_image(GTK_BUTTON(m_widget));
}
wxCHECK_RET( image && GTK_IS_IMAGE(image), "must have image widget" );
}
// otherwise try icon themes
- {
- gint *sizes = gtk_icon_theme_get_icon_sizes
- (
- gtk_icon_theme_get_default(),
- stockid.utf8_str()
- );
- if ( !sizes )
- return bundle;
-
- gint *last = sizes;
- while ( *last )
- last++;
+ gint *sizes = gtk_icon_theme_get_icon_sizes
+ (
+ gtk_icon_theme_get_default(),
+ stockid.utf8_str()
+ );
+ if ( !sizes )
+ return bundle;
- bundle = DoCreateIconBundle
- (
- stockid.utf8_str(),
- sizes, last,
- &CreateThemeIcon
- );
- g_free(sizes);
- }
+ gint *last = sizes;
+ while ( *last )
+ last++;
+
+ bundle = DoCreateIconBundle
+ (
+ stockid.utf8_str(),
+ sizes, last,
+ &CreateThemeIcon
+ );
+ g_free(sizes);
return bundle;
}
{
m_label = label;
m_value = 0;
+ m_renderer = (GtkCellRenderer*) gtk_cell_renderer_progress_new();
- {
- m_renderer = (GtkCellRenderer*) gtk_cell_renderer_progress_new();
-
- SetMode(mode);
- SetAlignment(align);
+ SetMode(mode);
+ SetAlignment(align);
#if !wxUSE_UNICODE
- // We can't initialize the renderer just yet because we don't have the
- // pointer to the column that uses this renderer yet and so attempt to
- // dereference GetOwner() to get the font that is used as a source of
- // encoding in multibyte-to-Unicode conversion in GTKSetLabel() in
- // non-Unicode builds would crash. So simply remember to do it later.
- if ( !m_label.empty() )
- m_needsToSetLabel = true;
- else
+ // We can't initialize the renderer just yet because we don't have the
+ // pointer to the column that uses this renderer yet and so attempt to
+ // dereference GetOwner() to get the font that is used as a source of
+ // encoding in multibyte-to-Unicode conversion in GTKSetLabel() in
+ // non-Unicode builds would crash. So simply remember to do it later.
+ if ( !m_label.empty() )
+ m_needsToSetLabel = true;
+ else
#endif // !wxUSE_UNICODE
- {
- GTKSetLabel();
- }
+ {
+ GTKSetLabel();
}
}
bool wxDataViewProgressRenderer::SetValue( const wxVariant &value )
{
- {
#if !wxUSE_UNICODE
- if ( m_needsToSetLabel )
- GTKSetLabel();
+ if ( m_needsToSetLabel )
+ GTKSetLabel();
#endif // !wxUSE_UNICODE
- gint tmp = (long) value;
- GValue gvalue = { 0, };
- g_value_init( &gvalue, G_TYPE_INT );
- g_value_set_int( &gvalue, tmp );
- g_object_set_property( G_OBJECT(m_renderer), "value", &gvalue );
- g_value_unset( &gvalue );
- }
+ gint tmp = (long) value;
+ GValue gvalue = { 0, };
+ g_value_init( &gvalue, G_TYPE_INT );
+ g_value_set_int( &gvalue, tmp );
+ g_object_set_property( G_OBJECT(m_renderer), "value", &gvalue );
+ g_value_unset( &gvalue );
return true;
}
wxDataViewCellMode mode, int alignment ) :
wxDataViewCustomRenderer( "string", mode, alignment, true )
{
- m_choices = choices;
-
+ m_choices = choices;
+ m_renderer = (GtkCellRenderer*) gtk_cell_renderer_combo_new();
+ GtkListStore *store = gtk_list_store_new( 1, G_TYPE_STRING );
+ for (size_t n = 0; n < m_choices.GetCount(); n++)
{
- m_renderer = (GtkCellRenderer*) gtk_cell_renderer_combo_new();
-
- GtkListStore *store = gtk_list_store_new( 1, G_TYPE_STRING );
- for (size_t n = 0; n < m_choices.GetCount(); n++)
- {
- gtk_list_store_insert_with_values(
- store, NULL, n, 0,
- static_cast<const char *>(m_choices[n].utf8_str()), -1 );
- }
+ gtk_list_store_insert_with_values(
+ store, NULL, n, 0,
+ static_cast<const char *>(m_choices[n].utf8_str()), -1 );
+ }
- g_object_set (m_renderer,
- "model", store,
- "text-column", 0,
- "has-entry", FALSE,
- NULL);
+ g_object_set (m_renderer,
+ "model", store,
+ "text-column", 0,
+ "has-entry", FALSE,
+ NULL);
- bool editable = (mode & wxDATAVIEW_CELL_EDITABLE) != 0;
- g_object_set (m_renderer, "editable", editable, NULL);
+ bool editable = (mode & wxDATAVIEW_CELL_EDITABLE) != 0;
+ g_object_set (m_renderer, "editable", editable, NULL);
- SetAlignment(alignment);
+ SetAlignment(alignment);
- g_signal_connect_after( m_renderer, "edited", G_CALLBACK(wxGtkTextRendererEditedCallback), this );
+ g_signal_connect_after( m_renderer, "edited", G_CALLBACK(wxGtkTextRendererEditedCallback), this );
- GtkInitHandlers();
- }
+ GtkInitHandlers();
}
bool wxDataViewChoiceRenderer::Render( wxRect rect, wxDC *dc, int state )
bool wxDataViewChoiceRenderer::SetValue( const wxVariant &value )
{
-
- {
- GValue gvalue = { 0, };
- g_value_init( &gvalue, G_TYPE_STRING );
- g_value_set_string(&gvalue,
- wxGTK_CONV_FONT(value.GetString(),
- GetOwner()->GetOwner()->GetFont()));
- g_object_set_property( G_OBJECT(m_renderer), "text", &gvalue );
- g_value_unset( &gvalue );
- }
+ GValue gvalue = { 0, };
+ g_value_init( &gvalue, G_TYPE_STRING );
+ g_value_set_string(&gvalue,
+ wxGTK_CONV_FONT(value.GetString(),
+ GetOwner()->GetOwner()->GetFont()));
+ g_object_set_property( G_OBJECT(m_renderer), "text", &gvalue );
+ g_value_unset( &gvalue );
return true;
}
bool wxDataViewChoiceRenderer::GetValue( wxVariant &value ) const
{
- {
- GValue gvalue = { 0, };
- g_value_init( &gvalue, G_TYPE_STRING );
- g_object_get_property( G_OBJECT(m_renderer), "text", &gvalue );
- wxString temp = wxGTK_CONV_BACK_FONT(g_value_get_string(&gvalue),
- GetOwner()->GetOwner()->GetFont());
- g_value_unset( &gvalue );
- value = temp;
-
- //wxPrintf( "temp %s\n", temp );
- // TODO: remove this code
- }
+ GValue gvalue = { 0, };
+ g_value_init( &gvalue, G_TYPE_STRING );
+ g_object_get_property( G_OBJECT(m_renderer), "text", &gvalue );
+ wxString temp = wxGTK_CONV_BACK_FONT(g_value_get_string(&gvalue),
+ GetOwner()->GetOwner()->GetFont());
+ g_value_unset( &gvalue );
+ value = temp;
return true;
}
g_signal_connect (m_treeview, "size_allocate",
G_CALLBACK (gtk_dataviewctrl_size_callback), this);
- {
- bool fixed = (style & wxDV_VARIABLE_LINE_HEIGHT) == 0;
- gtk_tree_view_set_fixed_height_mode( GTK_TREE_VIEW(m_treeview), fixed );
- }
+ bool fixed = (style & wxDV_VARIABLE_LINE_HEIGHT) == 0;
+ gtk_tree_view_set_fixed_height_mode( GTK_TREE_VIEW(m_treeview), fixed );
if (style & wxDV_MULTIPLE)
{
if (!wxDataViewCtrlBase::AssociateModel( model ))
return false;
- {
- bool fixed = (((GetWindowStyle() & wxDV_VARIABLE_LINE_HEIGHT) == 0) || (model->IsVirtualListModel()));
- gtk_tree_view_set_fixed_height_mode( GTK_TREE_VIEW(m_treeview), fixed );
- }
+ bool fixed = (((GetWindowStyle() & wxDV_VARIABLE_LINE_HEIGHT) == 0) || (model->IsVirtualListModel()));
+ gtk_tree_view_set_fixed_height_mode( GTK_TREE_VIEW(m_treeview), fixed );
m_internal = new wxDataViewCtrlInternal( this, model );
m_cols.Append( col );
+ if (gtk_tree_view_column_get_sizing( GTK_TREE_VIEW_COLUMN(col->GetGtkHandle()) ) !=
+ GTK_TREE_VIEW_COLUMN_FIXED)
{
- if (gtk_tree_view_column_get_sizing( GTK_TREE_VIEW_COLUMN(col->GetGtkHandle()) ) !=
- GTK_TREE_VIEW_COLUMN_FIXED)
- gtk_tree_view_set_fixed_height_mode( GTK_TREE_VIEW(m_treeview), FALSE );
+ gtk_tree_view_set_fixed_height_mode( GTK_TREE_VIEW(m_treeview), FALSE );
}
gtk_tree_view_append_column( GTK_TREE_VIEW(m_treeview),
m_cols.Insert( col );
+ if (gtk_tree_view_column_get_sizing( GTK_TREE_VIEW_COLUMN(col->GetGtkHandle()) ) !=
+ GTK_TREE_VIEW_COLUMN_FIXED)
{
- if (gtk_tree_view_column_get_sizing( GTK_TREE_VIEW_COLUMN(col->GetGtkHandle()) ) !=
- GTK_TREE_VIEW_COLUMN_FIXED)
- gtk_tree_view_set_fixed_height_mode( GTK_TREE_VIEW(m_treeview), FALSE );
+ gtk_tree_view_set_fixed_height_mode( GTK_TREE_VIEW(m_treeview), FALSE );
}
gtk_tree_view_insert_column( GTK_TREE_VIEW(m_treeview),
m_cols.Insert( pos, col );
+ if (gtk_tree_view_column_get_sizing( GTK_TREE_VIEW_COLUMN(col->GetGtkHandle()) ) !=
+ GTK_TREE_VIEW_COLUMN_FIXED)
{
- if (gtk_tree_view_column_get_sizing( GTK_TREE_VIEW_COLUMN(col->GetGtkHandle()) ) !=
- GTK_TREE_VIEW_COLUMN_FIXED)
- gtk_tree_view_set_fixed_height_mode( GTK_TREE_VIEW(m_treeview), FALSE );
+ gtk_tree_view_set_fixed_height_mode( GTK_TREE_VIEW(m_treeview), FALSE );
}
gtk_tree_view_insert_column( GTK_TREE_VIEW(m_treeview),
wxCHECK_RET( IsOk(), wxT("invalid window dc") );
+ x = XLOG2DEV(x);
+ y = YLOG2DEV(y);
+
+ pango_layout_set_text(m_layout, wxGTK_CONV(text), -1);
+ const bool setAttrs = m_font.GTKSetPangoAttrs(m_layout);
+ int oldSize = 0;
+ const bool isScaled = fabs(m_scaleY - 1.0) > 0.00001;
+ if (isScaled)
{
- x = XLOG2DEV(x);
- y = YLOG2DEV(y);
+ //TODO: when Pango >= 1.6 is required, use pango_matrix_scale()
+ // If there is a user or actually any scale applied to
+ // the device context, scale the font.
- pango_layout_set_text(m_layout, wxGTK_CONV(text), -1);
- const bool setAttrs = m_font.GTKSetPangoAttrs(m_layout);
- int oldSize = 0;
- const bool isScaled = fabs(m_scaleY - 1.0) > 0.00001;
- if (isScaled)
- {
- //TODO: when Pango >= 1.6 is required, use pango_matrix_scale()
- // If there is a user or actually any scale applied to
- // the device context, scale the font.
+ // scale font description
+ oldSize = pango_font_description_get_size(m_fontdesc);
+ pango_font_description_set_size(m_fontdesc, int(oldSize * m_scaleY));
- // scale font description
- oldSize = pango_font_description_get_size(m_fontdesc);
- pango_font_description_set_size(m_fontdesc, int(oldSize * m_scaleY));
+ // actually apply scaled font
+ pango_layout_set_font_description( m_layout, m_fontdesc );
+ }
- // actually apply scaled font
- pango_layout_set_font_description( m_layout, m_fontdesc );
- }
+ int w, h;
+ pango_layout_get_pixel_size(m_layout, &w, &h);
- int w, h;
- pango_layout_get_pixel_size(m_layout, &w, &h);
-
- const GdkColor* bg_col = NULL;
- if (m_backgroundMode == wxBRUSHSTYLE_SOLID)
- bg_col = m_textBackgroundColour.GetColor();
-
- // rotate the text
- PangoMatrix matrix = PANGO_MATRIX_INIT;
- pango_matrix_rotate (&matrix, angle);
- pango_context_set_matrix (m_context, &matrix);
- pango_layout_context_changed (m_layout);
-
- // To be compatible with MSW, the rotation axis must be in the old
- // top-left corner.
- // Calculate the vertices of the rotated rectangle containing the text,
- // relative to the old top-left vertex.
- // We could use the matrix for this, but it's simpler with trignonometry.
- double rad = DegToRad(angle);
- // the rectangle vertices are counted clockwise with the first one
- // being at (0, 0)
- double x2 = w * cos(rad);
- double y2 = -w * sin(rad); // y axis points to the bottom, hence minus
- double x4 = h * sin(rad);
- double y4 = h * cos(rad);
- double x3 = x4 + x2;
- double y3 = y4 + y2;
- // Then we calculate max and min of the rotated rectangle.
- wxCoord maxX = (wxCoord)(dmax(dmax(0, x2), dmax(x3, x4)) + 0.5),
- maxY = (wxCoord)(dmax(dmax(0, y2), dmax(y3, y4)) + 0.5),
- minX = (wxCoord)(dmin(dmin(0, x2), dmin(x3, x4)) - 0.5),
- minY = (wxCoord)(dmin(dmin(0, y2), dmin(y3, y4)) - 0.5);
-
- gdk_draw_layout_with_colors(m_gdkwindow, m_textGC, x+minX, y+minY,
- m_layout, NULL, bg_col);
-
- if (setAttrs)
- pango_layout_set_attributes(m_layout, NULL);
-
- // clean up the transformation matrix
- pango_context_set_matrix(m_context, NULL);
+ const GdkColor* bg_col = NULL;
+ if (m_backgroundMode == wxBRUSHSTYLE_SOLID)
+ bg_col = m_textBackgroundColour.GetColor();
- if (isScaled)
- {
- // reset unscaled size
- pango_font_description_set_size( m_fontdesc, oldSize );
+ // rotate the text
+ PangoMatrix matrix = PANGO_MATRIX_INIT;
+ pango_matrix_rotate (&matrix, angle);
+ pango_context_set_matrix (m_context, &matrix);
+ pango_layout_context_changed (m_layout);
+
+ // To be compatible with MSW, the rotation axis must be in the old
+ // top-left corner.
+ // Calculate the vertices of the rotated rectangle containing the text,
+ // relative to the old top-left vertex.
+ // We could use the matrix for this, but it's simpler with trignonometry.
+ double rad = DegToRad(angle);
+ // the rectangle vertices are counted clockwise with the first one
+ // being at (0, 0)
+ double x2 = w * cos(rad);
+ double y2 = -w * sin(rad); // y axis points to the bottom, hence minus
+ double x4 = h * sin(rad);
+ double y4 = h * cos(rad);
+ double x3 = x4 + x2;
+ double y3 = y4 + y2;
+ // Then we calculate max and min of the rotated rectangle.
+ wxCoord maxX = (wxCoord)(dmax(dmax(0, x2), dmax(x3, x4)) + 0.5),
+ maxY = (wxCoord)(dmax(dmax(0, y2), dmax(y3, y4)) + 0.5),
+ minX = (wxCoord)(dmin(dmin(0, x2), dmin(x3, x4)) - 0.5),
+ minY = (wxCoord)(dmin(dmin(0, y2), dmin(y3, y4)) - 0.5);
+
+ gdk_draw_layout_with_colors(m_gdkwindow, m_textGC, x+minX, y+minY,
+ m_layout, NULL, bg_col);
- // actually apply unscaled font
- pango_layout_set_font_description( m_layout, m_fontdesc );
- }
+ if (setAttrs)
+ pango_layout_set_attributes(m_layout, NULL);
+
+ // clean up the transformation matrix
+ pango_context_set_matrix(m_context, NULL);
- CalcBoundingBox(x+minX, y+minY);
- CalcBoundingBox(x+maxX, y+maxY);
+ if (isScaled)
+ {
+ // reset unscaled size
+ pango_font_description_set_size( m_fontdesc, oldSize );
+
+ // actually apply unscaled font
+ pango_layout_set_font_description( m_layout, m_fontdesc );
}
+
+ CalcBoundingBox(x+minX, y+minY);
+ CalcBoundingBox(x+maxX, y+maxY);
}
void wxWindowDCImpl::DoGetTextExtent(const wxString &string,
gtk_label_set_justify(GTK_LABEL(m_widget), justify);
- {
- // set ellipsize mode
- PangoEllipsizeMode ellipsizeMode = PANGO_ELLIPSIZE_NONE;
- if ( style & wxST_ELLIPSIZE_START )
- ellipsizeMode = PANGO_ELLIPSIZE_START;
- else if ( style & wxST_ELLIPSIZE_MIDDLE )
- ellipsizeMode = PANGO_ELLIPSIZE_MIDDLE;
- else if ( style & wxST_ELLIPSIZE_END )
- ellipsizeMode = PANGO_ELLIPSIZE_END;
-
- gtk_label_set_ellipsize( GTK_LABEL(m_widget), ellipsizeMode );
- }
+ // set ellipsize mode
+ PangoEllipsizeMode ellipsizeMode = PANGO_ELLIPSIZE_NONE;
+ if ( style & wxST_ELLIPSIZE_START )
+ ellipsizeMode = PANGO_ELLIPSIZE_START;
+ else if ( style & wxST_ELLIPSIZE_MIDDLE )
+ ellipsizeMode = PANGO_ELLIPSIZE_MIDDLE;
+ else if ( style & wxST_ELLIPSIZE_END )
+ ellipsizeMode = PANGO_ELLIPSIZE_END;
+
+ gtk_label_set_ellipsize( GTK_LABEL(m_widget), ellipsizeMode );
// GTK_JUSTIFY_LEFT is 0, RIGHT 1 and CENTER 2
static const float labelAlignments[] = { 0.0, 1.0, 0.5 };
InvalidateBestSize();
- {
- (this->*setter)(GTK_LABEL(m_widget), label);
- }
+ (this->*setter)(GTK_LABEL(m_widget), label);
// adjust the label size to the new label unless disabled
if ( !HasFlag(wxST_NO_AUTORESIZE) &&
win->GetEventHandler()->ProcessEvent(eventShow);
}
- {
- // restore focus-on-map setting in case ShowWithoutActivating() was called
- gtk_window_set_focus_on_map(GTK_WINDOW(win->m_widget), true);
- }
+ // restore focus-on-map setting in case ShowWithoutActivating() was called
+ gtk_window_set_focus_on_map(GTK_WINDOW(win->m_widget), true);
return false;
}
{
if (!m_isShown)
{
- gtk_window_set_focus_on_map(GTK_WINDOW(m_widget), false);
-
+ gtk_window_set_focus_on_map(GTK_WINDOW(m_widget), false);
Show(true);
}
}
{
wxString usage;
+ // check whether GLib version is greater than 2.6 but also lower than 2.33
+ // because, as we use the undocumented _GOptionGroup struct, we don't want
+ // to run this code with future versions which might change it (2.32 is the
+ // latest one at the time of this writing)
+ if (glib_check_version(2,33,0))
{
- // since GTK>=2.6, we can use the glib_check_version() symbol...
+ usage << _("The following standard GTK+ options are also supported:\n");
- // check whether GLib version is greater than 2.6 but also lower than 2.33
- // because, as we use the undocumented _GOptionGroup struct, we don't want
- // to run this code with future versions which might change it (2.32 is the
- // latest one at the time of this writing)
- if (glib_check_version(2,33,0))
- {
- usage << _("The following standard GTK+ options are also supported:\n");
-
- // passing true here means that the function can open the default
- // display while parsing (not really used here anyhow)
- GOptionGroup *gtkOpts = gtk_get_option_group(true);
-
- // WARNING: here we access the internals of GOptionGroup:
- GOptionEntry *entries = ((_GOptionGroup*)gtkOpts)->entries;
- unsigned int n_entries = ((_GOptionGroup*)gtkOpts)->n_entries;
- wxArrayString namesOptions, descOptions;
+ // passing true here means that the function can open the default
+ // display while parsing (not really used here anyhow)
+ GOptionGroup *gtkOpts = gtk_get_option_group(true);
- for ( size_t n = 0; n < n_entries; n++ )
- {
- if ( entries[n].flags & G_OPTION_FLAG_HIDDEN )
- continue; // skip
+ // WARNING: here we access the internals of GOptionGroup:
+ GOptionEntry *entries = ((_GOptionGroup*)gtkOpts)->entries;
+ unsigned int n_entries = ((_GOptionGroup*)gtkOpts)->n_entries;
+ wxArrayString namesOptions, descOptions;
- names.push_back(wxGetNameFromGtkOptionEntry(&entries[n]));
+ for ( size_t n = 0; n < n_entries; n++ )
+ {
+ if ( entries[n].flags & G_OPTION_FLAG_HIDDEN )
+ continue; // skip
- const gchar * const entryDesc = entries[n].description;
- desc.push_back(wxString(entryDesc));
- }
+ names.push_back(wxGetNameFromGtkOptionEntry(&entries[n]));
- g_option_group_free (gtkOpts);
+ const gchar * const entryDesc = entries[n].description;
+ desc.push_back(wxString(entryDesc));
}
+
+ g_option_group_free (gtkOpts);
}
return usage;