panel.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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/xpm.h>
  14. #include <X11/cursorfont.h>
  15. #include <X11/Xmu/WinUtil.h>
  16. #include <sys/wait.h>
  17. #include <stdlib.h>
  18. #include <signal.h>
  19. #include <iostream>
  20. #ifdef NEEDS_BASENAME
  21. #include <libgen.h>
  22. #endif
  23. #include "switchuser.h"
  24. #include "input.h"
  25. #include "const.h"
  26. #include "image.h"
  27. class Panel {
  28. public:
  29. Panel(Display* dpy, int scr, Window root, Cfg* config,
  30. const string& themed);
  31. ~Panel();
  32. void OpenPanel();
  33. void ClosePanel();
  34. void ClearPanel();
  35. void Message(const char* text);
  36. void Error(const char* text);
  37. Input* GetInput();
  38. int EventHandler(XEvent* event);
  39. string getSession();
  40. private:
  41. Panel();
  42. void Cursor(int visible);
  43. unsigned long GetColor(const char* colorname);
  44. void OnExpose(XEvent* event);
  45. void OnKeyPress(XEvent* event);
  46. void ShowText();
  47. void SwitchSession();
  48. void ShowSession();
  49. void SlimDrawString8(XftDraw* d, XftColor* color, XftFont* font,
  50. int x, int y, XftChar8 *string, int len,
  51. XftColor* shadowColor,
  52. int xOffset, int yOffset);
  53. Cfg* cfg;
  54. // Private data
  55. Window Win;
  56. Window Root;
  57. Display* Dpy;
  58. int Scr;
  59. int X, Y;
  60. GC TextGC;
  61. XftFont* font;
  62. XftColor inputshadowcolor;
  63. XftColor inputcolor;
  64. XftColor msgcolor;
  65. XftColor msgshadowcolor;
  66. XftFont* msgfont;
  67. XftColor introcolor;
  68. XftFont* introfont;
  69. XftFont* welcomefont;
  70. XftColor welcomecolor;
  71. XftColor welcomeshadowcolor;
  72. XftFont* enterfont;
  73. XftColor entercolor;
  74. XftColor entershadowcolor;
  75. int Action;
  76. // Configuration
  77. int input_name_x;
  78. int input_name_y;
  79. int input_pass_x;
  80. int input_pass_y;
  81. int inputShadowXOffset;
  82. int inputShadowYOffset;
  83. int input_cursor_height;
  84. int welcome_x;
  85. int welcome_y;
  86. int welcome_shadow_xoffset;
  87. int welcome_shadow_yoffset;
  88. int intro_x;
  89. int intro_y;
  90. int username_x;
  91. int username_y;
  92. int username_shadow_xoffset;
  93. int username_shadow_yoffset;
  94. int password_x;
  95. int password_y;
  96. string welcome_message;
  97. string intro_message;
  98. // Pixmap data
  99. Pixmap PanelPixmap;
  100. // Name/Passwd handler
  101. Input* In;
  102. Image* image;
  103. // For thesting themes
  104. bool testing;
  105. string themedir;
  106. // Session handling
  107. string session;
  108. };
  109. #endif