gtk: Add gtk_util from Chromium.
This commit is contained in:
parent
6b9148127e
commit
e30fef09c8
3 changed files with 122 additions and 0 deletions
31
browser/ui/gtk/gtk_util.h
Normal file
31
browser/ui/gtk/gtk_util.h
Normal file
|
@ -0,0 +1,31 @@
|
|||
// 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.
|
||||
|
||||
#ifndef ATOM_BROWSER_UI_GTK_GTK_UTIL_H_
|
||||
#define ATOM_BROWSER_UI_GTK_GTK_UTIL_H_
|
||||
|
||||
#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);
|
||||
|
||||
// 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
|
||||
|
||||
#endif // ATOM_BROWSER_UI_GTK_GTK_UTIL_H_
|
Loading…
Add table
Add a link
Reference in a new issue