summaryrefslogtreecommitdiff
path: root/docs/class_inheritance.txt
blob: 56f64b64d6f558296060c2560c0247cec8749273 (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
79
80
81
82
83
84

                      fpGUI Toolkit
                 CLASS INHERITANCE LAYOUT


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
in fpGUI. We also did not want to introduce IFDEF's in our code,
if we did not absolutely needed too.

Here is the inheritance for the X11 backend for TfpgCanvas:

                                      TObject
                                         |
                                   TfpgCanvasBase
                                         |
     TfpgCanvasImpl      --->       TfpgX11Canvas
           |
       TfpgCanvas


Here is the inheritance for the GDI backend for TfpgCanvas:

                                      TObject
                                         |
                                   TfpgCanvasBase
                                         |
     TfpgCanvasImpl      --->       TfpgGDICanvas
           |
       TfpgCanvas


TfpgCanvasImpl acts like an alias for the actual backend used. Every
painting library has a fpg_interface.pas unit that defines this
alias.

  X11:    corelib/x11/fpg_interface.pas
  GDI:    corelib/gdi/fpg_interface.pas


TfpgCanvas is common to all painting backends.

  TfpgCanvas:    corelib/fpg_main.pas


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

  TfpgCanvasBase:    corelib/fpg_base.pas


Each backend needs to implement the class interface defined by
TfpgCanvasBase. Obviously they are specific to each backend
so the unit implementing that interface, lives in that backend
specific directory.

  TfpgX11Canvas:    corelib/x11/fpg_x11.pas
  TfpgGDICanvas:    corelib/gdi/fpg_gdi.pas


Each backend has its own fpgui_toolkit.lpk Lazarus Package. Due
to the fpgui_toolkit including the common units and the backend
specific units, it completes the class hierachy and ties all the
units together into one framework.

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

  TfpgFontResourceImpl
  TfpgImageImpl
  TfpgCanvasImpl
  TfpgWindowImpl
  TfpgApplicationImpl
  TfpgClipboardImpl
  TfpgFileListImpl

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