CEBL  2.1
WidgetUtils.hpp
Go to the documentation of this file.
1 /*
2 * CEBL : CSU EEG Brain-Computer Interface Lab
3 *
4 * Author: Jeshua Bratman - jeshuabratman@gmail.com
5 *
6 * This file is part of CEBL.
7 *
8 * CEBL is free software; you can redistribute it and/or modify it.
9 * We only ask that if you use our code that you cite the source in
10 * your project or publication.
11 *
12 * EEG Group (www.cs.colostate.edu/eeg)
13 * Department of Computer Science
14 * Colorado State University
15 *
16 */
17 
26 #ifndef WIDGETUTILS_H
27 #define WIDGETUTILS_H
28 
29 //include gtk headers
30 #include <gtk/gtk.h>
31 
32 #include <string>
33 using std::string;
34 
36 {
37 private:
38  static GtkWidget *main_window;
39 
40 
41  //wait box variables
42  static gint pulseProgressBar(gpointer);
43  static void CB_waitBoxCancel(GtkWidget*, gpointer);
44  static void waitBox(bool, const char *, bool show_progress_bar = true);
45  static bool wait_box_open;
46  static GtkWidget *wait_box_btn_cancel;
47  static GtkWidget *wait_box_label_text;
48  static bool wait_box_cancelled;
49  static double wait_box_progress;
50 
51 public:
52  // Set up widget utilities
53  static void setMainWindow(GtkWidget *mw) { WidgetUtils::main_window = mw; }
54 
55  static GtkWidget* getMainWindow() { return(main_window); }
56 
58  static void Alert(const char * title, const char * text, GtkMessageType type);
59  static void Alert(const string, const string, GtkMessageType type);
60 
62  static void AlertWarning(const char * title, const char * text);
63  static void AlertWarning(const string, const string);
64 
66  static void AlertError(const char * title, const char * text);
67  static void AlertError(const string, const string);
68 
70  static bool Confirm(const char * title, const char * text, GtkMessageType type);
71  static bool Confirm(const char * title, const char * text);
72  static bool Confirm(const string, const string);
73  static bool Confirm(const string, const string, GtkMessageType type);
74 
76  static void waitBoxShow(const char * text,bool progress = true);
77  static void waitBoxSetText(const char * text);
78  static void waitBoxSetCancelAvailable(bool available);
79  static void waitBoxHide();
80  static bool waitBoxCancelled();
81  static void waitBoxSetProgress(double percent);
82 
83 
85  static string selectSaveFile(string extension = "");
86 
88  static string selectLoadFile();
89 };
90 #endif
91 
92