slop.hpp 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /* slop.hpp: exposes a selection interface
  2. *
  3. * Copyright (C) 2014: Dalton Nell, Slop Contributors (https://github.com/naelstrof/slop/graphs/contributors).
  4. *
  5. * This file is part of Slop.
  6. *
  7. * Slop is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation, either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * Slop is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with Slop. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. #ifndef N_SLOP_H_
  21. #define N_SLOP_H_
  22. // Here we make some C-styled structs and function definitions,
  23. // allows other people to have a pure C interface to slop.
  24. struct slop_options {
  25. //SlopOptions();
  26. int quiet;
  27. float border;
  28. float padding;
  29. float tolerance;
  30. int highlight;
  31. int noopengl;
  32. int nokeyboard;
  33. int nodecorations;
  34. char* shaders;
  35. float r;
  36. float g;
  37. float b;
  38. float a;
  39. char* xdisplay;
  40. };
  41. struct slop_selection {
  42. //SlopSelection( float x, float y, float w, float h, int id, bool cancelled );
  43. int cancelled;
  44. float x;
  45. float y;
  46. float w;
  47. float h;
  48. // This is an X11 Window ID
  49. int id;
  50. };
  51. #ifdef __cplusplus
  52. namespace slop {
  53. class SlopOptions {
  54. public:
  55. SlopOptions();
  56. bool quiet;
  57. float border;
  58. float padding;
  59. float tolerance;
  60. bool highlight;
  61. bool noopengl;
  62. bool nokeyboard;
  63. bool nodecorations;
  64. char* shaders;
  65. float r;
  66. float g;
  67. float b;
  68. float a;
  69. char* xdisplay;
  70. };
  71. class SlopSelection {
  72. public:
  73. SlopSelection( float x, float y, float w, float h, int id, bool cancelled );
  74. bool cancelled;
  75. float x;
  76. float y;
  77. float w;
  78. float h;
  79. // This is an X11 Window ID
  80. int id;
  81. };
  82. SlopSelection SlopSelect( SlopOptions* options = NULL );
  83. }
  84. extern "C" struct slop_options slop_options_default();
  85. extern "C" struct slop_selection slop_select( struct slop_options* options );
  86. #else // __cplusplus
  87. struct slop_options slop_options_default();
  88. struct slop_selection slop_select( struct slop_options* options );
  89. #endif
  90. #endif // N_SLOP_H_