1 // Copyright (c) 2014 GitHub, Inc.
2 // Use of this source code is governed by the MIT license that can be
3 // found in the LICENSE file.
5 #ifndef ATOM_BROWSER_UI_VIEWS_SUBMENU_BUTTON_H_
6 #define ATOM_BROWSER_UI_VIEWS_SUBMENU_BUTTON_H_
8 #include "ui/views/animation/ink_drop_highlight.h"
9 #include "ui/views/controls/button/menu_button.h"
13 // Special button that used by menu bar to show submenus.
14 class SubmenuButton : public views::MenuButton {
16 SubmenuButton(const base::string16& title,
17 views::MenuButtonListener* menu_button_listener,
18 const SkColor& background_color);
19 virtual ~SubmenuButton();
21 void SetAcceleratorVisibility(bool visible);
22 void SetUnderlineColor(SkColor color);
24 void SetEnabledColor(SkColor color);
25 void SetBackgroundColor(SkColor color);
27 base::char16 accelerator() const { return accelerator_; }
30 void OnPaint(gfx::Canvas* canvas) override;
32 // views::InkDropHostView:
33 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override;
34 std::unique_ptr<views::InkDrop> CreateInkDrop() override;
37 bool GetUnderlinePosition(const base::string16& text,
38 base::char16* accelerator,
39 int* start, int* end);
40 void GetCharacterPosition(
41 const base::string16& text, int index, int* pos);
43 base::char16 accelerator_;
51 SkColor underline_color_;
52 SkColor background_color_;
54 DISALLOW_COPY_AND_ASSIGN(SubmenuButton);
59 #endif // ATOM_BROWSER_UI_VIEWS_SUBMENU_BUTTON_H_