Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 <cstring>
37#include <cstdlib>
38#include <cstdarg>
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#include "snprintf.h"
47
48////////////////////////////////////////////////////////////////////////////////
49/// Unmap any input control that is currently mapped.
50
52{
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
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:
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())
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())
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: {
577 if (!(f = fFormStart)) return;
578 input->fPForm = fFormStart;
579 if (!f->fPFirst)
580 f->fPFirst = p;
581 if (fFormElemLast)
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
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
long Longptr_t
Definition RtypesCore.h:82
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
@ kButtonDown
Definition TGButton.h:54
#define NeedToEscape(C)
static char gNeedEscape[]
static int InputType(TGHtmlElement *p)
Return an appropriate type value for the given <INPUT> markup.
@ Html_FORM
@ Html_EndTEXTAREA
@ Html_TEXTAREA
@ Html_EMBED
@ Html_EndSELECT
@ Html_OPTION
@ Html_APPLET
@ Html_EndFORM
@ Html_Space
@ Html_SELECT
@ Html_Text
@ Html_IFRAME
@ Html_EndOPTION
@ Html_INPUT
#define INPUT_TYPE_Radio
Definition TGHtml.h:619
#define INPUT_TYPE_Button
Definition TGHtml.h:626
#define HTML_Visible
Definition TGHtml.h:275
#define INPUT_TYPE_Image
Definition TGHtml.h:617
#define INPUT_TYPE_Applet
Definition TGHtml.h:625
#define STY_Invisible
Definition TGHtml.h:240
#define CANT_HAPPEN
Definition TGHtml.h:60
#define INPUT_TYPE_Reset
Definition TGHtml.h:620
#define INPUT_TYPE_Submit
Definition TGHtml.h:622
#define HTML_NewLine
Definition TGHtml.h:276
#define INPUT_TYPE_Unknown
Definition TGHtml.h:613
#define INPUT_TYPE_Text
Definition TGHtml.h:623
#define INPUT_TYPE_Hidden
Definition TGHtml.h:616
#define INPUT_TYPE_Password
Definition TGHtml.h:618
#define INPUT_TYPE_TextArea
Definition TGHtml.h:624
#define INPUT_TYPE_Checkbox
Definition TGHtml.h:614
#define INPUT_TYPE_Select
Definition TGHtml.h:621
#define INPUT_TYPE_File
Definition TGHtml.h:615
@ kLHintsTop
Definition TGLayout.h:27
@ kLHintsExpandX
Definition TGLayout.h:30
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void input
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t sel
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
Option_t Option_t width
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
char name[80]
Definition TGX11.cxx:110
float * q
#define snprintf
Definition civetweb.c:1540
Selects different options.
Definition TGButton.h:264
A combobox (also known as a drop down listbox) allows the selection of one item out of a list of item...
Definition TGComboBox.h:47
virtual TGListBox * GetListBox() const
Definition TGComboBox.h:110
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...
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
Definition TGFrame.cxx:1164
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Definition TGFrame.h:80
virtual void ChangeOptions(UInt_t options)
Change frame options. Options is an OR of the EFrameTypes.
Definition TGFrame.cxx:321
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
Definition TGFrame.cxx:605
virtual UInt_t GetDefaultWidth() const
Definition TGFrame.h:190
virtual UInt_t GetDefaultHeight() const
Definition TGFrame.h:191
void SetBackgroundColor(Pixel_t back) override
Set background color (override from TGWindow base class).
Definition TGFrame.cxx:312
virtual UInt_t GetOptions() const
Definition TGFrame.h:197
UInt_t GetHeight() const
Definition TGFrame.h:225
void MapSubwindows() override
map sub windows
Definition TGFrame.h:200
virtual void Layout()
Definition TGFrame.h:199
UInt_t GetWidth() const
Definition TGFrame.h:224
TGHotString is a string with a "hot" character underlined.
Definition TGString.h:42
Html_u8_t fFlags
Definition TGHtml.h:266
Html_u8_t fType
Definition TGHtml.h:265
SHtmlStyle_t fStyle
Definition TGHtml.h:264
Html_16_t fCount
Definition TGHtml.h:267
TGHtmlElement * fPNext
Definition TGHtml.h:262
TGHtmlElement * fPFirst
Definition TGHtml.h:642
void Empty()
Mark this element as being empty.
Html_u16_t fW
Definition TGHtml.h:598
Html_u8_t fItype
Definition TGHtml.h:603
Html_u8_t fSized
Definition TGHtml.h:604
Html_u16_t fH
Definition TGHtml.h:598
TGFrame * fFrame
Definition TGHtml.h:591
TGHtml * fHtml
Definition TGHtml.h:592
TGHtmlElement * fPEnd
Definition TGHtml.h:593
Html_u16_t fCnt
Definition TGHtml.h:605
Html_u16_t fSubId
Definition TGHtml.h:595
TGHtmlInput * fINext
Definition TGHtml.h:590
virtual ~TGHtmlLBEntry()
const char * GetValue() const
TGString * fVal
TGHtmlLBEntry(const TGWindow *p, TGString *s, TGString *val, int ID)
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:1152
int fInputIdx
Definition TGHtml.h:1151
int fNForm
Definition TGHtml.h:1148
ColorStruct_t * fApColor[32]
Definition TGHtml.h:1232
int fExiting
Definition TGHtml.h:1288
TGHtmlInput * fFormElemLast
Definition TGHtml.h:1207
void EncodeText(TGString *str, const char *z)
Append to the given TString an encoded version of the given text.
virtual Bool_t ProcessMessage(Longptr_t, Longptr_t, Longptr_t)
Process messages (GUI events) in the html widget.
char * fZText
Definition TGHtml.h:1176
int fNInput
Definition TGHtml.h:1147
void DeleteControls()
Delete all input controls.
TGHtmlInput * fFirstInput
Definition TGHtml.h:1145
void AppendText(TGString *str, TGHtmlElement *pFirst, TGHtmlElement *pEnd)
Append all text and space tokens between pStart and pEnd to the given TString.
void UnmapControls()
Unmap any input control that is currently mapped.
int fFormPadding
Definition TGHtml.h:1248
void AddSelectOptions(TGListBox *lb, TGHtmlElement *p, TGHtmlElement *pEnd)
The "p" argument points to a <select>.
int FormCount(TGHtmlInput *p, int radio)
Return the number of elments of type p in a form.
void SizeAndLink(TGFrame *frame, TGHtmlInput *pElem)
'frame' is the child widget that is used to implement an input element.
int ControlSize(TGHtmlInput *p)
This routine implements the Sizer() function for <INPUT>, <SELECT> and <TEXTAREA> markup.
int MapControls()
Map any control that should be visible according to the current scroll position.
virtual TGFrame * ProcessApplet(TGHtmlInput *)
Definition TGHtml.h:942
TGHtmlForm * fFormStart
Definition TGHtml.h:1205
void AddFormInfo(TGHtmlElement *p)
Add the DOM control information for form elements.
TGHtmlInput * fLastInput
Definition TGHtml.h:1146
Basic listbox entries.
Definition TGListBox.h:24
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
A listbox is a box, possibly with scrollbar, containing entries.
Definition TGListBox.h:221
virtual TGLBEntry * Select(Int_t id, Bool_t sel=kTRUE)
Definition TGListBox.h:284
virtual Int_t GetNumberOfEntries() const
Definition TGListBox.h:263
virtual TGLBEntry * GetSelectedEntry() const
Definition TGListBox.h:288
void Resize(UInt_t w, UInt_t h) override
Resize the listbox widget.
virtual void AddEntry(TGString *s, Int_t id)
Add entry with specified string and id to listbox.
void Layout() override
Layout the listbox components.
virtual TGLBEntry * GetEntry(Int_t id) const
Returns list box entry with specified id.
UInt_t GetItemVsize() const
Definition TGListBox.h:290
virtual void SetMultipleSelections(Bool_t multi=kTRUE)
Definition TGListBox.h:259
virtual TGFrame * GetContainer() const
Definition TGListBox.h:267
Long_t fX
x position
Definition TGDimension.h:56
Long_t fY
y position
Definition TGDimension.h:57
Selects different options.
Definition TGButton.h:321
TGString wraps a TString and adds some graphics routines like drawing, size of string on screen depen...
Definition TGString.h:20
const char * GetString() const
Definition TGString.h:30
A text buffer is used in several widgets, like TGTextEntry, TGFileDialog, etc.
Yield an action as soon as it is clicked.
Definition TGButton.h:142
A TGTextEdit is a specialization of TGTextView.
Definition TGTextEdit.h:22
A TGTextEntry is a one line text input widget.
Definition TGTextEntry.h:24
Text string listbox entries.
Definition TGListBox.h:48
const TGString * GetText() const
Definition TGListBox.h:79
Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2) override
Process scrollbar messages.
Definition TGView.cxx:316
TGLongPosition fVisible
position of visible region
Definition TGView.h:32
TGViewFrame * fCanvas
frame containing the text
Definition TGView.h:42
virtual void Associate(const TGWindow *w)
Definition TGWidget.h:72
ROOT GUI Window base class.
Definition TGWindow.h:23
TString & Append(const char *cs)
Definition TString.h:576
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Definition TMathBase.h:250
ULong_t fPixel
color pixel value (index in color table)
Definition GuiTypes.h:311
unsigned int fBgcolor
Definition TGHtml.h:149
unsigned int fFlags
Definition TGHtml.h:151