"Fossies" - the Fresh Open Source Software Archive

Member "etherape-0.9.18/src/ui_utils.h" (14 Apr 2018, 2378 Bytes) of package /linux/privat/etherape-0.9.18.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "ui_utils.h" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 0.9.17_vs_0.9.18.

    1 /* EtherApe
    2  * Copyright (C) 2000 Juan Toledo, Riccardo Ghetta
    3  *
    4  * This program is free software; you can redistribute it and/or modify
    5  * it under the terms of the GNU General Public License as published by
    6  * the Free Software Foundation; either version 2 of the License, or
    7  * (at your option) any later version.
    8  *
    9  * This program is distributed in the hope that it will be useful,
   10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
   11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   12  * GNU General Public License for more details.
   13  *
   14  * You should have received a copy of the GNU General Public License
   15  * along with this program; if not, see <http://www.gnu.org/licenses/>.
   16  *
   17  * ui_utils: helper gui routines
   18  */
   19 
   20 #ifndef UI_UTILS_H
   21 #define UI_UTILS_H
   22 
   23 #include "appdata.h"
   24 #include <gtk/gtk.h>
   25 
   26 
   27 #define MAX_C(a,b) ((a) > (b) ? (a) : (b))
   28 #define MIN_C(a,b) ((a) > (b) ? (a) : (b))
   29 #define LUMINANCE(r,g,b) ((MAX_C( (double)(r)/0xFFFF, MAX_C( (double)(g)/0xFFFF, \
   30                                   (double)(b)/0xFFFF)) + \
   31                           MIN_C( (double)(r)/0xFFFF, MIN_C( (double)(g)/0xFFFF, \
   32                                   (double)(b)/0xFFFF))) / 2.0)
   33 
   34 
   35 /* returns a newly allocated string with a formatted traffic  */
   36 gchar *traffic_to_str(gdouble traffic, gboolean is_speed);
   37 
   38 /* registers the named glade widget on the specified object */
   39 void register_glade_widget(GtkBuilder *bldr, GtkWidget *tgt, const gchar *widgetName);
   40 
   41 /* changes text of label lblname on window wnd */
   42 void update_gtklabel(GtkWidget *wnd, const gchar *lblname, const gchar *value);
   43 
   44 /* show hide widget named lblname on window wnd */
   45 void show_widget(GtkWidget *wnd, const gchar *lblname);
   46 void hide_widget(GtkWidget *wnd, const gchar *lblname);
   47 
   48 /* creates a new text column with a specific title, column number colno and
   49  * adds it to treeview gv.  If r_just true the column is right justified */
   50 void create_add_text_column(GtkTreeView *gv, const gchar *title, int colno, 
   51                             gboolean r_just);
   52 
   53 /* register/get a treeview to/from a window */
   54 void register_treeview(GtkWidget *window, GtkTreeView *gv);
   55 GtkTreeView *retrieve_treeview(GtkWidget *window);
   56 
   57 /* Returns the user's home directory, via the HOME environment
   58  * variable, or a default directory if HOME is not set */
   59 const char *get_home_dir (void);
   60 
   61 #endif