panel.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /* SLiM - Simple Login Manager
  2. Copyright (C) 1997, 1998 Per Liden
  3. Copyright (C) 2004-06 Simone Rota <sip@varlock.com>
  4. Copyright (C) 2004-06 Johannes Winkelmann <jw@tks6.net>
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. */
  10. #ifndef _PANEL_H_
  11. #define _PANEL_H_
  12. #include <X11/Xlib.h>
  13. #include <X11/cursorfont.h>
  14. #include <X11/Xmu/WinUtil.h>
  15. #include <sys/wait.h>
  16. #include <stdlib.h>
  17. #include <signal.h>
  18. #include <iostream>
  19. #ifdef NEEDS_BASENAME
  20. #include <libgen.h>
  21. #endif
  22. #include "switchuser.h"
  23. #include "input.h"
  24. #include "const.h"
  25. #include "image.h"
  26. class Panel {
  27. public:
  28. Panel(Display* dpy, int scr, Window root, Cfg* config,
  29. const string& themed);
  30. ~Panel();
  31. void OpenPanel();
  32. void ClosePanel();
  33. void ClearPanel();
  34. void Message(const char* text);
  35. void Error(const char* text);
  36. Input* GetInput();
  37. int EventHandler(XEvent* event);
  38. string getSession();
  39. private:
  40. Panel();
  41. void Cursor(int visible);
  42. unsigned long GetColor(const char* colorname);
  43. void OnExpose(XEvent* event);
  44. void OnKeyPress(XEvent* event);
  45. void ShowText();
  46. void SwitchSession();
  47. void ShowSession();
  48. void SlimDrawString8(XftDraw* d, XftColor* color, XftFont* font,
  49. int x, int y, XftChar8 *string, int len,
  50. XftColor* shadowColor,
  51. int xOffset, int yOffset);
  52. Cfg* cfg;
  53. // Private data
  54. Window Win;
  55. Window Root;
  56. Display* Dpy;
  57. int Scr;
  58. int X, Y;
  59. GC TextGC;
  60. XftFont* font;
  61. XftColor inputshadowcolor;
  62. XftColor inputcolor;
  63. XftColor msgcolor;
  64. XftColor msgshadowcolor;
  65. XftFont* msgfont;
  66. XftColor introcolor;
  67. XftFont* introfont;
  68. XftFont* welcomefont;
  69. XftColor welcomecolor;
  70. XftColor welcomeshadowcolor;
  71. XftFont* enterfont;
  72. XftColor entercolor;
  73. XftColor entershadowcolor;
  74. int Action;
  75. // Configuration
  76. int input_name_x;
  77. int input_name_y;
  78. int input_pass_x;
  79. int input_pass_y;
  80. int inputShadowXOffset;
  81. int inputShadowYOffset;
  82. int input_cursor_height;
  83. int welcome_x;
  84. int welcome_y;
  85. int welcome_shadow_xoffset;
  86. int welcome_shadow_yoffset;
  87. int intro_x;
  88. int intro_y;
  89. int username_x;
  90. int username_y;
  91. int username_shadow_xoffset;
  92. int username_shadow_yoffset;
  93. int password_x;
  94. int password_y;
  95. string welcome_message;
  96. string intro_message;
  97. // Pixmap data
  98. Pixmap PanelPixmap;
  99. // Name/Passwd handler
  100. Input* In;
  101. Image* image;
  102. // For thesting themes
  103. bool testing;
  104. string themedir;
  105. // Session handling
  106. string session;
  107. };
  108. #endif