summaryrefslogtreecommitdiff
path: root/src/lib/elementary/efl_ui_caching_factory.eo
blob: 18643f7e1d339d55820607426dceb4d9c8b8aa9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
parse efl_app;

class Efl.Ui.Caching_Factory extends Efl.Ui.Widget_Factory
{
   [[Efl UI Factory that provides object caching.

     This factory handles caching of one type of object that must be an @Efl.Gfx.Entity with an @Efl.Ui.View interface
     defined.
     This factory will rely on its parent class @Efl.Ui.Widget_Factory for creating the subset of class that match the
     @Efl.Ui.Widget interface.
     The factory will automatically empty the cache when the application goes into the background
     (@[Efl.App.pause] event).

     Creating objects is costly and time consuming, keeping a few on hand for when you next will need them helps a lot.
     This is what this factory caching infrastructure provides. It will create the object from the class defined on it
     and set the parent and the model as needed for all created items. The View has to release the Item using the
     release function of the Factory interface for all of this to work properly.
     @since 1.24
   ]]
   methods {
      @property memory_limit {
         [[Define the maximum size in Bytes that all the objects waiting on standby in the cache can take.
           They must provide the @Efl.Cached.Item interface for an accurate accounting.]]
         get {}
         set {}
         values {
            limit: uint; [[When set to zero, there is no limit on the amount of memory the cache will use.]]
         }
      }
      @property items_limit {
         [[Define how many maximum number of items are waiting on standby in the cache.]]
         get {}
         set {}
         values {
            limit: uint; [[When set to zero, there is no limit to the amount of items stored in the cache.]]
         }
      }
   }

   implements {
      Efl.Ui.Factory.create;
      Efl.Ui.Factory.release;
      Efl.Ui.Property_Bind.property_bind;
      Efl.Ui.Widget_Factory.item_class { get; set; }
      Efl.Object.invalidate;
      Efl.Object.finalize;
   }
}