⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mopoidcontainer.h

📁 一款大砖块的游戏
💻 H
字号:
/*
* ============================================================================
*  Name     : CMopoidContainer from MopoidContainer.h
*  Part of  : Mopoid
*  Created  : 16.01.2004 by Andreas Jakl / Mopius - http://www.mopius.com/
*  Description:
*     Declares container control for application.
*  Version  : 1.02
*  Copyright: 
*     'Mopoid' is free software; you can redistribute
*     it and/or modify it under the terms of the GNU General Public License
*     as published by the Free Software Foundation; either version 2 of
*     the License, or (at your option) any later version.
* 
*     'Mopoid' is distributed in the hope that it
*     will be useful, but WITHOUT ANY WARRANTY; without even the implied
*     warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*     See the GNU General Public License for more details.
* 
*     You should have received a copy of the GNU General Public License
*     along with 'Mopoid'; if not, write to the Free Software
*     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
* ============================================================================
*/

#ifndef __MOPOID_CONTAINER_H__
#define __MOPOID_CONTAINER_H__

#include "Mopoid.hrh"


#include <eikappui.h>
#include <coecntrl.h>
#include <eikspane.h>
// #include <events.h>
// #include <soundplayer.h>
#include "pngloader.h"
#include "mopoidgameengine.h"
#include <aknnotedialog.h>
#include <aknnotewrappers.h>

const TInt KLengthOfNaviTempString = 100;

class CMopoidGameEngine;

// -----------------------------------------------------------------------
// CMopoidContainer
// -----------------------------------------------------------------------
class CMopoidContainer : public CCoeControl, public MCoeControlObserver {

public:
  // -----------------------------------------------------------------------
  // Creates a CMopoidContainer object
  // -----------------------------------------------------------------------
  static CMopoidContainer * NewL(const TRect& aRect);

  // -----------------------------------------------------------------------
  // Creates a CMopoidView object
  // -----------------------------------------------------------------------
  static CMopoidContainer * NewLC(const TRect& aRect);

  // -----------------------------------------------------------------------
  // Returns the number of controls contained in this compound control
  // -----------------------------------------------------------------------
  TInt CountComponentControls() const;

  // -----------------------------------------------------------------------
  // Returns the component at the specified index
  // @param aIndex specifies index of component
  // @return Pointer to component control
  // -----------------------------------------------------------------------
  CCoeControl * ComponentControl(TInt aIndex) const;

  // -----------------------------------------------------------------------
  // Draws this container
  // -----------------------------------------------------------------------
  void Draw(const TRect& aRect) const;

  // -----------------------------------------------------------------------
  // Destroys container
  // -----------------------------------------------------------------------
  ~CMopoidContainer();

  //
  // Handler for events sent by a control to this Observer
  //
  void HandleControlEventL(CCoeControl * aControl, TCoeEvent aEventType);

  // --------------------------------------------------------------------------------------
  // Overridden function used to pass key events to child controls owned by this container
  // --------------------------------------------------------------------------------------
  TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);

  // -----------------------------------------------------------------------
  // Routine that dispatches Command events to individual handlers
  // -----------------------------------------------------------------------
  bool DispatchViewCommandEvents(TInt aCommand);



private:
  // -----------------------------------------------------------------------
  // Constructor
  // -----------------------------------------------------------------------
  CMopoidContainer();

  // -----------------------------------------------------------------------
  // Performs second phase construction of this Container
  // -----------------------------------------------------------------------
  void ConstructL(const TRect & aRect);

  // -----------------------------------------------------------------------
  // Routine that initializes components owned by this Container
  // -----------------------------------------------------------------------
  void InitComponentsL();

  // -----------------------------------------------------------------------
  // Routine that cleans up components owned by this container
  // -----------------------------------------------------------------------
  void CleanupComponents();

  // -----------------------------------------------------------------------
  // Routine that attempts to dispatch Control Events
  // -----------------------------------------------------------------------
  void DispatchControlEvents(CCoeControl * aControl, TCoeEvent aEventType);

  // -----------------------------------------------------------------------
  // Place holder routine to handle key events
  // -----------------------------------------------------------------------
  TBool HandleKeyEvents(const TKeyEvent& aKeyEvent, TEventCode aType);

  // -----------------------------------------------------------------------
  // Helper method to manage control in focus
  // -----------------------------------------------------------------------
  void ChangeFocus(CCoeControl * aNewControl);

private:
  TRgb iBackgroundColor;
  RPointerArray<CCoeControl> iCtrlArray;
  CCoeControl* iFocusedControl;

public:
  CMopoidGameEngine* iGameEngine;


private:
  // -----------------------------------------------------------------------------
  // NOTE: The following section is managed by the C++Builder IDE - DO NOT MODIFY
  //IDE-MANAGED-START
    /* 22.01.05 18:48 */
  //IDE-MANAGED-END
    void OniMenuItemSoundOffViewCommandL( TInt aCommand );
    void OniMenuItemSoundOnViewCommandL( TInt aCommand );
    void OniMenuItemNewGameViewCommand( TInt aCommand );
    void OniSoundPlayerStateChange( CBase * aSoundPlayer, TInt iPlayerState );
    void OniMenuItemAboutViewCommandL( TInt aCommand );
    TInt ExecuteiAknAboutNoteL();
  // -----------------------------------------------------------------------------
};

#endif // __MOPOID_CONTAINER_H__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -