source: trunk/SRC/ToBeReviewed/WIDGET/COMPOUND_WIDGET/cw_pagelayout.pro @ 157

Last change on this file since 157 was 157, checked in by navarro, 18 years ago

header improvements + xxx doc

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 5.5 KB
Line 
1;*********************************************************************
2;+
3; @file_comments
4;
5;
6; @categories
7; Compound widget
8;
9; @param EVENT
10;
11;
12; @returns
13;
14;
15; @uses
16;
17;
18; @restrictions
19;
20;
21; @examples
22;
23;
24; @history
25;
26;
27; @version
28; $Id$
29;-
30;*********************************************************************
31FUNCTION cw_pagelayout_event, event
32;
33  compile_opt idl2, strictarrsubs
34;
35
36   widget_control, event.id, get_uvalue=uval
37   widget_control, event.top, get_uvalue=top_uvalue
38;
39   smallin = extractatt(top_uvalue, 'smallin')
40   numdessinin = smallin[2]-1
41   smallout = extractatt(top_uvalue, 'smallout')
42;
43   if uval.name EQ 'undo' then begin
44      return,{ID:event.handler, TOP:event.top, HANDLER:0L}
45   ENDIF ELSE BEGIN
46;
47@common
48; If we do not change the number of columns, we send
49      if uval.name EQ 'column' then $
50       if event.index+1 EQ smallin[0] THEN $
51       return,{ID:event.handler, TOP:event.top, HANDLER:0L}
52; If we do not change the number of lines, we send
53      if uval.name EQ 'row' then $
54       if event.index+1 EQ smallin[1] THEN $
55       return,{ID:event.handler, TOP:event.top, HANDLER:0L}
56;
57; We erase the page
58;      graphid = widget_info(event.top,find_by_uname = 'graph')
59      graphid = extractatt(top_uvalue, 'graphid')
60      widget_control,graphid,get_value=win
61      wset, win
62      erase, 255
63      case uval.name of
64         'clear':
65         'column':BEGIN
66            smallin = [event.index+1, smallin[1], 1]
67            smallout = [event.index+1, smallout[1], 1]
68         END
69         'row':BEGIN
70            smallin = [smallin[0], event.index+1, 1]
71            smallout = [smallout[0], event.index+1, 1]
72         END
73      endcase
74      nbredessin = smallin[0]*smallin[1]
75;         
76; We put all back to 0 for postscripts
77      createhistory, event.top, smallin
78;         
79      options = extractatt(top_uvalue, 'options')   
80      flags = extractatt(top_uvalue, 'optionsflag')
81      flag = flags[*, numdessinin]
82;         
83; update and reset all values of the top_uvalue...
84;
85      *top_uvalue[1, findline(top_uvalue, 'smallin')] = smallin
86      *top_uvalue[1, findline(top_uvalue, 'smallout')] = smallout
87;
88      *top_uvalue[1, findline(top_uvalue, 'penvs')] = replicate(!p, nbredessin)
89      *top_uvalue[1, findline(top_uvalue, 'xenvs')] = replicate(!x, nbredessin)
90      *top_uvalue[1, findline(top_uvalue, 'yenvs')] = replicate(!y, nbredessin)
91;
92      *top_uvalue[1, findline(top_uvalue, 'nameprocedures')] = strarr(nbredessin)
93      *top_uvalue[1, findline(top_uvalue, 'types')] = strarr(nbredessin)
94      *top_uvalue[1, findline(top_uvalue, 'varinfo')] = strarr(2, nbredessin)
95      *top_uvalue[1, findline(top_uvalue, 'domaines')] = fltarr(6, nbredessin)
96      *top_uvalue[1, findline(top_uvalue, 'dates')] = lonarr(2, nbredessin)
97      *top_uvalue[1, findline(top_uvalue, 'txtcmd')] = strarr(nbredessin)
98      *top_uvalue[1, findline(top_uvalue, 'optionsflag')] = flag#replicate(1, nbredessin)
99;
100      ptr_free, extractatt(top_uvalue, 'exextra')
101      *top_uvalue[1, findline(top_uvalue, 'exextra')] = ptrarr(nbredessin, /allocate_heap)
102;      *top_uvalue[1, findline(top_uvalue, '')] =
103;
104   ENDELSE
105
106   return,{ID:event.handler, TOP:event.top, HANDLER:0L}
107end
108;*********************************************************************
109;+
110; @file_comments
111;
112;
113; @categories
114; Compound widget
115;
116; @param PARENT {in}{required}
117; The widget ID of the parent widget.
118;
119; @param SMALL
120;
121;
122; @keyword COLUMN
123; Buttons will be arranged in the number of columns
124; specified by this keyword.
125;
126; @keyword ROW
127; Buttons will be arranged in the number of rows
128; specified by this keyword.
129;
130; @keyword UVALUE
131; The user value to be associated with the widget.
132;
133; @keyword UNAME
134; The user name to be associated with the widget.
135;
136; @keyword _EXTRA
137; Used to pass your keywords
138;
139; @keyword UNZOOM
140;
141;
142; @returns
143;
144;
145; @uses
146;
147;
148; @restrictions
149;
150;
151; @examples
152;
153;
154; @history
155;
156;
157; @version
158; $Id$
159;
160; @todo
161; seb: documenter
162;
163;-
164FUNCTION cw_pagelayout, parent, small, UVALUE = uvalue, UNAME = uname, UNZOOM = unzoom, COLUMN = column, ROW = row, _extra = ex
165;------------------------------------------------
166;
167  compile_opt idl2, strictarrsubs
168;
169  row = keyword_set(row)*(1-keyword_set(column)) 
170  if NOT keyword_set(uvalue) then uvalue = ''
171  if NOT keyword_set(uname) then uname = ''
172  base = widget_base(parent $
173                     , EVENT_FUNC = 'cw_pagelayout_event' $
174                     , FUNC_GET_VALUE = 'cw_pagelayout_get_value' $
175                     , PRO_SET_VALUE = 'cw_pagelayout_set_value' $
176                     , UVALUE = uvalue, UNAME = uname, space = 0, _extra = ex)   
177;------------------------------------------------
178  IF n_elements(small) eq 0 then small = [1, 1, 1]
179;
180  dummy = widget_label(base, value = 'cln', yoffset = 3)
181  id = widget_combobox(base, value = strtrim(indgen(9)+1, 1), uvalue = {name:'column'} $
182                       , uname = 'column', xoffset = 20, xsize = 40)
183  widget_control, id, set_combobox_select = small[0]-1
184;
185  IF keyword_set(row) THEN BEGIN
186    xoff = 60
187    yoff = 0
188  ENDIF ELSE BEGIN
189    xoff = 0
190    yoff = 20
191  ENDELSE
192  dummy = widget_label(base, value = 'row', xoffset = xoff, yoffset = yoff+3)
193  id = widget_combobox(base, value = strtrim(indgen(9)+1, 1), uvalue = {name:'row'} $
194                       , uname = 'row', xoffset = xoff+20, xsize = 40, yoffset = yoff)
195  widget_control, id, set_combobox_select = small[1]-1
196;------------------------------------------------
197;------------------------------------------------
198  return, base
199end
200;*********************************************************************
Note: See TracBrowser for help on using the repository browser.