Constantin Kaplinsky | 729598c | 2006-05-25 05:12:25 +0000 | [diff] [blame] | 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 | |
| 19 | // -=- PlayerToolBar.h |
| 20 | |
| 21 | // ToolBar for the RfbPlayer |
| 22 | |
| 23 | #include <rfb_win32/ToolBar.h> |
| 24 | |
| 25 | using namespace rfb::win32; |
| 26 | |
| 27 | #define ID_TOOLBAR 500 |
| 28 | #define ID_PLAY 510 |
| 29 | #define ID_PAUSE 520 |
| 30 | #define ID_TIME_STATIC 530 |
| 31 | #define ID_SPEED_STATIC 540 |
| 32 | #define ID_SPEED_EDIT 550 |
| 33 | #define ID_POS_TRACKBAR 560 |
| 34 | #define ID_SPEED_UPDOWN 570 |
| 35 | |
| 36 | #define MAX_SPEED 10.00 |
| 37 | #define CALCULATION_ERROR MAX_SPEED / 1000 |
| 38 | #define MAX_POS_TRACKBAR_RANGE 50 |
| 39 | |
| 40 | class RfbPlayer; |
| 41 | |
| 42 | class PlayerToolBar : public ToolBar { |
| 43 | public: |
| 44 | PlayerToolBar(); |
| 45 | ~PlayerToolBar() {} |
| 46 | |
| 47 | void create(RfbPlayer *player, HWND parentHwnd); |
| 48 | |
| 49 | void init(long sessionTimeMs); |
| 50 | |
| 51 | void enable(); |
| 52 | void disable(); |
| 53 | |
| 54 | LRESULT processWM_COMMAND(WPARAM wParam, LPARAM lParam); |
| 55 | LRESULT processWM_HSCROLL(WPARAM wParam, LPARAM lParam); |
| 56 | LRESULT processWM_NOTIFY(WPARAM wParam, LPARAM lParam); |
| 57 | |
| 58 | HWND getSpeedEditHwnd() { return speedEdit; } |
| 59 | HWND getSpeedUpDownHwnd() { return speedUpDown; } |
| 60 | |
| 61 | bool isPosSliderDragging() { return sliderDragging; }; |
| 62 | void updatePos(long newPos); |
| 63 | void setSessionTimeStr(long sessionTimeMs); |
| 64 | void setTimePos(long newPos); |
| 65 | |
| 66 | protected: |
| 67 | RfbPlayer *player; |
| 68 | HFONT hFont; |
| 69 | HWND timeStatic; |
| 70 | HWND speedEdit; |
| 71 | HWND posTrackBar; |
| 72 | HWND speedUpDown; |
| 73 | char fullSessionTimeStr[20]; |
| 74 | long sessionTimeMs; |
| 75 | bool sliderDragging; |
| 76 | long sliderStepMs; |
| 77 | }; |