summaryrefslogtreecommitdiff
path: root/docs/class_inheritance.txt
blob: 38968f41dd3a1c8696777812a9a281019d5f7bfb (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78

The derivation and inheritance of classes are different than one
might be used to.  It will be explained by the following
example.

Due to the graphics painting library being different on certain
platforms we had to do some trickery to the inheritance so the
same classname could be used in descendant classes for widgets
etc in fpGUI.

Here is the inheritance for the X11 backend for TFCanvas:

                                  TObject
                                     |
                               TFCustomCanvas
                                     |
     TDefCanvas      --->        TX11Canvas
         |
      TFCanvas



Here is the inheritance for the GDI backend for TFCanvas:

                                  TObject
                                     |
                               TFCustomCanvas
                                     |
     TDefCanvas      --->        TGDICanvas
         |
      TFCanvas


TDefCanvas acts like a alias for the actual backend used. Every 
painting library has a gfxinterface.pas unit that defines this
alias.

  X11:    gfx/x11/gfxinterface.pas
  GDI:    gfx/gdi/gfxinterface.pas


TFCanvas is common to all painting backends.

  TFCanvas:    gfx/fpgfx.pas


TFCustomCanvas is also common to all painting backends and acts
like a abstract class defining the class interface that needs
to be implemented.

  TFCustomCanvas:    gfx/gfxbase.pas


Each backend needs to implement the class interface defined by
TFCustomCanvas. Obviously they are specific to each backend
so lives in that backends directory.

  TX11Canvas:    gfx/x11/gfx_x11.pas
  TGDICanvas:    gfx/gdi/gfx_gdi.pas


Each backend has it's own fpgfxpackage.lpk Lazarus Package. Due
to the fpgfxpackage including the common units and the backend
specific units, it completes the class hierachy and ties
all the units together.

Other classes that follow this same process (inheritance) are
listed below.  Their actual definitions are in the 
gfxinterface.pas unit in each backend directory.

  TDefFont
  TDefScreen
  TDefApplication
  TDefWindow
  TDefBitmap

        ---------------oO0Oo-----------------