1// Copyright (c) 2011 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#ifndef CHROME_BROWSER_UI_GTK_ROUNDED_WINDOW_H_ 6#define CHROME_BROWSER_UI_GTK_ROUNDED_WINDOW_H_ 7#pragma once 8 9#include <gtk/gtk.h> 10 11namespace gtk_util { 12 13// Symbolic names for arguments to |rounded_edges| in ActAsRoundedWindow(). 14enum RoundedBorders { 15 ROUNDED_NONE = 0, 16 ROUNDED_BOTTOM_LEFT = 1 << 0, 17 ROUNDED_TOP_LEFT = 1 << 1, 18 ROUNDED_TOP_RIGHT = 1 << 2, 19 ROUNDED_TOP = (1 << 1) | (1 << 2), 20 ROUNDED_BOTTOM_RIGHT = 1 << 3, 21 ROUNDED_ALL = 0xF 22}; 23 24// Symbolic names for arguments to |drawn_borders| in ActAsRoundedWindow(). 25enum BorderEdge { 26 BORDER_NONE = 0, 27 BORDER_LEFT = 1 << 0, 28 BORDER_TOP = 1 << 1, 29 BORDER_RIGHT = 1 << 2, 30 BORDER_BOTTOM = 1 << 3, 31 BORDER_ALL = 0xF 32}; 33 34// Sets up the passed in widget that has its own GdkWindow with an expose 35// handler that forces the window shape into roundness. Caller should not set 36// an "expose-event" handler on |widget|; if caller needs to do custom 37// rendering, use SetRoundedWindowExposeFunction() instead. |rounded_edges| 38// control which corners are rounded. |drawn_borders| border control which 39// sides have a visible border drawn in |color|. 40void ActAsRoundedWindow( 41 GtkWidget* widget, const GdkColor& color, int corner_size, 42 int rounded_edges, int drawn_borders); 43 44// Undoes most of the actions of ActAsRoundedWindow(). 45void StopActingAsRoundedWindow(GtkWidget* widget); 46 47// Returns true if the window is rounded. 48bool IsActingAsRoundedWindow(GtkWidget* widget); 49 50// Sets edge and border properties on a widget that has already been configured 51// with ActAsRoundedWindow(). 52void SetRoundedWindowEdgesAndBorders(GtkWidget* widget, 53 int corner_size, 54 int rounded_edges, 55 int drawn_borders); 56 57// Sets the color of the border on a widget that has already been configured 58// with ActAsRoundedWindow(). 59void SetRoundedWindowBorderColor(GtkWidget* widget, GdkColor color); 60 61 62} // namespace gtk_util 63 64#endif // CHROME_BROWSER_UI_GTK_ROUNDED_WINDOW_H_ 65