1 /* gtk_support.h
2  * Definitions for GTK Support
3  *
4  * Yersinia
5  * By David Barroso <tomac@yersinia.net> and Alfredo Andres <aandreswork@hotmail.com>
6  * Copyright 2005-2017 Alfredo Andres and David Barroso
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21  */
22 
23 #ifndef __GTK_SUPPORT_H__
24 #define __GTK_SUPPORT_H__
25 
26 #ifdef HAVE_CONFIG_H
27 #  include <config.h>
28 #endif
29 
30 #include <gtk/gtk.h>
31 
32 /*
33  * Standard gettext macros.
34  */
35 #ifdef ENABLE_NLS
36 #  include <libintl.h>
37 #  undef _
38 #  define _(String) dgettext (PACKAGE, String)
39 #  define Q_(String) g_strip_context ((String), gettext (String))
40 #  ifdef gettext_noop
41 #    define N_(String) gettext_noop (String)
42 #  else
43 #    define N_(String) (String)
44 #  endif
45 #else
46 #  define textdomain(String) (String)
47 #  define gettext(String) (String)
48 #  define dgettext(Domain,Message) (Message)
49 #  define dcgettext(Domain,Message,Type) (Message)
50 #  define bindtextdomain(Domain,Directory) (Domain)
51 #  define _(String) (String)
52 #  define Q_(String) g_strip_context ((String), (String))
53 #  define N_(String) (String)
54 #endif
55 
56 
57 /*
58  * Public Functions.
59  */
60 
61 /*
62  * This function returns a widget in a component created by Glade.
63  * Call it with the toplevel widget in the component (i.e. a window/dialog),
64  * or alternatively any widget in the component, and the name of the widget
65  * you want returned.
66  */
67 GtkWidget*  lookup_widget              (GtkWidget       *widget,
68                                         const gchar     *widget_name);
69 
70 
71 /* Use this function to set the directory containing installed pixmaps. */
72 void        add_pixmap_directory       (const gchar     *directory);
73 
74 
75 /*
76  * Private Functions.
77  */
78 
79 /* This is used to create the pixmaps used in the interface. */
80 GtkWidget*  create_pixmap              (GtkWidget       *widget,
81                                         const gchar     *filename);
82 
83 /* This is used to create the pixbufs used in the interface. */
84 GdkPixbuf*  create_pixbuf              (const gchar     *filename);
85 
86 /* This is used to set ATK action descriptions. */
87 void        glade_set_atk_action_description (AtkAction       *action,
88                                               const gchar     *action_name,
89                                               const gchar     *description);
90 
91 
92 struct gtk_s_helper {
93     struct term_node *node;
94     u_int8_t mode;
95     u_int8_t row;
96     u_int8_t extra;
97     GtkWidget *notebook;
98     GtkTooltips *tooltips;
99     GtkTreeSelection *select;
100     GtkWidget *statusbar;
101     u_int8_t edit_mode;
102     struct _attack_definition *attack_def;
103     struct attack_param *attack_param;
104 };
105 
106 
107 typedef struct _GTK_ATTACK_CONTEXT_ {
108     GtkWidget *dialog ;      /* Attacks list main dialog */
109     GtkWidget *h_box ;       /* Horizontal box where the current attack lies, useful for disabling graphically... */
110     struct term_node *node ;
111     u_int8_t protocol ;
112     u_int8_t attack ;
113 } GTK_ATTACK_CONTEXT ;
114 
115 
116 typedef struct _GTK_DIALOG_ATTACK_CONTEXT_ {
117     GtkWidget *dialog ;      /* Attacks list main dialog */
118     struct term_node *node ;
119     GTK_ATTACK_CONTEXT *enabled_attacks_list ;
120 } GTK_DIALOG_ATTACK_CONTEXT ;
121 
122 
123 typedef struct _GTK_ATTACK_PARAMS_CONTEXT_ {
124     struct gtk_s_helper *helper ;
125     GtkWidget *dialog ;           /* Attacks parameters dialog */
126     GtkWidget **vh_entry ;        /* Widget list relating to attack parameters */
127     u_int8_t nparams ;            /* parameters count */
128     struct attack_param *params_list ;
129     int8_t attack_status ;
130 } GTK_ATTACK_PARAMS_CONTEXT ;
131 
132 
133 #endif
134