comparison mde/gui/WidgetManager.d @ 132:264028f4115a

Cleaned up mde.imde and a couple of widget functions. New mde.menus module to add default menus. The input singleton is now created in mde.input.Input instead of mde.imde.
author Diggory Hardy <diggory.hardy@gmail.com>
date Fri, 23 Jan 2009 14:59:05 +0000
parents 9cff74f68b84
children 9fd705793568
comparison
equal deleted inserted replaced
131:9cff74f68b84 132:264028f4115a
32 import mde.lookup.Options; // miscOpts.L10n callback 32 import mde.lookup.Options; // miscOpts.L10n callback
33 import mde.content.Content; 33 import mde.content.Content;
34 import Items = mde.content.Items; // loadTranslation 34 import Items = mde.content.Items; // loadTranslation
35 debug import mde.content.miscContent; // Debug menu 35 debug import mde.content.miscContent; // Debug menu
36 36
37 import mt = mde.file.mergetag.DataSet;
37 import mde.file.mergetag.Reader; 38 import mde.file.mergetag.Reader;
38 import mde.file.mergetag.Writer; 39 import mde.file.mergetag.Writer;
39 import mde.setup.paths; 40 import mde.setup.paths;
40 41
41 // Widgets to create: 42 // Widgets to create:
78 motionCallbacks = new typeof(motionCallbacks); 79 motionCallbacks = new typeof(motionCallbacks);
79 80
80 debug { 81 debug {
81 auto lWS = new EventContent ("logWidgetSize"); 82 auto lWS = new EventContent ("logWidgetSize");
82 lWS.addCallback (&logWidgetSize); 83 lWS.addCallback (&logWidgetSize);
83 imde.menu.append (lWS); 84 imde.menus.append (new ContentList ("debug", [cast(Content)lWS]));
84 } 85 }
85 } 86 }
86 87
87 /* Load the widgets' data from the file specified to the CTOR. 88 /* Load the widgets' data from the file specified to the CTOR.
88 * 89 *
490 TextLabel = 0x21, 491 TextLabel = 0x21,
491 492
492 // content functions: 0x30 493 // content functions: 0x30
493 editContent = FUNCTION | TAKES_CONTENT | SAFE_RECURSION | 0x30, 494 editContent = FUNCTION | TAKES_CONTENT | SAFE_RECURSION | 0x30,
494 addContent = FUNCTION | 0x31, 495 addContent = FUNCTION | 0x31,
495 flatMenuContent = FUNCTION | TAKES_CONTENT | SAFE_RECURSION | 0x32, 496 popupListContent = FUNCTION | TAKES_CONTENT | 0x33,
496 subMenuContent = FUNCTION | TAKES_CONTENT | 0x33,
497 497
498 // content widgets: 0x40 498 // content widgets: 0x40
499 DisplayContent = TAKES_CONTENT | 0x40, 499 DisplayContent = TAKES_CONTENT | 0x40,
500 BoolContent = TAKES_CONTENT | 0x41, 500 BoolContent = TAKES_CONTENT | 0x41,
501 AStringContent = TAKES_CONTENT | 0x42, 501 AStringContent = TAKES_CONTENT | 0x42,
522 "AStringContent", 522 "AStringContent",
523 "ButtonContent", 523 "ButtonContent",
524 "GridLayout", 524 "GridLayout",
525 "FloatingArea", 525 "FloatingArea",
526 "Switch", 526 "Switch",
527 "subMenuContent", 527 "popupListContent",
528 "ContentList", 528 "ContentList",
529 "editContent", 529 "editContent"];
530 "flatMenuContent"];
531 530
532 /* Generates a binary search algorithm for makeWidget. */ 531 /* Generates a binary search algorithm for makeWidget. */
533 char[] binarySearch (char[] var, char[][] consts) { 532 char[] binarySearch (char[] var, char[][] consts) {
534 if (consts.length > 3) { 533 if (consts.length > 3) {
535 return `if (`~var~` <= WIDGET_TYPE.`~consts[$/2 - 1]~`) {` ~ 534 return `if (`~var~` <= WIDGET_TYPE.`~consts[$/2 - 1]~`) {` ~