Logo ROOT  
Reference Guide
TGHtmlForm.cxx
Go to the documentation of this file.
1// $Id: TGHtmlForm.cxx,v 1.3 2007/05/18 16:00:28 brun Exp $
2// Author: Valeriy Onuchin 03/05/2007
3
4/*************************************************************************
5 * Copyright (C) 1995-2001, Rene Brun, Fons Rademakers and Reiner Rohlfs *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12/**************************************************************************
13
14 HTML widget for xclass. Based on tkhtml 1.28
15 Copyright (C) 1997-2000 D. Richard Hipp <drh@acm.org>
16 Copyright (C) 2002-2003 Hector Peraza.
17
18 This library is free software; you can redistribute it and/or
19 modify it under the terms of the GNU Library General Public
20 License as published by the Free Software Foundation; either
21 version 2 of the License, or (at your option) any later version.
22
23 This library is distributed in the hope that it will be useful,
24 but WITHOUT ANY WARRANTY; without even the implied warranty of
25 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26 Library General Public License for more details.
27
28 You should have received a copy of the GNU Library General Public
29 License along with this library; if not, write to the Free
30 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
31
32**************************************************************************/
33
34// Routines used for processing HTML makeup for forms.
35
36#include <string.h>
37#include <stdlib.h>
38#include <stdarg.h>
39
40#include "TGHtml.h"
41#include "TGButton.h"
42#include "TGTextEntry.h"
43#include "TGListBox.h"
44#include "TGTextEdit.h"
45#include "TGComboBox.h"
46
47
48////////////////////////////////////////////////////////////////////////////////
49/// Unmap any input control that is currently mapped.
50
52{
53 TGHtmlInput *p;
54
55 for (p = fFirstInput; p; p = p->fINext) {
56 if (p->fFrame != 0 /*&& p->fFrame->IsMapped()*/) {
57 p->fFrame->UnmapWindow();
58 }
59 }
60}
61
62////////////////////////////////////////////////////////////////////////////////
63/// Map any control that should be visible according to the
64/// current scroll position. At the same time, if any controls that
65/// should not be visible are mapped, unmap them. After this routine
66/// finishes, all <INPUT> controls should be in their proper places
67/// regardless of where they might have been before.
68///
69/// Return the number of controls that are currently visible.
70
72{
73 TGHtmlInput *p; // For looping over all controls
74 int x, y, w, h; // Part of the virtual canvas that is visible
75 int cnt = 0; // Number of visible controls
76
77 x = fVisible.fX;
78 y = fVisible.fY;
79 w = fCanvas->GetWidth();
80 h = fCanvas->GetHeight();
81 for (p = fFirstInput; p; p = p->fINext) {
82 if (p->fFrame == 0) continue;
83 if (p->fY < y + h && p->fY + p->fH > y &&
84 p->fX < x + w && p->fX + p->fW > x) {
85 // The control should be visible. Make is so if it isn't already
86 p->fFrame->MoveResize(p->fX - x, p->fY + fFormPadding/2 - y,
87 p->fW, p->fH - fFormPadding);
88 /*if (!p->fFrame->IsMapped())*/ p->fFrame->MapWindow();
89 ++cnt;
90 } else {
91 // This control should not be visible. Unmap it.
92 /*if (p->fFrame->IsMapped())*/ p->fFrame->UnmapWindow();
93 }
94 }
95
96 return cnt;
97}
98
99////////////////////////////////////////////////////////////////////////////////
100/// Delete all input controls. This happens when the TGHtml widget
101/// is cleared.
102
104{
105 TGHtmlInput *p; // For looping over all controls
106
107 p = fFirstInput;
108 fFirstInput = 0;
109 fLastInput = 0;
110 fNInput = 0;
111
112 if (p == 0) return;
113
114 for (; p; p = p->fINext) {
115 if (p->fPForm && ((TGHtmlForm *)p->fPForm)->fHasctl) {
116 ((TGHtmlForm *)p->fPForm)->fHasctl = 0;
117 }
118 if (p->fFrame) {
119 if (!fExiting) p->fFrame->DestroyWindow();
120 delete p->fFrame;
121 p->fFrame = 0;
122 }
123 p->fSized = 0;
124 }
125}
126
127////////////////////////////////////////////////////////////////////////////////
128/// Return an appropriate type value for the given <INPUT> markup.
129
131{
133 const char *z;
134 int i;
135 static struct {
136 const char *zName;
137 int type;
138 } types[] = {
139 { "checkbox", INPUT_TYPE_Checkbox },
140 { "file", INPUT_TYPE_File },
141 { "hidden", INPUT_TYPE_Hidden },
142 { "image", INPUT_TYPE_Image },
143 { "password", INPUT_TYPE_Password },
144 { "radio", INPUT_TYPE_Radio },
145 { "reset", INPUT_TYPE_Reset },
146 { "submit", INPUT_TYPE_Submit },
147 { "text", INPUT_TYPE_Text },
148 { "name", INPUT_TYPE_Text },
149 { "textfield", INPUT_TYPE_Text },
150 { "button", INPUT_TYPE_Button },
151 { "name", INPUT_TYPE_Text },
152 };
153
154 switch (p->fType) {
155 case Html_INPUT:
156 z = p->MarkupArg("type", "text");
157 if (z == 0) break;
158 for (i = 0; i < int(sizeof(types) / sizeof(types[0])); i++) {
159 if (strcasecmp(types[i].zName, z) == 0) {
160 type = types[i].type;
161 break;
162 }
163 }
164 break;
165
166 case Html_SELECT:
168 break;
169
170 case Html_TEXTAREA:
172 break;
173
174 case Html_APPLET:
175 case Html_IFRAME:
176 case Html_EMBED:
178 break;
179
180 default:
182 break;
183 }
184 return type;
185}
186
187////////////////////////////////////////////////////////////////////////////////
188/// 'frame' is the child widget that is used to implement an input
189/// element. Query the widget for its size and put that information
190/// in the pElem structure that represents the input.
191
193{
194
195 pElem->fFrame = frame;
196 if (pElem->fFrame == 0) {
197 pElem->Empty();
198 } else if (pElem->fItype == INPUT_TYPE_Hidden) {
199 pElem->fW = 0;
200 pElem->fH = 0;
201 pElem->fFlags &= ~HTML_Visible;
202 pElem->fStyle.fFlags |= STY_Invisible;
203 } else {
204 pElem->fW = frame->GetDefaultWidth();
205 pElem->fH = frame->GetDefaultHeight() + fFormPadding;
206 pElem->fFlags |= HTML_Visible;
207 pElem->fHtml = this;
208 }
209 pElem->fINext = 0;
210 if (fFirstInput == 0) {
211 fFirstInput = pElem;
212 } else {
213 fLastInput->fINext = pElem;
214 }
215 fLastInput = pElem;
216 pElem->fSized = 1;
217
218#if 0
219 if (pElem->fFrame) {
221 pElem->fFrame->SetBackgroundColor(_defaultFrameBackground);
222 }
223#else
224 if (pElem->fFrame) {
225 int bg = pElem->fStyle.fBgcolor;
226 //int fg = pElem->fStyle.color;
227 ColorStruct_t *cbg = fApColor[bg];
228 //ColorStruct_t *cfg = fApColor[fg];
230 pElem->fFrame->SetBackgroundColor(cbg->fPixel);
231 }
232#endif
233
234 if (pElem->fFrame) {
235 // the following is needed by some embedded widgets like
236 // TGListBox and TGTextEdit
237 pElem->fFrame->MapSubwindows();
238 pElem->fFrame->Layout();
239 }
240}
241
242////////////////////////////////////////////////////////////////////////////////
243/// Append all text and space tokens between pStart and pEnd to
244/// the given TString. [ TGTextEdit ]
245
247 TGHtmlElement *pEnd)
248{
249 while (pFirs && pFirs != pEnd) {
250 switch (pFirs->fType) {
251 case Html_Text:
252 str->Append(((TGHtmlTextElement *)pFirs)->fZText);
253 break;
254
255 case Html_Space:
256 if (pFirs->fFlags & HTML_NewLine) {
257 str->Append("\n");
258 } else {
259 int cnt;
260 static char zSpaces[] = " ";
261 cnt = pFirs->fCount;
262 while (cnt > (int)sizeof(zSpaces) - 1) {
263 str->Append(zSpaces, sizeof(zSpaces) - 1);
264 cnt -= sizeof(zSpaces) - 1;
265 }
266 if (cnt > 0) {
267 str->Append(zSpaces, cnt);
268 }
269 }
270 break;
271
272 default:
273 break;
274 }
275 pFirs = pFirs->fPNext;
276 }
277}
278
279
280class TGHtmlLBEntry : public TGTextLBEntry {
281public:
282 TGHtmlLBEntry(const TGWindow *p, TGString *s, TGString *val, int ID) :
283 TGTextLBEntry(p, s, ID) { fVal = val; }
284 virtual ~TGHtmlLBEntry() { if (fVal) delete fVal; }
285
286 const char *GetValue() const { return fVal ? fVal->GetString() : 0; }
287
288protected:
289 TGString *fVal;
290};
291
292
293////////////////////////////////////////////////////////////////////////////////
294/// The "p" argument points to a <select>. This routine scans all
295/// subsequent elements (up to the next </select>) looking for
296/// <option> tags. For each option tag, it appends the corresponding
297/// entry to the "lb" listbox element.
298///
299/// lb -- An TGListBox object
300/// p -- The <SELECT> markup
301/// pEnd -- The </SELECT> markup
302
304 TGHtmlElement *pEnd)
305{
306 int id = 0;
307
308 while (p && p != pEnd && p->fType != Html_EndSELECT) {
309 if (p->fType == Html_OPTION) {
310 TGString *str;
311 int selected = -1;
312
313 const char *zValue = p->MarkupArg("value", "");
314 const char *sel = p->MarkupArg("selected", "");
315 if (sel && !strcmp(sel, "selected"))
316 selected = id;
317
318 p = p->fPNext;
319
320 str = new TGString("");
321 while (p && p != pEnd &&
322 p->fType != Html_EndOPTION &&
323 p->fType != Html_OPTION &&
324 p->fType != Html_EndSELECT) {
325 if (p->fType == Html_Text) {
326 str->Append(((TGHtmlTextElement *)p)->fZText);
327 } else if (p->fType == Html_Space) {
328 str->Append(" ");
329 }
330 p = p->fPNext;
331 }
332 lb->AddEntry(new TGHtmlLBEntry(lb->GetContainer(), str,
333 new TGString(zValue), id),
335 //if (p->MarkupArg("selected", 0) != 0) lb->Select(id);
336 if (selected >= 0)
337 lb->Select(selected);
338 ++id;
339 } else {
340 p = p->fPNext;
341 }
342 }
343}
344
345////////////////////////////////////////////////////////////////////////////////
346/// This routine implements the Sizer() function for <INPUT>,
347/// <SELECT> and <TEXTAREA> markup.
348///
349/// A side effect of sizing these markups is that widgets are
350/// created to represent the corresponding input controls.
351///
352/// The function normally returns 0. But if it is dealing with
353/// a <SELECT> or <TEXTAREA> that is incomplete, 1 is returned.
354/// In that case, the sizer will be called again at some point in
355/// the future when more information is available.
356
358{
359 int incomplete = 0; // kTRUE if data is incomplete
360
361 if (pElem->fSized) return 0;
362
363 pElem->fItype = InputType(pElem); //// pElem->InputType();
364 //// or done in the constructor!
365
366// if (pElem->fPForm == 0) {
367// pElem->Empty();
368// return incomplete;
369// }
370
371 switch (pElem->fItype) {
372 case INPUT_TYPE_File:
374 case INPUT_TYPE_Image:
375 pElem->Empty();
376 SizeAndLink(0, pElem);
377 break;
378
379 case INPUT_TYPE_Checkbox: {
380 pElem->fCnt = ++fNInput;
381 TGCheckButton *f = new TGCheckButton(fCanvas, "", pElem->fCnt);
382 if (pElem->MarkupArg("checked", 0))
383 ((TGCheckButton *)f)->SetState(kButtonDown);
384 f->Associate(this);
385 f->Resize(f->GetDefaultSize());
386 SizeAndLink(f, pElem);
387 break;
388 }
389
390 case INPUT_TYPE_Radio: {
391 pElem->fCnt = ++fNInput;
392 TGRadioButton *f = new TGRadioButton(fCanvas, "", pElem->fCnt);
393 if (pElem->MarkupArg("checked", 0))
394 ((TGRadioButton *)f)->SetState(kButtonDown);
395 f->Associate(this);
396 f->Resize(f->GetDefaultSize());
397 SizeAndLink(f, pElem);
398 break;
399 }
400
401 case INPUT_TYPE_Reset: {
402 pElem->fCnt = ++fNInput;
403 const char *z = pElem->MarkupArg("value", 0);
404 if (!z) z = "Reset";
405 TGTextButton *f = new TGTextButton(fCanvas, new TGHotString(z), pElem->fCnt);
406 f->RequestFocus();
407 f->Associate(this);
408 f->Resize(f->GetDefaultSize());
409 SizeAndLink(f, pElem);
410 break;
411 }
412
414 case INPUT_TYPE_Submit: {
415 pElem->fCnt = ++fNInput;
416 const char *z = pElem->MarkupArg("value", 0);
417 if (!z) z = "Submit";
418 TGTextButton *f = new TGTextButton(fCanvas, new TGHotString(z), pElem->fCnt);
419 f->RequestFocus();
420 f->Associate(this);
421 // TODO: bg color!
422 f->Resize(f->GetDefaultSize());
423 SizeAndLink(f, pElem);
424 break;
425 }
426
427 case INPUT_TYPE_Text: {
428 pElem->fCnt = ++fNInput;
429 const char *z = pElem->MarkupArg("maxlength", 0);
430 int maxlen = z ? atoi(z) : 256;
431 if (maxlen < 2) maxlen = 2;
432 z = pElem->MarkupArg("size", 0);
433 int size = z ? atoi(z) * 5 : 150;
434 TGTextEntry *f = new TGTextEntry(fCanvas, new TGTextBuffer(maxlen),
435 pElem->fCnt);
436 z = pElem->MarkupArg("value", 0);
437 if (z) f->AppendText(z);
438 f->Resize(size, f->GetDefaultHeight());
439 SizeAndLink(f, pElem);
440 break;
441 }
442
443 case INPUT_TYPE_Password: {
444 pElem->fCnt = ++fNInput;
445 const char *z = pElem->MarkupArg("maxlength", 0);
446 int maxlen = z ? atoi(z) : 256;
447 if (maxlen < 2) maxlen = 2;
448 z = pElem->MarkupArg("size", 0);
449 int size = z ? atoi(z) * 5 : 150;
450 TGTextEntry *f = new TGTextEntry(fCanvas, new TGTextBuffer(maxlen),
451 pElem->fCnt);
452 f->SetEchoMode(TGTextEntry::kPassword);
453 z = pElem->MarkupArg("value", 0);
454 if (z) f->AppendText(z);
455 f->Resize(size, f->GetDefaultHeight());
456 SizeAndLink(f, pElem);
457 break;
458 }
459
460 case INPUT_TYPE_Select: { // listbox or dd-listbox?
461 pElem->fCnt = ++fNInput;
462 const char *z = pElem->MarkupArg("size", 0);
463 int size = z ? atoi(z) : 1;
464 UInt_t width = 0, height = 0;
465 if (size == 1) {
466 TGComboBox *cb = new TGComboBox(fCanvas, pElem->fCnt);
467 TGListBox *lb = cb->GetListBox();
468 AddSelectOptions(lb, pElem, pElem->fPEnd);
470 if (e) lb->Select(e->EntryId(), kFALSE);
471 lb->MapSubwindows();
472 lb->Layout();
473 for (int i=0;i<lb->GetNumberOfEntries();++i) {
474 TGHtmlLBEntry *te = (TGHtmlLBEntry *)lb->GetEntry(i);
475 if (te && te->GetText())
476 width = TMath::Max(width, te->GetDefaultWidth());
477 }
478 height = lb->GetItemVsize() ? lb->GetItemVsize()+4 : 22;
479 cb->Resize(width > 0 ? width+30 : 200,
480 height > 22 ? height : 22);
481 if (e) cb->Select(e->EntryId(), kFALSE);
482 SizeAndLink(cb, pElem);
483 } else {
484 TGListBox *lb = new TGListBox(fCanvas, pElem->fCnt);
485 z = pElem->MarkupArg("multiple", 0);
486 if (z) lb->SetMultipleSelections(kTRUE);
487 AddSelectOptions(lb, pElem, pElem->fPEnd);
488 for (int i=0;i<lb->GetNumberOfEntries();++i) {
489 TGHtmlLBEntry *te = (TGHtmlLBEntry *)lb->GetEntry(i);
490 if (te && te->GetText())
491 width = TMath::Max(width, te->GetDefaultWidth());
492 }
493 height = lb->GetItemVsize() ? lb->GetItemVsize() : 22;
494 lb->Resize(width > 0 ? width+30 : 200, height * size);
495 lb->Associate(this);
496 SizeAndLink(lb, pElem);
497 }
498 break;
499 }
500
501 case INPUT_TYPE_TextArea: {
502 pElem->fCnt = ++fNInput;
503 // const char *z = pElem->MarkupArg("rows", 0);
504 //int rows = z ? atoi(z) : 10;
505 // coverity[returned_pointer]
506 // z = pElem->MarkupArg("cols", 0);
507 //int cols = z ? atoi(z) : 10;
508 TGTextEdit *f = new TGTextEdit(fCanvas, 300, 200, pElem->fCnt);
509 TGString str("");
510 AppendText(&str, pElem, pElem->fPEnd);
511 //f->InsertText(&str);
512 SizeAndLink(f, pElem);
513 break;
514 }
515
516 case INPUT_TYPE_Applet: {
517 //int result;
518
519 TGFrame *f = ProcessApplet(pElem);
520 if (!f) {
521 pElem->Empty();
522 break;
523 }
524 pElem->fCnt = ++fNInput;
525 SizeAndLink(f, pElem);
526 break;
527 }
528
529 default: {
531 pElem->fFlags &= ~HTML_Visible;
532 pElem->fStyle.fFlags |= STY_Invisible;
533 pElem->fFrame = 0;
534 break;
535 }
536 }
537 return incomplete;
538}
539
540////////////////////////////////////////////////////////////////////////////////
541/// Return the number of elments of type p in a form.
542
544{
545 TGHtmlElement *q = p;
546
547 switch (p->fType) {
548 case Html_SELECT:
549 return p->fSubId;
550 case Html_TEXTAREA:
551 case Html_INPUT:
552 if (radio && p->fType == INPUT_TYPE_Radio)
553 return p->fSubId;
554 return ((TGHtmlForm *)p->fPForm)->fElements;
555 case Html_OPTION:
556 while ((q = q->fPPrev))
557 if (q->fType == Html_SELECT) return ((TGHtmlInput *)q)->fSubId;
558 }
559 return -1;
560}
561
562////////////////////////////////////////////////////////////////////////////////
563/// Add the DOM control information for form elements.
564
566{
568 TGHtmlForm *f;
569 const char *name, *z;
570 int t;
571
572 switch (p->fType) {
573 case Html_SELECT:
574 case Html_TEXTAREA:
575 case Html_INPUT: {
576 TGHtmlInput *input = (TGHtmlInput *) p;
577 if (!(f = fFormStart)) return;
578 input->fPForm = fFormStart;
579 if (!f->fPFirst)
580 f->fPFirst = p;
581 if (fFormElemLast)
582 fFormElemLast->fINext = input;
583 fFormElemLast = input;
584 input->fInpId = fInputIdx++;
585 t = input->fItype = InputType(input);
586 if (t == INPUT_TYPE_Radio) {
587 if ((name = p->MarkupArg("name", 0))) {
588 for (q = f->fPFirst; q; q = ((TGHtmlInput *)q)->fINext) {
589 if ((z = q->MarkupArg("name", 0)) && !strcmp(z, name)) {
590 input->fSubId = fRadioIdx++;
591 break;
592 }
593 }
594 if (!q) input->fSubId = fRadioIdx = 0;
595 }
596 }
597 break;
598 }
599
600 case Html_FORM:
601 fFormStart = (TGHtmlForm *) p;
602 ((TGHtmlForm *)p)->fFormId = fNForm++;
603 break;
604
605 case Html_EndTEXTAREA:
606 case Html_EndSELECT:
607 case Html_EndFORM:
608 fFormStart = 0;
609 fInputIdx = 0;
610 fRadioIdx = 0;
611 fFormElemLast = 0;
612 break;
613
614 case Html_OPTION:
617 break;
618
619 default:
620 break;
621 }
622}
623
624// The following array determines which characters can be put directly
625// in a query string and which must be escaped.
626
627static char gNeedEscape[] = {
628 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
629 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
630 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0,
631 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
632 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
633 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0,
634 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
635 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1,
636};
637#define NeedToEscape(C) ((C)>0 && (C)<127 && gNeedEscape[(int)(C)])
638
639////////////////////////////////////////////////////////////////////////////////
640/// Append to the given TString an encoded version of the given text.
641
642void TGHtml::EncodeText(TGString *str, const char *z)
643{
644 int i;
645
646 while (*z) {
647 for (i = 0; z[i] && !NeedToEscape(z[i]); ++i) {}
648 if (i > 0) str->Append(z, i);
649 z += i;
650 while (*z && NeedToEscape(*z)) {
651 if (*z == ' ') {
652 str->Append("+", 1);
653 } else if (*z == '\n') {
654 str->Append("%0D%0A", 6);
655 } else if (*z == '\r') {
656 // Ignore it...
657 } else {
658 char zBuf[10];
659 snprintf(zBuf, 10, "%%%02X", 0xff & *z);
660 str->Append(zBuf, 3);
661 }
662 z++;
663 }
664 }
665}
666
667////////////////////////////////////////////////////////////////////////////////
668/// Process messages (GUI events) in the html widget.
669
671{
672/*
673 OWidgetMessage *wmsg = (OWidgetMessage *) msg;
674 TGHtmlInput *p;
675
676 switch (msg->fType) {
677 case MSG_BUTTON:
678 case MSG_RADIOBUTTON:
679 case MSG_CHECKBUTTON:
680 case MSG_LISTBOX:
681 case MSG_DDLISTBOX:
682 for (p = fFirstInput; p; p = p->fINext) {
683 if (p->fCnt == wmsg->id) {
684 switch (p->fItype) {
685 case INPUT_TYPE_Button:
686 case INPUT_TYPE_Submit:
687 if (p->fPForm) {
688 FormAction(p->fPForm, wmsg->id);
689 } else {
690 printf("action, but no form!\n");
691 }
692 break;
693
694 case INPUT_TYPE_Reset: {
695 //ClearForm(p->fPForm);
696 TGHtmlInput *pr;
697 for (pr = fFirstInput; pr; pr = pr->fINext) {
698 if (pr->fPForm == p->fPForm) {
699 switch (pr->fItype) {
700 case INPUT_TYPE_Radio: {
701 TGRadioButton *rb = (TGRadioButton *) pr->fFrame;
702 if (pr->MarkupArg("checked", 0))
703 rb->SetState(kButtonDown);
704 else
705 rb->SetState(kButtonUp);
706 break;
707 }
708
709 case INPUT_TYPE_Checkbox: {
710 TGCheckButton *cb = (TGCheckButton *) pr->fFrame;
711 if (pr->MarkupArg("checked", 0))
712 cb->SetState(kButtonDown);
713 else
714 cb->SetState(kButtonUp);
715 break;
716 }
717
718 case INPUT_TYPE_Text:
719 case INPUT_TYPE_Password: {
720 TGTextEntry *te = (TGTextEntry *) pr->fFrame;
721 te->Clear();
722 const char *z = pr->MarkupArg("value", 0);
723 if (z) te->AddText(0, z);
724 break;
725 }
726
727 case INPUT_TYPE_Select: {
728 break;
729 }
730
731 default:
732 break;
733 }
734 }
735 }
736 break;
737 }
738
739 case INPUT_TYPE_Radio: {
740 TGHtmlInput *pr;
741 for (pr = fFirstInput; pr; pr = pr->fINext) {
742 if ((pr->fPForm == p->fPForm) &&
743 (pr->fItype == INPUT_TYPE_Radio)) {
744 if (pr != p) {
745 if (strcmp(pr->MarkupArg("name", ""),
746 p->MarkupArg("name", "")) == 0)
747 ((TGRadioButton *)pr->fFrame)->SetState(kButtonUp);
748 }
749 }
750 }
751 break;
752 }
753
754 case INPUT_TYPE_Select: {
755 break;
756 }
757
758 default:
759 break;
760 }
761 return kTRUE;
762 }
763 }
764 break;
765
766 default:
767 break;
768 }
769*/
770 return TGView::ProcessMessage(msg, p1, p2);
771}
@ kOwnBackground
Definition: GuiTypes.h:391
#define f(i)
Definition: RSha256.hxx:104
#define h(i)
Definition: RSha256.hxx:106
#define e(i)
Definition: RSha256.hxx:103
const Bool_t kFALSE
Definition: RtypesCore.h:90
long Long_t
Definition: RtypesCore.h:52
const Bool_t kTRUE
Definition: RtypesCore.h:89
include TDocParser_001 C image html pict1_TDocParser_001 png width
Definition: TDocParser.cxx:121
@ kButtonDown
Definition: TGButton.h:54
#define NeedToEscape(C)
Definition: TGHtmlForm.cxx:637
static char gNeedEscape[]
Definition: TGHtmlForm.cxx:627
static int InputType(TGHtmlElement *p)
Return an appropriate type value for the given <INPUT> markup.
Definition: TGHtmlForm.cxx:130
@ Html_FORM
Definition: TGHtmlTokens.h:93
@ Html_EndTEXTAREA
Definition: TGHtmlTokens.h:177
@ Html_TEXTAREA
Definition: TGHtmlTokens.h:176
@ Html_EMBED
Definition: TGHtmlTokens.h:90
@ Html_EndSELECT
Definition: TGHtmlTokens.h:160
@ Html_OPTION
Definition: TGHtmlTokens.h:145
@ Html_APPLET
Definition: TGHtmlTokens.h:50
@ Html_EndFORM
Definition: TGHtmlTokens.h:94
@ Html_Space
Definition: TGHtmlTokens.h:43
@ Html_SELECT
Definition: TGHtmlTokens.h:159
@ Html_Text
Definition: TGHtmlTokens.h:42
@ Html_IFRAME
Definition: TGHtmlTokens.h:116
@ Html_EndOPTION
Definition: TGHtmlTokens.h:146
@ Html_INPUT
Definition: TGHtmlTokens.h:118
#define INPUT_TYPE_Radio
Definition: TGHtml.h:618
#define INPUT_TYPE_Button
Definition: TGHtml.h:625
#define HTML_Visible
Definition: TGHtml.h:274
#define INPUT_TYPE_Image
Definition: TGHtml.h:616
#define INPUT_TYPE_Applet
Definition: TGHtml.h:624
#define STY_Invisible
Definition: TGHtml.h:239
#define CANT_HAPPEN
Definition: TGHtml.h:59
#define INPUT_TYPE_Reset
Definition: TGHtml.h:619
#define INPUT_TYPE_Submit
Definition: TGHtml.h:621
#define HTML_NewLine
Definition: TGHtml.h:275
#define INPUT_TYPE_Unknown
Definition: TGHtml.h:612
#define INPUT_TYPE_Text
Definition: TGHtml.h:622
#define INPUT_TYPE_Hidden
Definition: TGHtml.h:615
#define INPUT_TYPE_Password
Definition: TGHtml.h:617
#define INPUT_TYPE_TextArea
Definition: TGHtml.h:623
#define INPUT_TYPE_Checkbox
Definition: TGHtml.h:613
#define INPUT_TYPE_Select
Definition: TGHtml.h:620
#define INPUT_TYPE_File
Definition: TGHtml.h:614
@ kLHintsTop
Definition: TGLayout.h:34
@ kLHintsExpandX
Definition: TGLayout.h:37
XFontStruct * id
Definition: TGX11.cxx:108
char name[80]
Definition: TGX11.cxx:109
int type
Definition: TGX11.cxx:120
float * q
Definition: THbookFile.cxx:87
#define snprintf
Definition: civetweb.c:1540
virtual TGListBox * GetListBox() const
Definition: TGComboBox.h:130
virtual void Select(Int_t id, Bool_t emit=kTRUE)
Make the selected item visible in the combo box window and emit signals according to the second param...
Definition: TGComboBox.cxx:451
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition: TGFrame.cxx:1148
virtual void ChangeOptions(UInt_t options)
Change frame options. Options is an OR of the EFrameTypes.
Definition: TGFrame.cxx:305
virtual UInt_t GetDefaultWidth() const
Definition: TGFrame.h:215
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:216
virtual void SetBackgroundColor(Pixel_t back)
Set background color (override from TGWindow base class).
Definition: TGFrame.cxx:296
virtual UInt_t GetOptions() const
Definition: TGFrame.h:222
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:589
UInt_t GetHeight() const
Definition: TGFrame.h:250
virtual void Layout()
Definition: TGFrame.h:224
virtual void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0)
Move and/or resize the frame.
Definition: TGFrame.cxx:613
virtual void MapWindow()
map window
Definition: TGFrame.h:229
UInt_t GetWidth() const
Definition: TGFrame.h:249
virtual void MapSubwindows()
map sub windows
Definition: TGFrame.h:225
virtual void UnmapWindow()
unmap window
Definition: TGFrame.h:231
Html_u8_t fFlags
Definition: TGHtml.h:265
Html_u8_t fType
Definition: TGHtml.h:264
SHtmlStyle_t fStyle
Definition: TGHtml.h:263
virtual const char * MarkupArg(const char *, const char *)
Definition: TGHtml.h:254
Html_16_t fCount
Definition: TGHtml.h:266
TGHtmlElement * fPNext
Definition: TGHtml.h:261
unsigned int fHasctl
Definition: TGHtml.h:640
void Empty()
Mark this element as being empty.
Html_u16_t fW
Definition: TGHtml.h:597
Html_u8_t fItype
Definition: TGHtml.h:602
Html_u8_t fSized
Definition: TGHtml.h:603
Html_u16_t fH
Definition: TGHtml.h:597
TGFrame * fFrame
Definition: TGHtml.h:590
Html_u16_t fX
Definition: TGHtml.h:596
TGHtml * fHtml
Definition: TGHtml.h:591
TGHtmlElement * fPEnd
Definition: TGHtml.h:592
Html_u16_t fInpId
Definition: TGHtml.h:593
Html_u16_t fCnt
Definition: TGHtml.h:604
TGHtmlForm * fPForm
Definition: TGHtml.h:588
Html_u16_t fSubId
Definition: TGHtml.h:594
TGHtmlInput * fINext
Definition: TGHtml.h:589
Html_32_t fY
Definition: TGHtml.h:595
virtual const char * MarkupArg(const char *tag, const char *zDefault)
Lookup an argument in the given markup with the name given.
int fRadioIdx
Definition: TGHtml.h:1144
int fInputIdx
Definition: TGHtml.h:1143
int fNForm
Definition: TGHtml.h:1140
int fExiting
Definition: TGHtml.h:1279
TGHtmlInput * fFormElemLast
Definition: TGHtml.h:1198
void EncodeText(TGString *str, const char *z)
Append to the given TString an encoded version of the given text.
Definition: TGHtmlForm.cxx:642
virtual Bool_t ProcessMessage(Long_t, Long_t, Long_t)
Process messages (GUI events) in the html widget.
Definition: TGHtmlForm.cxx:670
char * fZText
Definition: TGHtml.h:1168
int fNInput
Definition: TGHtml.h:1139
void DeleteControls()
Delete all input controls.
Definition: TGHtmlForm.cxx:103
TGHtmlInput * fFirstInput
Definition: TGHtml.h:1137
void AppendText(TGString *str, TGHtmlElement *pFirst, TGHtmlElement *pEnd)
Append all text and space tokens between pStart and pEnd to the given TString.
Definition: TGHtmlForm.cxx:246
void UnmapControls()
Unmap any input control that is currently mapped.
Definition: TGHtmlForm.cxx:51
int fFormPadding
Definition: TGHtml.h:1239
void AddSelectOptions(TGListBox *lb, TGHtmlElement *p, TGHtmlElement *pEnd)
The "p" argument points to a <select>.
Definition: TGHtmlForm.cxx:303
int FormCount(TGHtmlInput *p, int radio)
Return the number of elments of type p in a form.
Definition: TGHtmlForm.cxx:543
void SizeAndLink(TGFrame *frame, TGHtmlInput *pElem)
'frame' is the child widget that is used to implement an input element.
Definition: TGHtmlForm.cxx:192
int ControlSize(TGHtmlInput *p)
This routine implements the Sizer() function for <INPUT>, <SELECT> and <TEXTAREA> markup.
Definition: TGHtmlForm.cxx:357
int MapControls()
Map any control that should be visible according to the current scroll position.
Definition: TGHtmlForm.cxx:71
ColorStruct_t * fApColor[N_COLOR]
Definition: TGHtml.h:1223
virtual TGFrame * ProcessApplet(TGHtmlInput *)
Definition: TGHtml.h:941
TGHtmlForm * fFormStart
Definition: TGHtml.h:1196
void AddFormInfo(TGHtmlElement *p)
Add the DOM control information for form elements.
Definition: TGHtmlForm.cxx:565
TGHtmlInput * fLastInput
Definition: TGHtml.h:1138
virtual void Resize(UInt_t w, UInt_t h)
Resize the listbox widget.
Definition: TGListBox.cxx:1420
virtual TGLBEntry * Select(Int_t id, Bool_t sel=kTRUE)
Definition: TGListBox.h:352
virtual Int_t GetNumberOfEntries() const
Definition: TGListBox.h:331
virtual TGLBEntry * GetSelectedEntry() const
Definition: TGListBox.h:356
virtual void AddEntry(TGString *s, Int_t id)
Add entry with specified string and id to listbox.
Definition: TGListBox.cxx:1212
virtual TGLBEntry * GetEntry(Int_t id) const
Returns list box entry with specified id.
Definition: TGListBox.cxx:1381
UInt_t GetItemVsize() const
Definition: TGListBox.h:358
virtual void SetMultipleSelections(Bool_t multi=kTRUE)
Definition: TGListBox.h:327
virtual TGFrame * GetContainer() const
Definition: TGListBox.h:335
virtual void Layout()
Layout the listbox components.
Definition: TGListBox.cxx:1461
const char * GetString() const
Definition: TGString.h:40
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Process scrollbar messages.
Definition: TGView.cxx:314
TGLongPosition fVisible
Definition: TGView.h:52
TGViewFrame * fCanvas
Definition: TGView.h:62
virtual void Associate(const TGWindow *w)
Definition: TGWidget.h:84
virtual void DestroyWindow()
destroy window
Definition: TGWindow.cxx:182
TString & Append(const char *cs)
Definition: TString.h:559
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
static constexpr double s
Short_t Max(Short_t a, Short_t b)
Definition: TMathBase.h:212
const char * cnt
Definition: TXMLSetup.cxx:74
ULong_t fPixel
Definition: GuiTypes.h:310
unsigned int fBgcolor
Definition: TGHtml.h:148
unsigned int fFlags
Definition: TGHtml.h:150