Fix Debug building on Windows
[platform/framework/web/crosswalk-tizen.git] / atom / browser / ui / views / submenu_button.h
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.
4
5 #ifndef ATOM_BROWSER_UI_VIEWS_SUBMENU_BUTTON_H_
6 #define ATOM_BROWSER_UI_VIEWS_SUBMENU_BUTTON_H_
7
8 #include "ui/views/animation/ink_drop_highlight.h"
9 #include "ui/views/controls/button/menu_button.h"
10
11 namespace atom {
12
13 // Special button that used by menu bar to show submenus.
14 class SubmenuButton : public views::MenuButton {
15  public:
16   SubmenuButton(const base::string16& title,
17                 views::MenuButtonListener* menu_button_listener,
18                 const SkColor& background_color);
19   virtual ~SubmenuButton();
20
21   void SetAcceleratorVisibility(bool visible);
22   void SetUnderlineColor(SkColor color);
23
24   void SetEnabledColor(SkColor color);
25   void SetBackgroundColor(SkColor color);
26
27   base::char16 accelerator() const { return accelerator_; }
28
29   // views::MenuButton:
30   void OnPaint(gfx::Canvas* canvas) override;
31
32   // views::InkDropHostView:
33   std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override;
34   std::unique_ptr<views::InkDrop> CreateInkDrop() override;
35
36  private:
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);
42
43   base::char16 accelerator_;
44
45   bool show_underline_;
46
47   int underline_start_;
48   int underline_end_;
49   int text_width_;
50   int text_height_;
51   SkColor underline_color_;
52   SkColor background_color_;
53
54   DISALLOW_COPY_AND_ASSIGN(SubmenuButton);
55 };
56
57 }  // namespace atom
58
59 #endif  // ATOM_BROWSER_UI_VIEWS_SUBMENU_BUTTON_H_