method.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. * dselect - Debian package maintenance user interface
  3. * method.h - access method handling declarations
  4. *
  5. * Copyright © 1995 Ian Jackson <ijackson@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 published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This is distributed in the hope that it will be useful,
  14. * but 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 <https://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, *prev;
  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. column col_status;
  48. column col_name;
  49. column col_desc;
  50. // Table of methods
  51. struct dselect_option **table;
  52. // Misc.
  53. char searchstring[50];
  54. // Information displays
  55. void itd_description();
  56. // Define these virtuals
  57. void redraw1itemsel(int index, int selected);
  58. void redrawcolheads();
  59. void redrawthisstate();
  60. void redrawinfo();
  61. void redrawtitle();
  62. void setwidths();
  63. void setheights();
  64. const char *itemname(int index);
  65. const struct helpmenuentry *helpmenulist();
  66. public:
  67. // Keybinding functions */
  68. void kd_quit();
  69. void kd_abort();
  70. methodlist();
  71. quitaction display();
  72. ~methodlist();
  73. };
  74. extern int noptions;
  75. extern struct dselect_option *options, *coption;
  76. extern struct method *methods;
  77. void readmethods(const char *pathbase, dselect_option **optionspp, int *nread);
  78. void getcurrentopt();
  79. void writecurrentopt();
  80. #endif /* METHOD_H */