2014-08-18 05:36:00 +00:00
|
|
|
// Copyright (c) 2014 GitHub, Inc. All rights reserved.
|
|
|
|
// Use of this source code is governed by the MIT license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
#ifndef ATOM_BROWSER_UI_VIEWS_SUBMENU_BUTTON_H_
|
|
|
|
#define ATOM_BROWSER_UI_VIEWS_SUBMENU_BUTTON_H_
|
|
|
|
|
|
|
|
#include "ui/views/controls/button/menu_button.h"
|
|
|
|
|
|
|
|
namespace atom {
|
|
|
|
|
|
|
|
// Special button that used by menu bar to show submenus.
|
|
|
|
class SubmenuButton : public views::MenuButton {
|
|
|
|
public:
|
|
|
|
SubmenuButton(views::ButtonListener* listener,
|
|
|
|
const base::string16& title,
|
|
|
|
views::MenuButtonListener* menu_button_listener);
|
|
|
|
virtual ~SubmenuButton();
|
|
|
|
|
2014-08-18 06:12:12 +00:00
|
|
|
void SetAcceleratorVisibility(bool visible);
|
2014-08-18 05:36:00 +00:00
|
|
|
void SetUnderlineColor(SkColor color);
|
|
|
|
|
|
|
|
// views::MenuButton:
|
|
|
|
virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void GetUnderlinePosition(
|
|
|
|
const base::string16& text, int* start, int* end);
|
|
|
|
void GetCharacterPosition(
|
|
|
|
const base::string16& text, int index, int* pos);
|
|
|
|
|
2014-08-18 06:12:12 +00:00
|
|
|
bool show_underline_;
|
|
|
|
|
2014-08-18 05:36:00 +00:00
|
|
|
int underline_start_;
|
|
|
|
int underline_end_;
|
|
|
|
int text_width_;
|
|
|
|
int text_height_;
|
|
|
|
SkColor underline_color_;
|
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(SubmenuButton);
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace atom
|
|
|
|
|
|
|
|
#endif // ATOM_BROWSER_UI_VIEWS_SUBMENU_BUTTON_H_
|