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

Side by Side Diff: chrome/browser/views/panel_controller.h

Issue 155075: Popup changes (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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 | « chrome/browser/gtk/tabs/tab_strip_gtk.cc ('k') | chrome/browser/views/panel_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Name: svn:eol-style
+ LF
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_VIEWS_PANEL_CONTROLLER_H_
6 #define CHROME_BROWSER_VIEWS_PANEL_CONTROLLER_H_
7
8 #include <gtk/gtk.h>
9
10 #include "views/controls/button/button.h"
11
12 class BrowserWindowGtk;
13 typedef unsigned long XID;
14
15 namespace views {
16 class ImageButton;
17 class Label;
18 class MouseEvent;
19 class WidgetGtk;
20 }
21
22 // Controls interactions with the WM for popups / panels.
23 class PanelController : public views::ButtonListener {
24 public:
25 explicit PanelController(BrowserWindowGtk* browser_window);
26 virtual ~PanelController() {}
27
28 bool TitleMousePressed(const views::MouseEvent& event);
29 void TitleMouseReleased(const views::MouseEvent& event, bool canceled);
30 bool TitleMouseDragged(const views::MouseEvent& event);
31 bool PanelClientEvent(GdkEventClient* event);
32
33 void UpdateTitleBar();
34 void Close();
35 // ButtonListener methods.
36 virtual void ButtonPressed(views::Button* sender);
37
38 private:
39 class TitleContentView : public views::View {
40 public:
41 explicit TitleContentView(PanelController* panelController);
42 virtual ~TitleContentView() {}
43 virtual void Layout();
44 virtual bool OnMousePressed(const views::MouseEvent& event);
45 virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled);
46 virtual bool OnMouseDragged(const views::MouseEvent& event);
47
48 views::Label* title_label() { return title_label_; }
49 views::ImageButton* close_button() { return close_button_; }
50
51 private:
52 views::Label* title_label_;
53 views::ImageButton* close_button_;
54 PanelController* panel_controller_;
55 DISALLOW_COPY_AND_ASSIGN(TitleContentView);
56 };
57
58 // Dispatches client events to PanelController instances
59 static bool OnPanelClientEvent(
60 GtkWidget* widget,
61 GdkEventClient* event,
62 PanelController* panel_controller);
63
64 // Browser window containing content.
65 BrowserWindowGtk* browser_window_;
66 // Gtk object for content.
67 GtkWindow* panel_;
68 // X id for content.
69 XID panel_xid_;
70
71 // Views object representing title.
72 views::WidgetGtk* title_window_;
73 // Gtk object representing title.
74 GtkWidget* title_;
75 // X id representing title.
76 XID title_xid_;
77
78 // Views object, holds title and close button.
79 TitleContentView* title_content_;
80
81 // Is the panel expanded or collapsed?
82 bool expanded_;
83
84 // Is the mouse button currently down?
85 bool mouse_down_;
86
87 // Cursor's absolute position when the mouse button was pressed.
88 int mouse_down_abs_x_;
89 int mouse_down_abs_y_;
90
91 // Cursor's offset from the upper-left corner of the titlebar when the
92 // mouse button was pressed.
93 int mouse_down_offset_x_;
94 int mouse_down_offset_y_;
95
96 // Is the titlebar currently being dragged? That is, has the cursor
97 // moved more than kDragThreshold away from its starting position?
98 bool dragging_;
99
100 DISALLOW_COPY_AND_ASSIGN(PanelController);
101 };
102
103 #endif // CHROME_BROWSER_PANEL_CONTROLLER_H_
104
OLDNEW
« no previous file with comments | « chrome/browser/gtk/tabs/tab_strip_gtk.cc ('k') | chrome/browser/views/panel_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698