electron/chrome/browser/ui/gtk/gtk_util.h

37 lines
1.3 KiB
C
Raw Normal View History

2014-03-12 12:38:52 +00:00
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
2014-03-16 00:39:43 +00:00
#ifndef CHROME_BROWSER_UI_GTK_GTK_UTIL_H_
#define CHROME_BROWSER_UI_GTK_GTK_UTIL_H_
2014-03-12 12:38:52 +00:00
#include <gtk/gtk.h>
#include <string>
namespace gtk_util {
// Left-align the given GtkMisc and return the same pointer.
GtkWidget* LeftAlignMisc(GtkWidget* misc);
// Create a left-aligned label with the given text in bold.
GtkWidget* CreateBoldLabel(const std::string& text);
2014-03-14 12:42:39 +00:00
// Show the image for the given menu item, even if the user's default is to not
// show images. Only to be used for favicons or other menus where the image is
// crucial to its functionality.
void SetAlwaysShowImage(GtkWidget* image_menu_item);
2014-03-12 12:38:52 +00:00
// Checks whether a widget is actually visible, i.e. whether it and all its
// ancestors up to its toplevel are visible.
bool IsWidgetAncestryVisible(GtkWidget* widget);
// Sets the given label's size request to |pixel_width|. This will cause the
// label to wrap if it needs to. The reason for this function is that some
// versions of GTK mis-align labels that have a size request and line wrapping,
// and this function hides the complexity of the workaround.
void SetLabelWidth(GtkWidget* label, int pixel_width);
} // namespace gtk_util
2014-03-16 00:39:43 +00:00
#endif // CHROME_BROWSER_UI_GTK_GTK_UTIL_H_