| 1 | /*************************************************************************** |
| 2 | * Copyright (C) 2006-2016 by Guy Rutenberg * |
| 3 | * [email protected] * |
| 4 | * * |
| 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 | * This program is distributed in the hope that it will be useful, * |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 13 | * GNU General Public License for more details. * |
| 14 | * * |
| 15 | * You should have received a copy of the GNU General Public License * |
| 16 | * along with this program; if not, write to the * |
| 17 | * Free Software Foundation, Inc., * |
| 18 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
| 19 | ***************************************************************************/ |
| 20 | /**\file MainFrame.h |
| 21 | *\brief Header file for MainFrame class. |
| 22 | * |
| 23 | * This File contains the declaration of the class MainFrame |
| 24 | */ |
| 25 | |
| 26 | |
| 27 | #ifndef OPENYAHTZEE_MAIN_FRAME_INC |
| 28 | #define OPENYAHTZEE_MAIN_FRAME_INCcxx . . $ `src/MainFrame.h:28:9`! |
| 29 | #include "ScoreDice.h"cxx . . $ `<file>/src/ScoreDice.h`/ |
| 30 | #include "configuration.h"cxx . . $ `<file>/src/configuration.h`/ |
| 31 | #include <memory> |
| 32 | #include <boost/scoped_ptr.hpp> |
| 33 | #include <wx/wx.h> |
| 34 | |
| 35 | namespace main_framecxx . . $ main_frame/ { |
| 36 | |
| 37 | /// MainFrame class - the main window |
| 38 | /** |
| 39 | The Main Frame class is a derieved class from wxFrame which is responsible to |
| 40 | the main window of the application. This class also hold all the functions |
| 41 | that process the dice and handles the gameplay. This function are called as |
| 42 | event handlers. |
| 43 | */ |
| 44 | class MainFramecxx . . $ main_frame/MainFrame# : public wxFramecxx . . $ wxFrame# |
| 45 | { |
| 46 | public: |
| 47 | // Constructor |
| 48 | MainFramecxx . . $ main_frame/MainFrame#MainFrame(2e2876ea9d2613ae).(const wxStringcxx . . $ wxString#& title, const wxSizecxx . . $ wxSize#& size = wxDefaultSizecxx . . $ wxDefaultSize., long style = wxDEFAULT_FRAME_STYLEcxx . . $ `<external>/10524890736914687764/toplevel.h:86:9`! ^ wxRESIZE_BORDERcxx . . $ `<external>/10524890736914687764/toplevel.h:76:9`! ); |
| 49 | ~cxx . . $ main_frame/MainFrame#`~MainFrame`(49f6e7a06ebc5aa8).MainFramecxx . . $ main_frame/MainFrame#(); |
| 50 | |
| 51 | // Event handlers |
| 52 | void OnQuitcxx . . $ main_frame/MainFrame#OnQuit(f55e5a77ec619b42).(wxCommandEventcxx . . $ wxCommandEvent#& event); |
| 53 | void OnAboutcxx . . $ main_frame/MainFrame#OnAbout(f55e5a77ec619b42).(wxCommandEventcxx . . $ wxCommandEvent#& event); |
| 54 | void OnNewGamecxx . . $ main_frame/MainFrame#OnNewGame(f55e5a77ec619b42). (wxCommandEventcxx . . $ wxCommandEvent#& event); |
| 55 | void OnUndocxx . . $ main_frame/MainFrame#OnUndo(f55e5a77ec619b42). (wxCommandEventcxx . . $ wxCommandEvent#& event); |
| 56 | void OnShowHighscorecxx . . $ main_frame/MainFrame#OnShowHighscore(f55e5a77ec619b42). (wxCommandEventcxx . . $ wxCommandEvent#& event); |
| 57 | void OnSettingscxx . . $ main_frame/MainFrame#OnSettings(f55e5a77ec619b42). (wxCommandEventcxx . . $ wxCommandEvent#& event); |
| 58 | void OnSendCommentcxx . . $ main_frame/MainFrame#OnSendComment(f55e5a77ec619b42). (wxCommandEventcxx . . $ wxCommandEvent#& event); |
| 59 | void OnHelpMenuLinkcxx . . $ main_frame/MainFrame#OnHelpMenuLink(f55e5a77ec619b42). (wxCommandEventcxx . . $ wxCommandEvent#& event); |
| 60 | |
| 61 | /** |
| 62 | * Prevent accidental roll of the dice by double clicking the button. |
| 63 | * \param event The event that was send to the ::OnRollButton() |
| 64 | */ |
| 65 | void DoubleRollLockcxx . . $ main_frame/MainFrame#DoubleRollLock(f55e5a77ec619b42).(wxCommandEventcxx . . $ wxCommandEvent#& event); |
| 66 | |
| 67 | void OnUpperButtonscxx . . $ main_frame/MainFrame#OnUpperButtons(f55e5a77ec619b42). (wxCommandEventcxx . . $ wxCommandEvent#& event); |
| 68 | void On3ofakindButtoncxx . . $ main_frame/MainFrame#On3ofakindButton(f55e5a77ec619b42). (wxCommandEventcxx . . $ wxCommandEvent#& event); |
| 69 | void On4ofakindButtoncxx . . $ main_frame/MainFrame#On4ofakindButton(f55e5a77ec619b42). (wxCommandEventcxx . . $ wxCommandEvent#& event); |
| 70 | void OnFullHouseButtoncxx . . $ main_frame/MainFrame#OnFullHouseButton(f55e5a77ec619b42). (wxCommandEventcxx . . $ wxCommandEvent#& event); |
| 71 | void OnSmallSequenceButtoncxx . . $ main_frame/MainFrame#OnSmallSequenceButton(f55e5a77ec619b42). (wxCommandEventcxx . . $ wxCommandEvent#& event); |
| 72 | void OnLargeSequenceButtoncxx . . $ main_frame/MainFrame#OnLargeSequenceButton(f55e5a77ec619b42). (wxCommandEventcxx . . $ wxCommandEvent#& event); |
| 73 | void OnYahtzeeButtoncxx . . $ main_frame/MainFrame#OnYahtzeeButton(f55e5a77ec619b42). (wxCommandEventcxx . . $ wxCommandEvent#& event); |
| 74 | void OnChanceButtoncxx . . $ main_frame/MainFrame#OnChanceButton(f55e5a77ec619b42). (wxCommandEventcxx . . $ wxCommandEvent#& event); |
| 75 | void OnDiceClickcxx . . $ main_frame/MainFrame#OnDiceClick(f55e5a77ec619b42). (wxCommandEventcxx . . $ wxCommandEvent#& event); |
| 76 | void OnKeepClickcxx . . $ main_frame/MainFrame#OnKeepClick(f55e5a77ec619b42). (wxCommandEventcxx . . $ wxCommandEvent#& event); |
| 77 | |
| 78 | void OnScoreMouseEntercxx . . $ main_frame/MainFrame#OnScoreMouseEnter(7e6a1c70b0e99497). (wxMouseEventcxx . . $ wxMouseEvent#& event); |
| 79 | void OnScoreMouseLeavecxx . . $ main_frame/MainFrame#OnScoreMouseLeave(7e6a1c70b0e99497). (wxMouseEventcxx . . $ wxMouseEvent#& event); |
| 80 | |
| 81 | bool IsValidDicecxx . . $ main_frame/MainFrame#IsValidDice(c9857a73d68e59ba).(); |
| 82 | |
| 83 | ScoreDicecxx . . $ ScoreDice# m_score_dicecxx . . $ main_frame/MainFrame#m_score_dice.; |
| 84 | |
| 85 | boostcxx . . $ boost/::scoped_ptrcxx . . $ boost/scoped_ptr#<configurationcxx . . $ configuration/::Configurationcxx . . $ configuration/Configuration#> m_configcxx . . $ main_frame/MainFrame#m_config.; |
| 86 | |
| 87 | private: |
| 88 | void ClearDiceHashcxx . . $ main_frame/MainFrame#ClearDiceHash(49f6e7a06ebc5aa8).(); |
| 89 | void ResetRollscxx . . $ main_frame/MainFrame#ResetRolls(49f6e7a06ebc5aa8).(); |
| 90 | void YahtzeeBonuscxx . . $ main_frame/MainFrame#YahtzeeBonus(49f6e7a06ebc5aa8).(); |
| 91 | bool YahtzeeJokercxx . . $ main_frame/MainFrame#YahtzeeJoker(c9857a73d68e59ba).(); |
| 92 | void EndofGamecxx . . $ main_frame/MainFrame#EndofGame(49f6e7a06ebc5aa8).(); |
| 93 | void HighScoreHandlercxx . . $ main_frame/MainFrame#HighScoreHandler(d4f767463ce0a6b3).(int score); |
| 94 | inline void EnableUndocxx . . $ main_frame/MainFrame#EnableUndo(d4f767463ce0a6b3).(int id); |
| 95 | void PostScorecxx . . $ main_frame/MainFrame#PostScore(d4f767463ce0a6b3).(int id); |
| 96 | void CalculateSubTotalcxx . . $ main_frame/MainFrame#CalculateSubTotal(49f6e7a06ebc5aa8).(); |
| 97 | void Relayoutcxx . . $ main_frame/MainFrame#Relayout(49f6e7a06ebc5aa8).(); |
| 98 | void AddMenuscxx . . $ main_frame/MainFrame#AddMenus(49f6e7a06ebc5aa8).(); |
| 99 | void ConnectEventTablecxx . . $ main_frame/MainFrame#ConnectEventTable(49f6e7a06ebc5aa8).(); |
| 100 | void AddControlsAndLayoutcxx . . $ main_frame/MainFrame#AddControlsAndLayout(49f6e7a06ebc5aa8).(); |
| 101 | |
| 102 | /** |
| 103 | * Adjust the frame size to the specified sizer and set proper |
| 104 | * size hints to avoid resizing. |
| 105 | */ |
| 106 | void AdjustFrameSizecxx . . $ main_frame/MainFrame#AdjustFrameSize(5dd0f8059e1f410a).(wxSizercxx . . $ wxSizer#* sizer); |
| 107 | |
| 108 | /** |
| 109 | * Check if a click on a score button is valid or should |
| 110 | * be ignored. |
| 111 | * \returns true if the click is valid and should be scored. |
| 112 | */ |
| 113 | bool IsValidClickcxx . . $ main_frame/MainFrame#IsValidClick(c9857a73d68e59ba).(); |
| 114 | |
| 115 | void OnRollButtoncxx . . $ main_frame/MainFrame#OnRollButton(49f6e7a06ebc5aa8). (); |
| 116 | |
| 117 | wxStaticBoxSizercxx . . $ wxStaticBoxSizer# *uppersectioncxx . . $ main_frame/MainFrame#uppersection., *lowersectioncxx . . $ main_frame/MainFrame#lowersection.; |
| 118 | wxBoxSizercxx . . $ wxBoxSizer# *sectionsSizercxx . . $ main_frame/MainFrame#sectionsSizer.; |
| 119 | wxBoxSizercxx . . $ wxBoxSizer# *diceSizercxx . . $ main_frame/MainFrame#diceSizer.; |
| 120 | |
| 121 | //pointers to hold bitmap data for the dices |
| 122 | wxBitmapcxx . . $ wxBitmap# *bitmap_dicecxx . . $ main_frame/MainFrame#bitmap_dice.[6]; |
| 123 | |
| 124 | short int m_rollscxx . . $ main_frame/MainFrame#m_rolls.; //holds how many rolls left |
| 125 | short int m_numofplaysleftcxx . . $ main_frame/MainFrame#m_numofplaysleft.; //holds how many times the user got to score untill the end of the game |
| 126 | bool m_yahtzeecxx . . $ main_frame/MainFrame#m_yahtzee.; |
| 127 | bool m_yahtzeebonuscxx . . $ main_frame/MainFrame#m_yahtzeebonus.; //tells the undo if there is also an yahtzee bonus to undo |
| 128 | |
| 129 | short int m_lastmovecxx . . $ main_frame/MainFrame#m_lastmove.; //stores the ID of the last button pressed. |
| 130 | short int m_rollsundocxx . . $ main_frame/MainFrame#m_rollsundo.; //holds the number of remaining rolls for use with the undo option |
| 131 | |
| 132 | class MainFrameEvtHandlercxx . . $ main_frame/MainFrameEvtHandler# *m_evt_handlercxx . . $ main_frame/MainFrame#m_evt_handler.; |
| 133 | }; |
| 134 | |
| 135 | /** |
| 136 | * This class handles events for windows in MainFrame where it hasn't been |
| 137 | * possible to use the regular event handler. |
| 138 | */ |
| 139 | class MainFrameEvtHandlercxx . . $ main_frame/MainFrameEvtHandler# : public wxEvtHandlercxx . . $ wxEvtHandler# |
| 140 | { |
| 141 | public: |
| 142 | MainFrameEvtHandlercxx . . $ main_frame/MainFrameEvtHandler#MainFrameEvtHandler(4bf17b2bd9d1ee9d).(MainFramecxx . . $ main_frame/MainFrame# *main_frame) { m_main_framecxx . . $ main_frame/MainFrameEvtHandler#m_main_frame. = main_frame;} |
| 143 | void OnScoreMouseEntercxx . . $ main_frame/MainFrameEvtHandler#OnScoreMouseEnter(7e6a1c70b0e99497). (wxMouseEventcxx . . $ wxMouseEvent#& event); |
| 144 | void OnScoreMouseLeavecxx . . $ main_frame/MainFrameEvtHandler#OnScoreMouseLeave(7e6a1c70b0e99497). (wxMouseEventcxx . . $ wxMouseEvent#& event); |
| 145 | private: |
| 146 | MainFramecxx . . $ main_frame/MainFrame# *m_main_framecxx . . $ main_frame/MainFrameEvtHandler#m_main_frame.; |
| 147 | |
| 148 | }; |
| 149 | |
| 150 | enumcxx . . $ main_frame/$anonymous_type_5faaa1f457510e8_0# { |
| 151 | ID_PANELcxx . . $ main_frame/ID_PANEL., |
| 152 | ID_SHOWHIGHSCOREcxx . . $ main_frame/ID_SHOWHIGHSCORE., |
| 153 | ID_SETTINGScxx . . $ main_frame/ID_SETTINGS., |
| 154 | ID_THEMEScxx . . $ main_frame/ID_THEMES., |
| 155 | ID_HOWTOPLAYcxx . . $ main_frame/ID_HOWTOPLAY., |
| 156 | ID_FAQcxx . . $ main_frame/ID_FAQ., |
| 157 | ID_SENDCOMMENTcxx . . $ main_frame/ID_SENDCOMMENT., |
| 158 | |
| 159 | ID_ACEScxx . . $ main_frame/ID_ACES., |
| 160 | ID_TWOScxx . . $ main_frame/ID_TWOS., |
| 161 | ID_THREEScxx . . $ main_frame/ID_THREES., |
| 162 | ID_FOURScxx . . $ main_frame/ID_FOURS., |
| 163 | ID_FIVEScxx . . $ main_frame/ID_FIVES., |
| 164 | ID_SIXEScxx . . $ main_frame/ID_SIXES., |
| 165 | ID_THREEOFAKINDcxx . . $ main_frame/ID_THREEOFAKIND., |
| 166 | ID_FOUROFAKINDcxx . . $ main_frame/ID_FOUROFAKIND., |
| 167 | ID_FULLHOUSEcxx . . $ main_frame/ID_FULLHOUSE., |
| 168 | ID_SMALLSEQUENCEcxx . . $ main_frame/ID_SMALLSEQUENCE., |
| 169 | ID_LARGESEQUENCEcxx . . $ main_frame/ID_LARGESEQUENCE., |
| 170 | ID_YAHTZEEcxx . . $ main_frame/ID_YAHTZEE., |
| 171 | ID_CHANCEcxx . . $ main_frame/ID_CHANCE., |
| 172 | |
| 173 | ID_ACESTEXTcxx . . $ main_frame/ID_ACESTEXT., |
| 174 | ID_TWOSTEXTcxx . . $ main_frame/ID_TWOSTEXT., |
| 175 | ID_THREESTEXTcxx . . $ main_frame/ID_THREESTEXT., |
| 176 | ID_FOURSTEXTcxx . . $ main_frame/ID_FOURSTEXT., |
| 177 | ID_FIVESTEXTcxx . . $ main_frame/ID_FIVESTEXT., |
| 178 | ID_SIXESTEXTcxx . . $ main_frame/ID_SIXESTEXT., |
| 179 | ID_THREEOFAKINDTEXTcxx . . $ main_frame/ID_THREEOFAKINDTEXT., |
| 180 | ID_FOUROFAKINDTEXTcxx . . $ main_frame/ID_FOUROFAKINDTEXT., |
| 181 | ID_FULLHOUSETEXTcxx . . $ main_frame/ID_FULLHOUSETEXT., |
| 182 | ID_SMALLSEQUENCETEXTcxx . . $ main_frame/ID_SMALLSEQUENCETEXT., |
| 183 | ID_LARGESEQUENCETEXTcxx . . $ main_frame/ID_LARGESEQUENCETEXT., |
| 184 | ID_YAHTZEETEXTcxx . . $ main_frame/ID_YAHTZEETEXT., |
| 185 | ID_CHANCETEXTcxx . . $ main_frame/ID_CHANCETEXT., |
| 186 | ID_YAHTZEEBONUSTEXTcxx . . $ main_frame/ID_YAHTZEEBONUSTEXT., |
| 187 | |
| 188 | ID_UPPERSECTIONTOTALcxx . . $ main_frame/ID_UPPERSECTIONTOTAL., |
| 189 | ID_BONUScxx . . $ main_frame/ID_BONUS., |
| 190 | ID_UPPERTOTALcxx . . $ main_frame/ID_UPPERTOTAL., |
| 191 | ID_LOWERTOTALcxx . . $ main_frame/ID_LOWERTOTAL., |
| 192 | ID_GRANDTOTALcxx . . $ main_frame/ID_GRANDTOTAL., |
| 193 | |
| 194 | ID_ROLLcxx . . $ main_frame/ID_ROLL., |
| 195 | ID_DICE1cxx . . $ main_frame/ID_DICE1., |
| 196 | ID_DICE2cxx . . $ main_frame/ID_DICE2., |
| 197 | ID_DICE3cxx . . $ main_frame/ID_DICE3., |
| 198 | ID_DICE4cxx . . $ main_frame/ID_DICE4., |
| 199 | ID_DICE5cxx . . $ main_frame/ID_DICE5., |
| 200 | |
| 201 | ID_DICE1KEEPcxx . . $ main_frame/ID_DICE1KEEP., |
| 202 | ID_DICE2KEEPcxx . . $ main_frame/ID_DICE2KEEP., |
| 203 | ID_DICE3KEEPcxx . . $ main_frame/ID_DICE3KEEP., |
| 204 | ID_DICE4KEEPcxx . . $ main_frame/ID_DICE4KEEP., |
| 205 | ID_DICE5KEEPcxx . . $ main_frame/ID_DICE5KEEP., |
| 206 | }; |
| 207 | |
| 208 | } |
| 209 | #endif |