You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ViewerToolBar.cxx 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /* Copyright (C) 2005 TightVNC Team. All Rights Reserved.
  2. *
  3. * This is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation; either version 2 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This software is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this software; if not, write to the Free Software
  15. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  16. * USA.
  17. */
  18. // -=- ViewerToolBar.cxx
  19. #include <vncviewer/ViewerToolBar.h>
  20. #include <vncviewer/resource.h>
  21. void ViewerToolBar::create(HWND parentHwnd) {
  22. // Create the toolbar panel
  23. ToolBar::create(ID_TOOLBAR, parentHwnd, WS_CHILD |
  24. TBSTYLE_FLAT | TBSTYLE_TOOLTIPS | CCS_NORESIZE);
  25. addBitmap(4, IDB_TOOLBAR);
  26. // Create the control buttons
  27. addButton(0, ID_OPTIONS);
  28. addButton(1, ID_INFO);
  29. addButton(0, 0, TBSTATE_ENABLED, TBSTYLE_SEP);
  30. addButton(2, ID_FULLSCREEN);
  31. addButton(3, ID_REQUEST_REFRESH);
  32. addButton(0, 0, TBSTATE_ENABLED, TBSTYLE_SEP);
  33. addButton(4, ID_SEND_CAD);
  34. addButton(5, ID_SEND_CTLESC);
  35. addButton(6, ID_CTRL_KEY);
  36. addButton(7, ID_ALT_KEY);
  37. addButton(0, 0, TBSTATE_ENABLED, TBSTYLE_SEP);
  38. addButton(8, ID_FILE_TRANSFER);
  39. addButton(0, 0, TBSTATE_ENABLED, TBSTYLE_SEP);
  40. addButton(9, ID_NEW_CONNECTION);
  41. addButton(10, ID_CONN_SAVE_AS);
  42. addButton(11, ID_CLOSE);
  43. // Resize the toolbar window
  44. autoSize();
  45. }
  46. LRESULT ViewerToolBar::processWM_NOTIFY(WPARAM wParam, LPARAM lParam) {
  47. switch (((LPNMHDR)lParam)->code) {
  48. // Process tooltips text
  49. case TTN_NEEDTEXT:
  50. {
  51. LPTOOLTIPTEXT TTStr = (LPTOOLTIPTEXT)lParam;
  52. if (TTStr->hdr.code != TTN_NEEDTEXT)
  53. return 0;
  54. switch (TTStr->hdr.idFrom) {
  55. case ID_OPTIONS:
  56. TTStr->lpszText = "Connection options...";
  57. break;
  58. case ID_INFO:
  59. TTStr->lpszText = "Connection info";
  60. break;
  61. case ID_FULLSCREEN:
  62. TTStr->lpszText = "Full screen";
  63. break;
  64. case ID_REQUEST_REFRESH:
  65. TTStr->lpszText = "Request screen refresh";
  66. break;
  67. case ID_SEND_CAD:
  68. TTStr->lpszText = "Send Ctrl-Alt-Del";
  69. break;
  70. case ID_SEND_CTLESC:
  71. TTStr->lpszText = "Send Ctrl-Esc";
  72. break;
  73. case ID_CTRL_KEY:
  74. TTStr->lpszText = "Send Ctrl key press/release";
  75. break;
  76. case ID_ALT_KEY:
  77. TTStr->lpszText = "Send Alt key press/release";
  78. break;
  79. case ID_FILE_TRANSFER:
  80. TTStr->lpszText = "Transfer files...";
  81. break;
  82. case ID_NEW_CONNECTION:
  83. TTStr->lpszText = "New connection...";
  84. break;
  85. case ID_CONN_SAVE_AS:
  86. TTStr->lpszText = "Save connection info as...";
  87. break;
  88. case ID_CLOSE:
  89. TTStr->lpszText = "Disconnect";
  90. break;
  91. default:
  92. break;
  93. }
  94. }
  95. default:
  96. break;
  97. }
  98. return 0;
  99. }
  100. void ViewerToolBar::show() {
  101. ShowWindow(getHandle(), SW_SHOW);
  102. SendMessage(parentHwnd, WM_SIZE, 0, 0);
  103. }
  104. void ViewerToolBar::hide() {
  105. ShowWindow(getHandle(), SW_HIDE);
  106. SendMessage(parentHwnd, WM_SIZE, 0, 0);
  107. }