OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_GTK_TASK_MANAGER_GTK_H_ | 5 #ifndef CHROME_BROWSER_GTK_TASK_MANAGER_GTK_H_ |
6 #define CHROME_BROWSER_GTK_TASK_MANAGER_GTK_H_ | 6 #define CHROME_BROWSER_GTK_TASK_MANAGER_GTK_H_ |
7 | 7 |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 15 matching lines...) Expand all Loading... |
26 // existing task manager window. | 26 // existing task manager window. |
27 static void Show(); | 27 static void Show(); |
28 | 28 |
29 private: | 29 private: |
30 class ContextMenuController; | 30 class ContextMenuController; |
31 friend class ContextMenuController; | 31 friend class ContextMenuController; |
32 | 32 |
33 // Initializes the task manager dialog. | 33 // Initializes the task manager dialog. |
34 void Init(); | 34 void Init(); |
35 | 35 |
| 36 // Connects the ctrl-w accelerator to the dialog. |
| 37 void ConnectAccelerators(); |
| 38 |
36 // Sets up the treeview widget. | 39 // Sets up the treeview widget. |
37 void CreateTaskManagerTreeview(); | 40 void CreateTaskManagerTreeview(); |
38 | 41 |
39 // Returns the model data for a given |row| and |col_id|. | 42 // Returns the model data for a given |row| and |col_id|. |
40 std::string GetModelText(int row, int col_id); | 43 std::string GetModelText(int row, int col_id); |
41 | 44 |
42 // Retrieves the resource icon from the model for |row|. | 45 // Retrieves the resource icon from the model for |row|. |
43 GdkPixbuf* GetModelIcon(int row); | 46 GdkPixbuf* GetModelIcon(int row); |
44 | 47 |
45 // Sets the treeview row data. |row| is an index into the model and |iter| | 48 // Sets the treeview row data. |row| is an index into the model and |iter| |
(...skipping 18 matching lines...) Expand all Loading... |
64 TaskManagerGtk* task_manager); | 67 TaskManagerGtk* task_manager); |
65 | 68 |
66 // button-press-event handler that activates a process on double-click. | 69 // button-press-event handler that activates a process on double-click. |
67 static gboolean OnButtonPressEvent(GtkWidget* widget, GdkEventButton* event, | 70 static gboolean OnButtonPressEvent(GtkWidget* widget, GdkEventButton* event, |
68 TaskManagerGtk* task_manager); | 71 TaskManagerGtk* task_manager); |
69 | 72 |
70 // button-release-event handler that opens the right-click context menu. | 73 // button-release-event handler that opens the right-click context menu. |
71 static gboolean OnButtonReleaseEvent(GtkWidget* widget, GdkEventButton* event, | 74 static gboolean OnButtonReleaseEvent(GtkWidget* widget, GdkEventButton* event, |
72 TaskManagerGtk* task_manager); | 75 TaskManagerGtk* task_manager); |
73 | 76 |
| 77 // Handles an accelerator being pressed. |
| 78 static gboolean OnGtkAccelerator(GtkAccelGroup* accel_group, |
| 79 GObject* acceleratable, |
| 80 guint keyval, |
| 81 GdkModifierType modifier, |
| 82 TaskManagerGtk* task_manager); |
| 83 |
74 // The task manager. | 84 // The task manager. |
75 TaskManager* task_manager_; | 85 TaskManager* task_manager_; |
76 | 86 |
77 // Our model. | 87 // Our model. |
78 TaskManagerModel* model_; | 88 TaskManagerModel* model_; |
79 | 89 |
80 // The task manager dialog window. | 90 // The task manager dialog window. |
81 GtkWidget* dialog_; | 91 GtkWidget* dialog_; |
82 | 92 |
83 // The treeview that contains the process list. | 93 // The treeview that contains the process list. |
84 GtkWidget* treeview_; | 94 GtkWidget* treeview_; |
85 | 95 |
86 // The list of processes. | 96 // The list of processes. |
87 GtkListStore* process_list_; | 97 GtkListStore* process_list_; |
88 | 98 |
89 // The number of processes in |process_list_|. | 99 // The number of processes in |process_list_|. |
90 int process_count_; | 100 int process_count_; |
91 | 101 |
92 // The context menu controller. | 102 // The context menu controller. |
93 scoped_ptr<ContextMenuController> menu_controller_; | 103 scoped_ptr<ContextMenuController> menu_controller_; |
94 | 104 |
95 // An open task manager window. There can only be one open at a time. This | 105 // An open task manager window. There can only be one open at a time. This |
96 // is reset to NULL when the window is closed. | 106 // is reset to NULL when the window is closed. |
97 static TaskManagerGtk* instance_; | 107 static TaskManagerGtk* instance_; |
98 | 108 |
99 DISALLOW_COPY_AND_ASSIGN(TaskManagerGtk); | 109 DISALLOW_COPY_AND_ASSIGN(TaskManagerGtk); |
100 }; | 110 }; |
101 | 111 |
102 #endif // CHROME_BROWSER_GTK_TASK_MANAGER_GTK_H_ | 112 #endif // CHROME_BROWSER_GTK_TASK_MANAGER_GTK_H_ |
OLD | NEW |