method.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /* -*- c++ -*-
  2. * dselect - Debian package maintenance user interface
  3. * method.h - access method handling declarations
  4. *
  5. * Copyright © 1995 Ian Jackson <ian@chiark.greenend.org.uk>
  6. * Copyright © 2001 Wichert Akkerman <wakkerma@debian.org>
  7. *
  8. * This is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2,
  11. * or (at your option) any later version.
  12. *
  13. * This is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. */
  21. #ifndef METHOD_H
  22. #define METHOD_H
  23. #define CMETHOPTFILE "cmethopt"
  24. #define METHLOCKFILE "methlock"
  25. #define METHODSDIR "methods"
  26. #define IMETHODMAXLEN 50
  27. #define IOPTIONMAXLEN IMETHODMAXLEN
  28. #define METHODOPTIONSFILE "names"
  29. #define METHODSETUPSCRIPT "setup"
  30. #define METHODUPDATESCRIPT "update"
  31. #define METHODINSTALLSCRIPT "install"
  32. #define OPTIONSDESCPFX "desc."
  33. #define OPTIONINDEXMAXLEN 5
  34. struct method {
  35. struct method *next, *back;
  36. char *name, *path, *pathinmeth;
  37. };
  38. struct dselect_option {
  39. dselect_option *next;
  40. method *meth;
  41. char index[OPTIONINDEXMAXLEN];
  42. char *name, *summary;
  43. char *description;
  44. };
  45. class methodlist : public baselist {
  46. protected:
  47. int status_width, gap_width, name_width, description_width;
  48. int name_column, description_column;
  49. // Table of methods
  50. struct dselect_option **table;
  51. // Misc.
  52. char searchstring[50];
  53. // Information displays
  54. void itd_description();
  55. // Define these virtuals
  56. void redraw1itemsel(int index, int selected);
  57. void redrawcolheads();
  58. void redrawthisstate();
  59. void redrawinfo();
  60. void redrawtitle();
  61. void setwidths();
  62. void setheights();
  63. const char *itemname(int index);
  64. const struct helpmenuentry *helpmenulist();
  65. public:
  66. // Keybinding functions */
  67. void kd_quit();
  68. void kd_abort();
  69. methodlist();
  70. quitaction display();
  71. ~methodlist();
  72. };
  73. extern int noptions;
  74. extern struct dselect_option *options, *coption;
  75. extern struct method *methods;
  76. void readmethods(const char *pathbase, dselect_option **optionspp, int *nread);
  77. void getcurrentopt();
  78. void writecurrentopt();
  79. #endif /* METHOD_H */