blob: 5e05e245212f00283442e08a937fbfb58f4bdb42 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
// Copyright (c) 2011 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 CHROME_BROWSER_UI_GTK_AVATAR_MENU_BUTTON_GTK_H_
#define CHROME_BROWSER_UI_GTK_AVATAR_MENU_BUTTON_GTK_H_
#pragma once
#include <gtk/gtk.h>
#include "chrome/browser/ui/gtk/bubble/bubble_gtk.h"
#include "ui/base/gtk/gtk_signal.h"
#include "ui/base/gtk/owned_widget_gtk.h"
class Browser;
class SkBitmap;
// A button used to show the profile avatar. When clicked, it opens the
// AvatarMenuBubbleGtk.
class AvatarMenuButtonGtk {
public:
explicit AvatarMenuButtonGtk(Browser* browser);
virtual ~AvatarMenuButtonGtk();
// Returns the button widget.
GtkWidget* widget() const { return widget_.get(); }
// Sets the location the arrow should be displayed on the menu bubble.
void set_menu_arrow_location(BubbleGtk::ArrowLocationGtk arrow_location) {
arrow_location_ = arrow_location;
}
// Sets the image to display on the button, typically the profile icon.
void SetIcon(const SkBitmap &icon);
private:
CHROMEGTK_CALLBACK_1(AvatarMenuButtonGtk, gboolean, OnButtonPressed,
GdkEventButton*);
// The button widget.
ui::OwnedWidgetGtk widget_;
// A weak pointer to the image widget displayed on the button.
GtkWidget* image_;
// A weak pointer to a browser. Used to create the bubble menu.
Browser* browser_;
// Which side of the bubble to display the arrow.
BubbleGtk::ArrowLocationGtk arrow_location_;
DISALLOW_COPY_AND_ASSIGN(AvatarMenuButtonGtk);
};
#endif // CHROME_BROWSER_UI_GTK_AVATAR_MENU_BUTTON_GTK_H_
|