00001 /* 00002 * Sudoku: A plug-in for the Video Disk Recorder 00003 * 00004 * Copyright (C) 2005-2008, Thomas Günther <tom@toms-cafe.de> 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License along 00017 * with this program; if not, write to the Free Software Foundation, Inc., 00018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00019 */ 00020 00021 #ifndef VDR_SUDOKU_MENU_H 00022 #define VDR_SUDOKU_MENU_H 00023 00024 #include "sudoku.h" 00025 namespace Sudoku { class PuzzleGame; } 00026 #include <vdr/config.h> 00027 #include <vdr/osdbase.h> 00028 #include <vdr/osd.h> 00029 #include <vdr/plugin.h> 00030 #include <vdr/tools.h> 00031 00032 00033 namespace SudokuPlugin 00034 { 00035 class SetupData; 00036 class Bitmap; 00037 class CommandMenu; 00038 class ListMenu; 00039 class SetupPage; 00040 00041 //--- class SudokuPlugin::Menu ----------------------------------------------- 00042 00043 /** Main menu of the plugin */ 00044 class Menu : public cOsdObject 00045 { 00046 cPlugin* plugin; 00047 const SetupData& setup; 00048 Sudoku::PuzzleGame*& puzzle; 00049 int xPos, yPos; 00050 cOsd* osd; 00051 Bitmap* info; 00052 const char* infoText; 00053 bool new_puzzle_request; 00054 const cFont* maxi_font; 00055 const cFont* mini_font; 00056 CommandMenu* command_menu; 00057 ListMenu* list_menu; 00058 cMenuSetupPage* setup_menu; 00059 cString listfile; 00060 00061 public: 00062 00063 /** Constructor */ 00064 Menu(cPlugin* plugin, const SetupData& setup, Sudoku::PuzzleGame*& puzzle); 00065 00066 /** Destructor */ 00067 virtual ~Menu(); 00068 00069 /** Display the menu on the OSD. */ 00070 virtual void Show(); 00071 00072 /** Process user events. */ 00073 virtual eOSState ProcessKey(eKeys key); 00074 00075 /** Generate a new puzzle. */ 00076 eOSState generate(); 00077 00078 /** Load a puzzle. */ 00079 eOSState load(); 00080 00081 /** Save the puzzle. */ 00082 eOSState save(); 00083 00084 /** Undo last action. */ 00085 eOSState undo(); 00086 00087 /** Redo last action. */ 00088 eOSState redo(); 00089 00090 /** Mark/unmark the current cell. */ 00091 eOSState toggle_mark(); 00092 00093 /** Move the cursor to the next free cell with minimal possible numbers. */ 00094 eOSState next_cell(); 00095 00096 /** Set the next possible number for the current cell. */ 00097 eOSState next_number(); 00098 00099 /** Reset the puzzle. */ 00100 eOSState reset(); 00101 00102 /** Open setup menu. */ 00103 eOSState open_setup(); 00104 00105 /** Exit plugin menu. */ 00106 eOSState exit(); 00107 00108 private: 00109 00110 /** Paint all pieces of the menu. */ 00111 void paint(); 00112 }; 00113 00114 } // namespace SudokuPlugin 00115 00116 #endif // VDR_SUDOKU_MENU_H