javauis/lcdui_akn/lcdui/inc/CMIDCanvas.h
branchRCL_3
changeset 60 6c158198356e
parent 59 e5618cc85d74
equal deleted inserted replaced
59:e5618cc85d74 60:6c158198356e
   132 NONSHARABLE_CLASS(CMIDCanvas) :
   132 NONSHARABLE_CLASS(CMIDCanvas) :
   133         public CCoeControl,
   133         public CCoeControl,
   134         public MMIDCanvas,
   134         public MMIDCanvas,
   135         public MMIDBufferProcessor,
   135         public MMIDBufferProcessor,
   136         public MDirectContainer,
   136         public MDirectContainer,
       
   137         public MMIDLcduiEventConsumer,
   137 #ifdef CANVAS_DIRECT_ACCESS
   138 #ifdef CANVAS_DIRECT_ACCESS
   138         public MDirectScreenAccess,
   139         public MDirectScreenAccess,
   139 #endif
   140 #endif
   140         public MMIDMediaKeysListener,
   141         public MMIDMediaKeysListener,
   141 #ifdef RD_TACTILE_FEEDBACK
   142 #ifdef RD_TACTILE_FEEDBACK
   581      * @since  S60 v9.2
   582      * @since  S60 v9.2
   582      */
   583      */
   583     void MdcNotifyContentAdded();
   584     void MdcNotifyContentAdded();
   584 #endif
   585 #endif
   585 
   586 
       
   587     /**
       
   588      * From MDirectContainer.
       
   589      *
       
   590      * @since  S60 v9.2
       
   591      * @param TBool aEnableFix
       
   592      */
       
   593     void MdcFixUIOrientation(TBool aEnableFix);
       
   594 
       
   595 // From MMIDLcduiEventConsumer
       
   596 public:
       
   597     void HandleLcduiEvent(int aType);
   586 
   598 
   587 // from base class MMIDMediaKeysListener
   599 // from base class MMIDMediaKeysListener
   588 
   600 
   589     /**
   601     /**
   590      * From MMIDMediaKeysListener.
   602      * From MMIDMediaKeysListener.
   706      * @return <code>ETrue</code> if this component container is set to full screen
   718      * @return <code>ETrue</code> if this component container is set to full screen
   707      *         and <code>EFalse</code> if not.
   719      *         and <code>EFalse</code> if not.
   708      * @since S60 5.0
   720      * @since S60 5.0
   709      */
   721      */
   710     TBool IsFullScreen() const;
   722     TBool IsFullScreen() const;
       
   723 
       
   724     /**
       
   725     * Returns the drawing rectangle.
       
   726     *
       
   727     * @since  java 2.1
       
   728     * @return The rectangle where canvas draws.
       
   729     */
       
   730     inline const TRect ViewRect() const;
   711 
   731 
   712 #ifdef RD_JAVA_S60_RELEASE_9_2
   732 #ifdef RD_JAVA_S60_RELEASE_9_2
   713     /**
   733     /**
   714      * Gets a Displayable from the container.
   734      * Gets a Displayable from the container.
   715      *
   735      *
  1048      * @since   S60 3.2
  1068      * @since   S60 3.2
  1049      * @return  ETrue, if network indicator is shown in Canvas, otherwise
  1069      * @return  ETrue, if network indicator is shown in Canvas, otherwise
  1050      *          returns EFalse.
  1070      *          returns EFalse.
  1051      */
  1071      */
  1052     TBool IsNetworkIndicatorEnabledL() const;
  1072     TBool IsNetworkIndicatorEnabledL() const;
  1053 
  1073 #ifdef RD_JAVA_NGA_ENABLED
       
  1074     TBool IsDownScaling(const TSize& aSourceSize, const TRect& aDestRect,TBool aM3GContent) const;
       
  1075 #else
       
  1076     TBool IsDownScaling(const TSize& aSourceSize, const TRect& aDestRect) const;
       
  1077 #endif //RD_JAVA_NGA_ENABLED
  1054 public:
  1078 public:
  1055     /**
  1079     /**
  1056      * Handles switching from foreground to
  1080      * Handles switching from foreground to
  1057      * background and vice versa. Mainly rendering
  1081      * background and vice versa. Mainly rendering
  1058      * context and surfaces need to be relased.
  1082      * context and surfaces need to be relased.
  1059      */
  1083      */
  1060     void HandleForeground(TBool aForeground);
  1084     void HandleForeground(TBool aForeground);
       
  1085 
       
  1086 #ifdef RD_JAVA_NGA_ENABLED
       
  1087     /**
       
  1088      * Motification about MIDlet's changed full or partial foreground status.
       
  1089      * @param aFullOrPartialFg  ETrue, when full or partial foreground was gained.
       
  1090      *                          EFalse, when foreground was fully lost.
       
  1091      * @param aCurrentDisplayable   ETrue, if canvas is the current displayable
       
  1092      */
       
  1093     void HandleFullOrPartialForegroundL(TBool aFullOrPartialFg, TBool aCurrentDisplayable);
       
  1094 
       
  1095     /**
       
  1096      * Frees all GPU memory that is reserved by Canvas.
       
  1097      * @param aForced   If ETrue, memory is freed without checking window visibility
       
  1098      *                  If EFalse, memory is freed if canvas window is invisible.
       
  1099      */
       
  1100     void FreeGraphicsMemory(TBool aForced);
       
  1101 #endif
  1061 
  1102 
  1062 private:
  1103 private:
  1063     /** States of the first paint */
  1104     /** States of the first paint */
  1064     enum TFirstPainState {
  1105     enum TFirstPainState {
  1065         EFirstPaintNeverOccurred = 0,
  1106         EFirstPaintNeverOccurred = 0,
  1118 
  1159 
  1119     /**
  1160     /**
  1120      * @see MMIDComponentNgaExtension#IsEglAvailable()
  1161      * @see MMIDComponentNgaExtension#IsEglAvailable()
  1121      * @since S60 9.2
  1162      * @since S60 9.2
  1122      */
  1163      */
  1123     TBool IsEglAvailable();
  1164     TBool IsEglAvailable() const;
  1124 
  1165 
  1125     /**
  1166     /**
  1126      * @see MMIDComponentNgaExtension#BindEglSurface()
  1167      * @see MMIDComponentNgaExtension#BindEglSurface()
  1127      * @since S60 9.2
  1168      * @since S60 9.2
  1128      */
  1169      */
  1164     /**
  1205     /**
  1165      * @see MMIDCanvas::UpdateRect(const TRect&)
  1206      * @see MMIDCanvas::UpdateRect(const TRect&)
  1166      */
  1207      */
  1167     void UpdateRect(const TRect& aRect);
  1208     void UpdateRect(const TRect& aRect);
  1168 
  1209 
       
  1210     /**
       
  1211      * @see MMIDCanvas::MidletExiting()
       
  1212      */
       
  1213     void MidletExiting();
  1169 private:
  1214 private:
  1170     /**
  1215     /**
  1171      * Blits pbuffer surface scaled to window surface
  1216      * Blits pbuffer surface scaled to window surface
  1172      * @since S60 9.2
  1217      * @since S60 9.2
  1173      */
  1218      */
  1205      */
  1250      */
  1206     void OpenEglL();
  1251     void OpenEglL();
  1207 
  1252 
  1208     /**
  1253     /**
  1209      * Releases EGL resources
  1254      * Releases EGL resources
  1210      * @since S60 9.2
  1255      * @param aReadback     Defines if surface content is copied to bitmap before
  1211      */
  1256      *                      destroying surface
  1212     void CloseEgl();
  1257      * @since S60 9.2
       
  1258      */
       
  1259     void CloseEgl(TBool aReadback);
  1213 
  1260 
  1214     /**
  1261     /**
  1215      * Creates EGL context
  1262      * Creates EGL context
  1216      * @since S60 9.2
  1263      * @since S60 9.2
  1217      */
  1264      */
  1241     TSize GetEglSurfaceSize(EGLSurface aSurface = EGL_NO_SURFACE);
  1288     TSize GetEglSurfaceSize(EGLSurface aSurface = EGL_NO_SURFACE);
  1242 
  1289 
  1243     /**
  1290     /**
  1244      * Handles size changed. EGL window surface needs to be recreated
  1291      * Handles size changed. EGL window surface needs to be recreated
  1245      * if window size increases.
  1292      * if window size increases.
  1246      * @since S60 9.2
  1293      * @param aOrientationChange    ETrue, method is called because of orientation change
  1247      */
  1294      * @since S60 9.2
  1248     void HandleSizeChanged();
  1295      */
       
  1296     void HandleSizeChanged(TBool aOrientationChange);
  1249 
  1297 
  1250     /**
  1298     /**
  1251      * Draws frame buffer 2D content as OpenGL texture in case of
  1299      * Draws frame buffer 2D content as OpenGL texture in case of
  1252      * M3G + 2D mixing.
  1300      * M3G + 2D mixing.
  1253      * @since S60 9.2
  1301      * @since S60 9.2
  1331      * Clears UI surface to transparent color
  1379      * Clears UI surface to transparent color
  1332      * @since S60 9.2
  1380      * @since S60 9.2
  1333      */
  1381      */
  1334     void ClearUiSurface(TBool aDrawing);
  1382     void ClearUiSurface(TBool aDrawing);
  1335 
  1383 
       
  1384     /**
       
  1385      * Draws current canvas content to CWindowGc.
       
  1386      * @since S60 9.2
       
  1387      */
       
  1388     void DrawToWindowGc();
       
  1389 
       
  1390     /**
       
  1391      * Checks if canvas window is currently really visible on screen.
       
  1392      * Used for checking when canvas should destroy its surfaces.
       
  1393      * @since S60 9.2
       
  1394      */
       
  1395     TBool IsWindowVisible() const;
       
  1396 
       
  1397     /**
       
  1398      * Posts forced paint event to Java side. Forced paint causes Canvas.paint() to be
       
  1399      * called, event if Displayable.isShown() would return false in Java. See also Canvas.java.
       
  1400      * @since S60 9.2
       
  1401      */
       
  1402     void PostForcedPaint();
  1336 #endif // RD_JAVA_NGA_ENABLED
  1403 #endif // RD_JAVA_NGA_ENABLED
  1337 
  1404 
  1338 private: // data
  1405 private: // data
  1339 
  1406 
  1340     /** CMIDCanvas flags datatype */
  1407     /** CMIDCanvas flags datatype */
  1559      * Stores old bounds of the direct content
  1626      * Stores old bounds of the direct content
  1560      * used before SizeChanged is called
  1627      * used before SizeChanged is called
  1561      */
  1628      */
  1562     TRect iOldContentBounds;
  1629     TRect iOldContentBounds;
  1563 
  1630 
  1564     /**
       
  1565      * The startup trace should be done only once.
       
  1566      */
       
  1567     mutable TBool iStartUpTraceDone;
       
  1568 
       
  1569     // The list of registered custom components.
  1631     // The list of registered custom components.
  1570     RPointerArray< MMIDCustomComponent > iCustomComponents;
  1632     RPointerArray< MMIDCustomComponent > iCustomComponents;
  1571 
  1633 
  1572     // The count of custom components.
  1634     // The count of custom components.
  1573     TInt iCustomComponentsControlCount;
  1635     TInt iCustomComponentsControlCount;
  1635     /**
  1697     /**
  1636      * Flag indicating whether midlet is drawing M3G content.
  1698      * Flag indicating whether midlet is drawing M3G content.
  1637      * Reset to EFalse in CloseEgl().
  1699      * Reset to EFalse in CloseEgl().
  1638      */
  1700      */
  1639     TBool iM3GContent;
  1701     TBool iM3GContent;
       
  1702     /**
       
  1703      * Previously Flag of iM3GContent
       
  1704      */
       
  1705     mutable TBool iPrevM3GContent;
  1640 
  1706 
  1641     /**
  1707     /**
  1642      * ETrue, while M3G has bound to canvas EGL surface.
  1708      * ETrue, while M3G has bound to canvas EGL surface.
  1643      */
  1709      */
  1644     TBool iEglOccupied;
  1710     TBool iEglOccupied;
  1701      * OpenGL coordinate arrays used fo r rendering filled rectangles
  1767      * OpenGL coordinate arrays used fo r rendering filled rectangles
  1702      */
  1768      */
  1703     GLshort* iVertexArray;
  1769     GLshort* iVertexArray;
  1704     GLubyte* iTriangleStrip;
  1770     GLubyte* iTriangleStrip;
  1705 
  1771 
       
  1772     /**
       
  1773      * ETrue, when midlet is exiting and this canvas is the current displayable
       
  1774      */
       
  1775     TBool iExiting;
  1706 #endif // RD_JAVA_NGA_ENABLED
  1776 #endif // RD_JAVA_NGA_ENABLED
  1707 
  1777 
  1708     /**
  1778     /**
  1709      * If dragging was started (by pointer down) inside the canvas,
  1779      * If dragging was started (by pointer down) inside the canvas,
  1710      * all drag events and release event should go to canvas
  1780      * all drag events and release event should go to canvas
  1735         *aDst++ = (argb >>  8) & 0xFFu;
  1805         *aDst++ = (argb >>  8) & 0xFFu;
  1736         *aDst++ =  argb        & 0xFFu;
  1806         *aDst++ =  argb        & 0xFFu;
  1737         *aDst++ = (argb >> 24) & 0xFFu;
  1807         *aDst++ = (argb >> 24) & 0xFFu;
  1738     }
  1808     }
  1739 }
  1809 }
       
  1810 
       
  1811 inline const TRect CMIDCanvas::ViewRect() const
       
  1812 {
       
  1813     return iViewRect;
       
  1814 }
  1740 #endif // RD_JAVA_NGA_ENABLED
  1815 #endif // RD_JAVA_NGA_ENABLED
  1741 
  1816 
  1742 #endif // CMIDCANVAS_H
  1817 #endif // CMIDCANVAS_H