| 1 |
/* |
| 2 |
Copyright (C) 2002 Kai Sterker <[email protected]> |
| 3 |
Part of the Adonthell Project <http://adonthell.nongnu.org> |
| 4 |
|
| 5 |
Dlgedit is free software; you can redistribute it and/or modify |
| 6 |
it under the terms of the GNU General Public License as published by |
| 7 |
the Free Software Foundation; either version 2 of the License, or |
| 8 |
(at your option) any later version. |
| 9 |
|
| 10 |
Dlgedit is distributed in the hope that it will be useful, |
| 11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
GNU General Public License for more details. |
| 14 |
|
| 15 |
You should have received a copy of the GNU General Public License |
| 16 |
along with Dlgedit. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
*/ |
| 18 |
|
| 19 |
/** |
| 20 |
* @file gui_list_events.cc |
| 21 |
* |
| 22 |
* @author Kai Sterker |
| 23 |
* @brief Event-callbacks for the instant dialogue preview |
| 24 |
*/ |
| 25 |
|
| 26 |
#include "gui_list_events.h" |
| 27 |
#include "gui_dlgedit.h" |
| 28 |
|
| 29 |
// Node selected in preview |
| 30 |
void on_list_select (GtkTreeSelection *selection, gpointer user_data) |
| 31 |
{ |
| 32 |
GtkTreeModel *model; |
| 33 |
GtkTreeIter iter; |
| 34 |
|
| 35 |
// anything selected at all? |
| 36 |
if (gtk_tree_selection_get_selected (selection, &model, &iter)) |
| 37 |
{ |
| 38 |
DlgCircle* circle; |
| 39 |
gtk_tree_model_get (GTK_TREE_MODEL (model), &iter, 1, &circle, -1); |
| 40 |
|
| 41 |
GuiGraph *graph = GuiDlgedit::window->graph (); |
| 42 |
|
| 43 |
// change selection in the graph view |
| 44 |
graph->deselectNode (); |
| 45 |
graph->selectNode (circle); |
| 46 |
graph->centerNode (); |
| 47 |
} |
| 48 |
} |
| 49 |
|
| 50 |
// list resized -> update column width |
| 51 |
void on_list_resize (GtkWidget *widget, GdkRectangle *allocation, gpointer data) |
| 52 |
{ |
| 53 |
// set new size for each row |
| 54 |
GtkTreeIter iter; |
| 55 |
GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(widget)); |
| 56 |
|
| 57 |
if (gtk_tree_model_get_iter_first (model, &iter)) |
| 58 |
{ |
| 59 |
do |
| 60 |
{ |
| 61 |
gtk_list_store_set (GTK_LIST_STORE(model), &iter, 4, allocation->width - 10, -1); |
| 62 |
} |
| 63 |
while (gtk_tree_model_iter_next (model, &iter)); |
| 64 |
} |
| 65 |
} |