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

📄 oggcontrols.h

📁 OggPlay for Symbian 是symbian上的一个媒体播放程序的源码。它支持ogg,wav等等多媒体格式。
💻 H
📖 第 1 页 / 共 2 页
字号:

 protected:

  virtual TBool ReadArguments(TOggParser& p);

  virtual void Draw(CBitmapContext& aBitmapContext);

  HBufC*      iText;
  CArrayPtrFlat<CFbsBitmap> iBitmaps;   
  CArrayPtrFlat<CFbsBitmap> iMasks;
};


// COggButton:
// A bitmapped button. Several bitmaps can be supplied (all optional):
// - A monochrome mask defining active (black) and inactive regions (white)
//   If not suppplied, the entire control area is active.
// - the normal state (not needed if already included in the background bitmap) + mask
// - the disabled state + mask
// - the pressed state + mask
// Ownership of the bitmaps is taken!
//-------------------
class COggButton : public COggControl {

 public:

  COggButton();
  virtual ~COggButton();

  void SetActiveMask(const TFileName& aFileName, TInt anIdx);
  void SetNormalIcon(CGulIcon* anIcon);
  void SetPressedIcon(CGulIcon* anIcon);
  void SetDimmedIcon(CGulIcon* anIcon);
  void SetStyle(TInt aStyle);
  void SetState(TInt aState);

 protected:

  virtual TBool ReadArguments(TOggParser& p);

  virtual void Draw(CBitmapContext& aBitmapContext);
  virtual void PointerEvent(const TPointerEvent& p);

  
  CFbsBitmap* iActiveMask;
  CGulIcon*   iNormalIcon;
  CGulIcon*   iPressedIcon;
  CGulIcon*   iDimmedIcon;

  TInt        iState; // 0 = normal; 1= pressed
  TInt        iStyle; // 0 = action button; 1 = two state button
};


// COggSlider:
// A slider control with different styles:
// style 0 -> part of a bitmap is shown (opened from left to right)
// style 1 -> like 0, but opening from bottom to top
// style 2 -> the bitmap is moved from left to right
// style 3 -> the bitmap is moved from bootom to top
// ----------------------------------------------------------------
class COggSlider : public COggControl {

 public:

  COggSlider();
  virtual ~COggSlider();
  void SetStyle(TInt aStyle);
  void SetKnobIcon(CGulIcon* anIcon);
  void SetValue(TInt aValue);  
  void SetMaxValue(TInt aMaxValue);

  TInt CurrentValue();

 protected:

  virtual TBool ReadArguments(TOggParser& p);

  virtual void Draw(CBitmapContext& aBitmapContext);
  virtual void PointerEvent(const TPointerEvent& p);

  TInt GetPosFromValue(TInt aValue);
  TInt GetValueFromPos(TInt aPos);

  CGulIcon* iKnobIcon;
  TInt      iStyle;
  TInt      iValue;
  TInt      iMaxValue;
  TBool     iIsMoving;
  TInt      iPos; // current position in pixels
};


// COggScrollBar
// A scrollbar that can have an associated control (e.g. a listbox)
//---------------------------------
class COggScrollBar : public COggControl
{

 public:

  COggScrollBar();
  virtual ~COggScrollBar();

  void SetStyle(TInt aStyle);
  void SetKnobIcon(CGulIcon* anIcon);
  void SetScrollerSize(TInt aSize);
  void SetPage(TInt aPage);
  void SetStep(TInt aStep);
  void SetAssociatedControl(COggControl* aControl);
  void SetMaxValue(TInt aMaxValue);
  void SetValue(TInt aValue);

  TInt CurrentValue();

 protected:

  virtual TBool ReadArguments(TOggParser& p);

  virtual void Draw(CBitmapContext& aBitmapContext);
  virtual void PointerEvent(const TPointerEvent& p);

  TInt GetValueFromPos(TInt aPos);
  TInt GetPosFromValue(TInt aValue);

  TBool        iStyle; // 0= horizontal; 1= vertical
  TInt         iValue;
  TInt         iMaxValue;
  COggControl* iAssociated;
  CGulIcon*    iKnobIcon;
  TInt         iScrollerSize;
  TInt         iPos;
  TInt         iPage;
  TInt         iStep;
  TBool        iIsMoving;
};


// COggListBox
// This is a simple list box which holds a visible text in each
// line plus an invisible ("info") string.
//------------------
class COggListBox : public COggControl 
{
public:
#ifdef PLAYLIST_SUPPORT
  enum TItemTypes { ETitle, EAlbum, EArtist, EGenre, ESubFolder, EFileName, EBack, EPlaying, EPaused, EPlayList};
#else
  enum TItemTypes { ETitle, EAlbum, EArtist, EGenre, ESubFolder, EFileName, EBack, EPlaying, EPaused};
#endif

 public:

  COggListBox();
  virtual ~COggListBox();

  void SetText(CDesCArray* aText);
  void SetVertScrollBar(COggScrollBar* aScrollBar);
  void SetFont(CFont* aFont, TBool ownedByControl = EFalse);
    
  void SetFontColor(TRgb aColor);
  void SetFontColorSelected(TRgb aColor);
  void SetBarColorSelected(TRgb aColor);
  virtual void SetPosition(TInt ax, TInt ay, TInt aw, TInt ah);

  CColumnListBoxData* GetColumnListBoxData();

  void ClearText();
  void AppendText(const TDesC& aText);
  TInt CountText();
  CDesCArray* GetTextArray();

  void ScrollBy(TInt nLines);
  TInt CurrentItemIndex();
  TInt NofVisibleLines();
  TInt SetCurrentItemIndex(TInt idx);
  void SetTopIndex(TInt idx);

  virtual void Redraw(TBool doRedraw = ETrue);

 protected:
  virtual void Draw(CBitmapContext& aBitmapContext);
  virtual void Cycle();
  virtual void PointerEvent(const TPointerEvent& p);
  virtual void ControlEvent(TInt anEventType, TInt aValue);
  virtual TBool ReadArguments(TOggParser& p);

  TInt GetColumnFromPos(TInt aPos);
  TInt GetLineFromPos(TInt aPos);

  void UpdateScrollBar();

  CFont* iFont;
  TBool  iOwnedByControl;
  TRgb   iFontColor;
  TRgb   iFontColorSelected;
  TBool  iUseBarSelected;
  TRgb   iBarColorSelected;
  TInt   iTop;
  TInt   iSelected;

  TInt   iFontHeight;
  TInt   iFontAscent;
  TInt   iLineHeight;
  TInt   iLinePadding;

  TInt   iLinesVisible;
  TInt   iScroll;
  TInt   iOffset;

  CColumnListBoxData*  iData;
  CDesCArray*          iText;
  COggScrollBar*       iScrollBar;
};


// COggAnalyzer
// A frequency analyzer which does a discrete fourier transformation
// and displays the amplitude in dB of 16 frequency bands.
// --------------------
class COggAnalyzer : public COggControl {

 public:

  COggAnalyzer();
  virtual ~COggAnalyzer();

  virtual void SetPosition(TInt ax, TInt ay, TInt aw, TInt ah);
  void SetBarIcon(CGulIcon* aBarIcon);
  void SetValue(TInt i, TInt theValue);
  void SetStyle(TInt aStyle);
  void RenderFrequencies(short int data[256]);

  void RenderWaveformFromMDCT(const TInt32 * aFreqBins);
#if !defined(SERIES60)
  void RenderWaveform(short int data[2][512]);
#else
  void RenderWaveform(short int *data);
#endif
  void Clear();
  TInt Style();

 protected:

  virtual TBool ReadArguments(TOggParser& p);

  virtual void Cycle();
  virtual void Draw(CBitmapContext& aBitmapContext);
  virtual void PointerEvent(const TPointerEvent& p);

  CGulIcon* iBarIcon;
  TInt      iNumValues;
  //TInt      iShowPeaks; // show peak value for iShowPeaks cycles
  TInt      iStyle;     // currently only 0=off; 1=on

  TInt*     iValues;    // the current values
  TInt*     iPeaks;     // the current peak values
  short int iFFTAbs[512];
  short int iFFTIm[512];
  short int iFFTRe[512];
  int       iDx;
};


// COggCanvas
// A canvas that can display and manage several COggControls 
// and which uses an off-screen bitmap for double buffering
//----------------------------------------------------------
class COggCanvas : public CCoeControl //, public MMdaImageUtilObserver
{
 public:

  COggCanvas();
  virtual ~COggCanvas();
  TInt LoadBackgroundBitmapL(const TFileName& aFileName, TInt iIdx);

  void Refresh();
  void Invalidate();

  void DrawControl();  // redraw the off screen bitmap

  // Modify/add/clear controls: 
  COggControl* GetControl(TInt i);
  void AddControl(COggControl* c);
  void ClearControls();

  void CycleHighFrequencyControls();
  void CycleLowFrequencyControls();

 protected:

  // from MMdaImageUtilObserver:
//  virtual void MiuoOpenComplete(TInt aError);
//  virtual void MiuoConvertComplete(TInt aError);
//  virtual void MiuoCreateComplete(TInt aError);

  // from CCoeControl:
  virtual void HandlePointerEventL(const TPointerEvent& aPointerEvent);
  virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);

  virtual void DrawControl(CBitmapContext& aBitmapContext, CBitmapDevice& aBitmapDevice) const;

  void SizeChanged();
  void DestroyBitmap();
  void CreateBitmapL(const TSize& aSize);
  void Draw(const TRect& aRect) const;

protected:
  CFbsBitGc*         iBitmapContext;
  CFbsBitmap*	     iBitmap;
  CFbsBitmap*        iBackground;
  CFbsBitmapDevice*  iBitmapDevice;
  
  CArrayPtrFlat<COggControl> iControls;

  COggControl*       iGrabbed; // a control gets grabbed on a pointer button down event
  COggControl*       iFocused; // control that has input focus (UIQ does not need this)
};

#endif

⌨️ 快捷键说明

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