25 #if !defined (octave_octave_link_h)
26 #define octave_octave_link_h 1
56 static void generate_events (
void)
59 instance->do_generate_events ();
65 static void process_events (
bool disable =
false)
70 instance->link_enabled =
false;
72 instance->do_process_events ();
76 static void discard_events (
void)
79 instance->do_discard_events ();
82 static bool exit (
int status)
87 retval = instance->do_exit (status);
93 static void post_event (T *obj,
void (T::*method) (
void))
96 instance->do_post_event (obj, method);
99 template <
class T,
class A>
100 static void post_event (T *obj,
void (T::*method) (
A),
A arg)
103 instance->do_post_event (obj, method, arg);
106 template <
class T,
class A>
107 static void post_event (T *obj,
void (T::*method) (
const A&),
const A&
arg)
110 instance->do_post_event (obj, method, arg);
113 template <
class T,
class A,
class B>
114 static void post_event (T *obj,
void (T::*method) (
const A&,
const B&),
115 const A& arg_a,
const B& arg_b)
118 instance->do_post_event (obj, method, arg_a, arg_b);
121 static void entered_readline_hook (
void)
124 instance->do_entered_readline_hook ();
127 static void finished_readline_hook (
void)
130 instance->do_finished_readline_hook ();
134 edit_file (
const std::string& file)
136 return enabled () ? instance->do_edit_file (file) :
false;
140 prompt_new_edit_file (
const std::string& file)
142 return enabled () ? instance->do_prompt_new_edit_file (file) :
false;
146 message_dialog (
const std::string& dlg,
const std::string& msg,
147 const std::string& title)
149 return enabled () ? instance->do_message_dialog (dlg, msg, title) : 0;
153 question_dialog (
const std::string& msg,
const std::string& title,
154 const std::string& btn1,
const std::string& btn2,
155 const std::string& btn3,
const std::string& btndef)
157 return enabled () ? instance->do_question_dialog (msg, title, btn1,
158 btn2, btn3, btndef) : 0;
161 static std::pair<std::list<int>,
int>
162 list_dialog (
const std::list<std::string>& list,
163 const std::string& mode,
164 int width,
int height,
165 const std::list<int>& initial_value,
166 const std::string& name,
167 const std::list<std::string>& prompt,
168 const std::string& ok_string,
169 const std::string& cancel_string)
172 ? instance->do_list_dialog (list, mode, width, height,
173 initial_value, name, prompt,
174 ok_string, cancel_string)
175 : std::pair<std::list<int>,
int> ();
178 static std::list<std::string>
179 input_dialog (
const std::list<std::string>& prompt,
180 const std::string& title,
181 const std::list<float>& nr,
182 const std::list<float>& nc,
183 const std::list<std::string>& defaults)
186 ? instance->do_input_dialog (prompt, title, nr, nc, defaults)
187 : std::list<std::string> ();
190 typedef std::list<std::pair<std::string, std::string> >
filter_list;
192 static std::list<std::string>
193 file_dialog (
const filter_list&
filter,
const std::string& title,
194 const std::string& filename,
const std::string& dirname,
195 const std::string& multimode)
198 ? instance->do_file_dialog (filter, title, filename, dirname,
200 : std::list<std::string> ();
204 static int debug_cd_or_addpath_error (
const std::string& file,
205 const std::string& dir,
209 ? instance->do_debug_cd_or_addpath_error (file, dir, addpath_option)
213 static void change_directory (
const std::string& dir)
216 instance->do_change_directory (dir);
220 static void execute_command_in_terminal (
const std::string& command)
223 instance->do_execute_command_in_terminal (command);
226 static void set_workspace (
void);
228 static void set_workspace (
bool top_level,
229 const std::list<workspace_element>& ws)
232 instance->do_set_workspace (top_level, ws);
235 static void clear_workspace (
void)
238 instance->do_clear_workspace ();
244 instance->do_set_history (hist);
247 static void append_history (
const std::string& hist_entry)
250 instance->do_append_history (hist_entry);
253 static void clear_history (
void)
256 instance->do_clear_history ();
259 static void pre_input_event (
void)
262 instance->do_pre_input_event ();
265 static void post_input_event (
void)
268 instance->do_post_input_event ();
271 static void enter_debugger_event (
const std::string& file,
int line)
275 instance->debugging =
true;
277 instance->do_enter_debugger_event (file, line);
281 static void execute_in_debugger_event (
const std::string& file,
int line)
284 instance->do_execute_in_debugger_event (file, line);
287 static void exit_debugger_event (
void)
289 if (enabled () && instance->debugging)
291 instance->debugging =
false;
293 instance->do_exit_debugger_event ();
298 update_breakpoint (
bool insert,
const std::string& file,
int line)
301 instance->do_update_breakpoint (insert, file, line);
310 instance->do_set_default_prompts (ps1, ps2, ps4);
313 static bool enabled (
void)
315 return instance_ok () ? instance->link_enabled :
false;
323 instance->do_show_preferences ();
331 show_doc (
const std::string & file)
335 instance->do_show_doc (file);
366 void do_generate_events (
void);
367 void do_process_events (
void);
368 void do_discard_events (
void);
371 void do_post_event (T *obj,
void (T::*method) (
void))
376 template <
class T,
class A>
377 void do_post_event (T *obj,
void (T::*method) (
A),
A arg)
379 gui_event_queue.
add_method (obj, method, arg);
382 template <
class T,
class A>
383 void do_post_event (T *obj,
void (T::*method) (
const A&),
const A&
arg)
385 gui_event_queue.
add_method (obj, method, arg);
391 virtual bool do_exit (
int status) = 0;
393 virtual bool do_edit_file (
const std::string& file) = 0;
394 virtual bool do_prompt_new_edit_file (
const std::string& file) = 0;
397 do_message_dialog (
const std::string& dlg,
const std::string& msg,
398 const std::string& title) = 0;
401 do_question_dialog (
const std::string& msg,
const std::string& title,
402 const std::string& btn1,
const std::string& btn2,
403 const std::string& btn3,
const std::string& btndef) = 0;
405 virtual std::pair<std::list<int>,
int>
406 do_list_dialog (
const std::list<std::string>& list,
407 const std::string& mode,
408 int width,
int height,
409 const std::list<int>& initial_value,
410 const std::string& name,
411 const std::list<std::string>& prompt,
412 const std::string& ok_string,
413 const std::string& cancel_string) = 0;
415 virtual std::list<std::string>
416 do_input_dialog (
const std::list<std::string>& prompt,
417 const std::string& title,
418 const std::list<float>& nr,
419 const std::list<float>& nc,
420 const std::list<std::string>& defaults) = 0;
422 virtual std::list<std::string>
423 do_file_dialog (
const filter_list&
filter,
const std::string& title,
424 const std::string& filename,
const std::string& dirname,
425 const std::string& multimode) = 0;
428 do_debug_cd_or_addpath_error (
const std::string& file,
429 const std::string& dir,
430 bool addpath_option) = 0;
432 virtual void do_change_directory (
const std::string& dir) = 0;
434 virtual void do_execute_command_in_terminal (
const std::string& command) = 0;
437 do_set_workspace (
bool top_level,
438 const std::list<workspace_element>& ws) = 0;
440 virtual void do_clear_workspace (
void) = 0;
443 virtual void do_append_history (
const std::string& hist_entry) = 0;
444 virtual void do_clear_history (
void) = 0;
446 virtual void do_pre_input_event (
void) = 0;
447 virtual void do_post_input_event (
void) = 0;
450 do_enter_debugger_event (
const std::string& file,
int line) = 0;
453 do_execute_in_debugger_event (
const std::string& file,
int line) = 0;
455 virtual void do_exit_debugger_event (
void) = 0;
457 virtual void do_update_breakpoint (
bool insert,
458 const std::string& file,
int line) = 0;
460 virtual void do_set_default_prompts (std::string& ps1, std::string& ps2,
461 std::string& ps4) = 0;
463 virtual void do_show_preferences (
void) = 0;
465 virtual void do_show_doc (
const std::string &file) = 0;
468 #endif // OCTAVELINK_H