dialogline.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. // Copyright (C) 2003 Mooffie <mooffie@typo.co.il>
  2. //
  3. // This program is free software; you can redistribute it and/or modify
  4. // it under the terms of the GNU General Public License as published by
  5. // the Free Software Foundation; either version 2 of the License, or
  6. // (at your option) any later version.
  7. //
  8. // This program is distributed in the hope that it will be useful,
  9. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. // GNU General Public License for more details.
  12. //
  13. // You should have received a copy of the GNU General Public License
  14. // along with this program; if not, write to the Free Software
  15. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
  16. #ifndef BDE_DIALOGLINE_H
  17. #define BDE_DIALOGLINE_H
  18. #include "label.h"
  19. #include "inputline.h"
  20. class Editor;
  21. // DialogLine does the dialog with the user: it displays informative
  22. // and error messages, asks for input and for confirmations.
  23. class DialogLine : public Label {
  24. Editor *app;
  25. Widget *modal_widget;
  26. bool modal_canceled;
  27. // A DialogLine can display two kinds of messages: transient and
  28. // non-transient. Transient messages are displayed for a brief time,
  29. // whereas non-transient messages are durable. The latter are used for
  30. // error messages.
  31. bool transient;
  32. void modalize(Widget *wgt);
  33. public:
  34. HAS_ACTIONS_MAP(DialogLine, Label);
  35. HAS_BINDINGS_MAP(DialogLine, Label);
  36. DialogLine(Editor *aApp);
  37. void show_message(const char *msg);
  38. void show_message_fmt(const char *fmt, ...);
  39. void show_error_message(const char *msg);
  40. void clear_transient_message();
  41. unistring query(const char *msg, const char *default_text = NULL,
  42. int history_set = 0,
  43. InputLine::CompleteType complete = InputLine::cmpltOff,
  44. bool *alt_kbd = NULL);
  45. unistring query(const char *msg, const unistring &default_text,
  46. int history_set = 0,
  47. InputLine::CompleteType complete = InputLine::cmpltOff,
  48. bool *alt_kbd = NULL);
  49. int get_number(const char *msg, int default_num, bool *canceled = NULL);
  50. bool ask_yes_or_no(const char *msg, bool *canceled = NULL);
  51. INTERACTIVE void cancel_modal();
  52. INTERACTIVE void layout_windows();
  53. INTERACTIVE void refresh();
  54. virtual void update();
  55. void immediate_update();
  56. virtual void resize(int lines, int columns, int y, int x);
  57. };
  58. #endif