File indexing completed on 2024-04-14 04:49:09
0001 /* 0002 This file belong to the KMPlayer project, a movie player plugin for Konqueror 0003 SPDX-FileCopyrightText: 2008 Koos Vriezen <koos.vriezen@gmail.com> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #ifndef _KMPLAYER_SURFACE_H_ 0009 #define _KMPLAYER_SURFACE_H_ 0010 0011 #include <config-kmplayer.h> 0012 0013 #include "kmplayerplaylist.h" 0014 0015 #ifdef KMPLAYER_WITH_CAIRO 0016 typedef struct _cairo_surface cairo_surface_t; 0017 #endif 0018 0019 namespace KMPlayer { 0020 0021 class ViewArea; 0022 0023 class Surface : public TreeNode <Surface> 0024 { 0025 public: 0026 Surface (ViewArea *widget); 0027 ~Surface(); 0028 0029 void clear (); 0030 Surface *createSurface (NodePtr owner, const SRect & rect); 0031 IRect toScreen (const SSize &size); 0032 void resize (const SRect & rect, bool parent_resized=false); 0033 void repaint (); 0034 void repaint (const SRect &rect); 0035 void remove (); // remove from parent, mark ancestors dirty 0036 void markDirty (); // mark this and ancestors dirty 0037 void updateChildren (bool parent_resized=false); 0038 void setBackgroundColor (unsigned int argb); 0039 0040 NodePtrW node; 0041 SRect bounds; // bounds in parent coord. 0042 SSize virtual_size; // virtual size in screen coord. 0043 float xscale, yscale; // internal scaling 0044 unsigned int background_color; // rgba background color 0045 unsigned short x_scroll; // top of horizontal knob 0046 unsigned short y_scroll; // top of vertical knob 0047 #ifdef KMPLAYER_WITH_CAIRO 0048 cairo_surface_t *surface; 0049 #endif 0050 bool dirty; // a decendant is removed 0051 bool scroll; 0052 bool has_mouse; 0053 0054 private: 0055 NodePtrW current_video; 0056 ViewArea *view_widget; 0057 }; 0058 0059 typedef Item<Surface>::SharedType SurfacePtr; 0060 typedef Item<Surface>::WeakType SurfacePtrW; 0061 ITEM_AS_POINTER(KMPlayer::Surface) 0062 0063 template <> void TreeNode<Surface>::appendChild (Surface *c); 0064 template <> void TreeNode<Surface>::insertBefore (Surface *c, Surface *b); 0065 template <> void TreeNode<Surface>::removeChild (SurfacePtr c); 0066 0067 } // namespace 0068 0069 #endif