panel.h
上传用户:gzelex
上传日期:2007-01-07
资源大小:707k
文件大小:5k
开发平台:

MultiPlatform

  1. /*******************************************************************************
  2. +
  3. +  LEDA-R  3.2.3
  4. +
  5. +  panel.h
  6. +
  7. +  Copyright (c) 1995  by  Max-Planck-Institut fuer Informatik
  8. +  Im Stadtwald, 66123 Saarbruecken, Germany     
  9. +  All rights reserved.
  10. *******************************************************************************/
  11. #ifndef LEDA_PANEL_H 
  12. #define LEDA_PANEL_H
  13. #include <LEDA/window.h>
  14. //------------------------------------------------------------------------------
  15. //   PANELS
  16. //------------------------------------------------------------------------------
  17. /*{Manpage {panel} {} {Panels}}*/
  18. class panel : public LEDA_PANEL {
  19. /*{Mdefinition
  20. Panels are windows used for displaying text messages and updating the
  21. values of variables. A panel $P$ consists of a set of panel items and a set
  22. of buttons.  A variable of
  23. a certain type (int, bool, string, double, color) is associated with each item (except for text items). It can be
  24. manipulated through the item and a string label.}*/
  25. public:
  26. /*{Mcreation P }*/
  27.  panel() {}
  28. /*{Mcreate creates an empty panel $P$.}*/
  29.  panel(string s) : LEDA_PANEL(s) {}
  30. /*{Mcreate creates an empty panel $P$ with header $s$.}*/
  31.  panel(string s, int w, int h) : LEDA_PANEL(s,w,h) {}
  32. /*{Mcreate creates an empty panel $P$ of width $w$ and 
  33.             height $h$ with header $s$.}*/
  34. ~panel() {}
  35. /*{Moperations 1.2 4.8 }*/
  36. void set_bg_color(color bg_col);
  37. /*{Mop   sets the panel background color to $bg_col$.}*/
  38. void buttons_per_line(int n) { LEDA_PANEL::buttons_per_line(n); }
  39. /*{Mop  defines the maximal number $n$ of buttons per line. }*/
  40. void label(string s);
  41. /*{Mop   sets the panel label to $s$.}*/
  42. void text_item(string s);
  43. /*{Mop      adds a text_item $s$ to $P$.}*/
  44. void bool_item(string s, bool& x);
  45. /*{Mopl     adds a boolean item with label $s$ and variable $x$ to $P$.}*/
  46. void real_item(string s, double& x);
  47. /*{Mopl     adds a real item with label $s$ and variable $x$ to $P$.}*/
  48. void double_item(string s, double& x);
  49. void color_item(string s, color& x);
  50. /*{Mopl     adds a color item with label $s$ and variable $x$ to $P$.}*/
  51. void lstyle_item(string s, line_style& x);
  52. /*{Mopl     adds a line style item with label $s$ and variable $x$ to $P$.}*/
  53. void int_item(string s, int& x);
  54. /*{Mopl     adds an integer item with label $s$ and variable $x$ to $P$.}*/
  55. void int_item(string s, int& x, int l, int h, int step);
  56. /*{Mopl     adds an integer choice item with label $s$, variable $x$, 
  57.      range $l$,dots, $h$, and step size $step$ to $P$.}*/
  58. void int_item(string s, int& x, int l, int h, void (*F)(int));
  59. void int_item(string s, int& x, int l, int h);
  60. /*{Mopl     adds an integer slider item with label $s$, variable $x$, and 
  61.      range $l$,dots,$h$ to $P$.}*/
  62. void string_item(string s, string& x);
  63. /*{Mopl     adds a string item with label $s$ and variable $x$ to $P$.}*/
  64. void string_item(string s, string& x, list<string>& L);
  65. /*{Mopl     adds a string item with label $s$, variable $x$, and menu $L$ 
  66.      to $P$.}*/
  67. void choice_item(string s, int& x, list<string>& L);
  68. /*{Mopl     adds an integer item with label $s$, variable $x$, and choices 
  69.      from $L$ to $P$.}*/
  70. void choice_item(string s, int& x, string s1, string s2);
  71. void choice_item(string s, int& x, string s1, string s2, string s3);
  72. void choice_item(string s, int& x, string s1, string s2, string s3, string s4);
  73. void choice_item(string s, int& x, string s1, string s2, string s3, string s4, string s5);
  74. /*
  75. void choice_item(string s, int& x, string s1,...,string sk);
  76. */
  77. /*{Mopl     adds an integer item with label $s$, variable $x$, and choices 
  78.      $s_1$, dots, $s_k$ to $P$ ($k le 4$).}*/
  79. int button(string s);
  80. /*{Mop      adds a button with label $s$ to $P$ and returns its number.}*/
  81. void new_button_line();
  82. /*{Mop      starts a new line of buttons.}*/
  83. void new_button_line(list<string>&);
  84. // display panel window on screen
  85. void display();                       
  86. /*{Mop      displays var centered on screen. }*/
  87. void display(int x, int y);
  88. /*{Mop      displays var  with left upper corner at $(x,y)$. }*/
  89. void display(window& W);
  90. /*{Mop      displays var  centered over window $W$. }*/
  91. void display(window& W, int x, int y);
  92. /*{Mopl      displays var  with left upper corner at position $(x,y)$
  93.              of window $W$. }*/
  94. // read panel
  95. int  read() { return LEDA_PANEL::read(); }
  96. /*{Mop      waits for a button selection in $P$. Returns the number of 
  97.              the selected button.}*/
  98. // open = display + read
  99. int  open();
  100. /*{Mop      $P$.display() $+$  $P$.read().}*/
  101. int  open(int x, int y);
  102. /*{Mop      $P$.display$(x,y)$ $+$  $P$.read().}*/
  103. int  open(window& W);
  104. /*{Mop      $P$.display$(W)$ $+$  $P$.read().}*/
  105. int  open(window& W, int x, int y);
  106. /*{Mopl      $P$.display$(W,x,y)$ $+$  $P$.read().}*/
  107. };
  108. #endif