Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: chrome/browser/gtk/tabs/tab_button_gtk.h

Issue 108035: Remove the no-longer used TabButtonGtk class. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/gtk/tabs/tab_button_gtk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2009 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_GTK_TABS_TAB_BUTTON_GTK_H_
6 #define CHROME_BROWSER_GTK_TABS_TAB_BUTTON_GTK_H_
7
8 #include <gdk/gdk.h>
9
10 #include "base/gfx/rect.h"
11 #include "chrome/browser/tabs/tab_strip_model.h"
12 #include "chrome/common/gfx/chrome_canvas.h"
13 #include "skia/include/SkBitmap.h"
14
15 ///////////////////////////////////////////////////////////////////////////////
16 // TabButtonGtk
17 //
18 // Performs hit-testing and rendering of a Tab button.
19 //
20 class TabButtonGtk {
21 public:
22 // Possible button states
23 enum ButtonState {
24 BS_NORMAL,
25 BS_HOT,
26 BS_PUSHED,
27 BS_COUNT
28 };
29
30 class Delegate {
31 public:
32 // Creates a clickable region of the button's visual representation used
33 // for hit-testing. Caller is responsible for destroying the region. If
34 // NULL is returned, the bounds of the button will be used for hit-testing.
35 virtual GdkRegion* MakeRegionForButton(
36 const TabButtonGtk* button) const = 0;
37
38 // Sent when the user activates the button, which is defined as a press
39 // and release of a mouse click over the button.
40 virtual void OnButtonActivate(const TabButtonGtk* button) = 0;
41 };
42
43 explicit TabButtonGtk(Delegate* delegate);
44 virtual ~TabButtonGtk();
45
46 // Returns the bounds of the button.
47 int x() const { return bounds_.x(); }
48 int y() const { return bounds_.y(); }
49 int width() const { return bounds_.width(); }
50 int height() const { return bounds_.height(); }
51
52 const gfx::Rect& bounds() const { return bounds_; }
53
54 // Sets the bounds of the button.
55 void set_bounds(const gfx::Rect& bounds) { bounds_ = bounds; }
56
57 // Checks whether |point| is inside the bounds of the button.
58 bool IsPointInBounds(const gfx::Point& point);
59
60 // Sent by the tabstrip when the mouse moves within this button. Mouse state
61 // is in |event|. Returns true if the tabstrip needs to be redrawn as a
62 // result of the motion.
63 bool OnMotionNotify(GdkEventMotion* event);
64
65 // Sent by the tabstrip when the mouse clicks within this button. Returns
66 // true if the tabstrip needs to be redrawn as a result of the click.
67 bool OnMousePress();
68
69 // Sent by the tabstrip when the mouse click is released.
70 void OnMouseRelease();
71
72 // Sent by the tabstrip when the mouse leaves this button. Returns true
73 // if the tabstrip needs to be redrawn as a result of the movement.
74 bool OnLeaveNotify();
75
76 // Paints the Tab button into |canvas|.
77 void Paint(ChromeCanvasPaint* canvas);
78
79 // Sets the image the button should use for the provided state.
80 void SetImage(ButtonState state, SkBitmap* bitmap);
81
82 private:
83 // When the tab animation completes, we send the widget a message to
84 // simulate a mouse moved event at the current mouse position. This tickles
85 // the button to show the "hot" state.
86 void HighlightTabButton();
87
88 // The images used to render the different states of this button.
89 SkBitmap images_[BS_COUNT];
90
91 // The current state of the button.
92 ButtonState state_;
93
94 // The current bounds of the button.
95 gfx::Rect bounds_;
96
97 // Set if the mouse is pressed anywhere inside the button.
98 bool mouse_pressed_;
99
100 // Delegate to receive button messages.
101 Delegate* delegate_;
102
103 DISALLOW_COPY_AND_ASSIGN(TabButtonGtk);
104 };
105
106 #endif // CHROME_BROWSER_GTK_TABS_TAB_BUTTON_GTK_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/gtk/tabs/tab_button_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698