/[papo]/gnue/designer/src/schema/VisualTable.py
ViewVC logotype

Diff of /gnue/designer/src/schema/VisualTable.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by charlie, Tue Aug 27 20:39:55 2002 UTC revision 1.4 by styxman, Fri Nov 8 16:46:04 2002 UTC
# Line 37  class VisualTable: Line 37  class VisualTable:
37      self.pen = wxBLACK_PEN # wxPen(...)      self.pen = wxBLACK_PEN # wxPen(...)
38      self.pen_highlighted = wxPen(wxBLUE, 1, wxSOLID)      self.pen_highlighted = wxPen(wxBLUE, 1, wxSOLID)
39      self.brush = wxWHITE_BRUSH # wxTRANSPARENT_BRUSH # wxBLACK_BRUSH      self.brush = wxWHITE_BRUSH # wxTRANSPARENT_BRUSH # wxBLACK_BRUSH
40        self.pen_inv = wxWHITE_PEN # wxPen(...)
41        self.brush_inv = wxBLACK_BRUSH # wxTRANSPARENT_BRUSH # wxBLACK_BRUSH
42        self.xpos=-100    
43        self.ypos=-100
44        self.width=10
45        self.height=10
46        self.textheight=10
47        
48        
49    def calculateDimensions(self,dc):    def calculateDimensions(self,dc):
50      (w,h)=dc.GetTextExtent(self.instance.name)      (w,h)=dc.GetTextExtent(self.instance.name)
# Line 44  class VisualTable: Line 52  class VisualTable:
52      self.height=h      self.height=h
53      self.textheight=h      self.textheight=h
54      fields=self.instance.findChildOfType('GSFields')      fields=self.instance.findChildOfType('GSFields')
55      for c in fields._children:      if fields!=None:
56        (w,h)=dc.GetTextExtent(c.name)        for c in fields._children:
57        if w>self.width:          (w,h)=dc.GetTextExtent(c.name)
58          self.width=w          if w>self.width:
59        self.height=self.height+5+h            self.width=w
60            self.height=self.height+5+h
61    
62        # add some space for the borders
63        self.height=self.height+40
64        self.width=self.width+20
65                
66        return (self.width,self.height)
67    
68      def recalculateDimensions(self,dc):
69        (w,h)=dc.GetTextExtent(self.instance.name)
70        self.width=w
71        self.height=h
72        self.textheight=h
73        fields=self.instance.findChildOfType('GSFields')
74        if fields!=None:
75          for c in fields._children:
76            (w,h)=dc.GetTextExtent(c.name)
77            if w>self.width:
78              self.width=w
79            self.height=self.height+5+h
80    
81      # add some space for the borders      # add some space for the borders
82      self.height=self.height+40      self.height=self.height+40
# Line 60  class VisualTable: Line 88  class VisualTable:
88      self.xpos=x      self.xpos=x
89      self.ypos=y      self.ypos=y
90    
91    def drawMe(self,dc,current):    def drawMe(self,dc,current,inverse=false):
92        dc.SetPen(self.pen)        if inverse:
93        dc.SetBrush(self.brush)          dc.SetPen(self.pen_inv)
94            dc.SetBrush(self.brush_inv)
95          else:
96            dc.SetPen(self.pen)
97            dc.SetBrush(self.brush)
98    
99        dc.DrawRectangle(self.xpos,self.ypos,self.width,self.height)        dc.DrawRectangle(self.xpos,self.ypos,self.width,self.height)
100        dc.DrawLine(self.xpos,self.ypos+self.textheight+20,        dc.DrawLine(self.xpos,self.ypos+self.textheight+20,
# Line 74  class VisualTable: Line 106  class VisualTable:
106        dc.DrawText(self.instance.name,self.xpos+10,self.ypos+10)        dc.DrawText(self.instance.name,self.xpos+10,self.ypos+10)
107        y=self.ypos+34        y=self.ypos+34
108        fields=self.instance.findChildOfType('GSFields')        fields=self.instance.findChildOfType('GSFields')
109        for c in fields._children:        if fields!=None:
110            for c in fields._children:
111                    
112          # check if this field is the current selected object            # check if this field is the current selected object
113          if c==current:            if c==current:
114            dc.SetPen(self.pen_highlighted)              dc.SetPen(self.pen_highlighted)
115            dc.SetBrush(wxTRANSPARENT_BRUSH)              dc.SetBrush(wxTRANSPARENT_BRUSH)
116            dc.DrawRectangle(self.xpos+3,y+8,self.width-6,self.textheight+4)              dc.DrawRectangle(self.xpos+3,y+8,self.width-6,self.textheight+4)
117                        
118          dc.DrawText(c.name,self.xpos+10,y+10)            dc.DrawText(c.name,self.xpos+10,y+10)
119          y=y+self.textheight+5            y=y+self.textheight+5
120    
121        # check if the table is selected        # check if the table is selected
122        if self.instance==current:        if self.instance==current:
# Line 105  class VisualTable: Line 138  class VisualTable:
138                
139        # cursor in the middle  -> return fields        # cursor in the middle  -> return fields
140        fields=self.instance.findChildOfType('GSFields')        fields=self.instance.findChildOfType('GSFields')
141        for c in fields._children:                if fields!=None:
142          hy=hy+self.textheight+5          for c in fields._children:        
143          if y<hy:            hy=hy+self.textheight+5
144            return c            if y<hy:
145                return c
146                    
147        # cursor at the bottom part ->  return table        # cursor at the bottom part ->  return table
148        return self        return self
# Line 118  class VisualTable: Line 152  class VisualTable:
152        return None        return None
153    
154    # return pointer to field/table object depending on position    # return pointer to field/table object depending on position
155    def isInRectangle(self,x,y,x2,y2):    def isInRectangle(self,x,y,x2,y2):    
156      #      if (not (x>self.xpos+self.width or x2<self.xpos)) and \
157      #if x>=self.xpos and x<=self.xpos+self.height and \         (not (y>self.ypos+self.width and y2<self.ypos)):
158      #       y>=self.ypos and y<=self.ypos+self.width:        return true
159      #  return self.instance      else:
     #else:  
160        return false        return false
161            

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26