Mercurial > projects > mde
comparison mde/gui/content/Content.d @ 91:4d5d53e4f881
Shared alignment for dynamic content lists - finally implemented! Lots of smaller changes too.
Some debugging improvements.
When multiple .mtt files are read for merging, files with invalid headers are ignored and no error is thrown so long as at least one file os valid.
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Thu, 16 Oct 2008 17:43:48 +0100 |
parents | b525ff28774b |
children | 9520cc0448e5 |
comparison
equal
deleted
inserted
replaced
90:b525ff28774b | 91:4d5d53e4f881 |
---|---|
32 * These extensions require that a content can notify any dependants of changes. | 32 * These extensions require that a content can notify any dependants of changes. |
33 * | 33 * |
34 * Use as a state switch (one option from an enumeration). E.g. a button/selection box could set a | 34 * Use as a state switch (one option from an enumeration). E.g. a button/selection box could set a |
35 * state, and a tabbed box could show a tab based on this. Or could represent an option. | 35 * state, and a tabbed box could show a tab based on this. Or could represent an option. |
36 */ | 36 */ |
37 //TODO - write a generic IContent displaying widget. Also a generic editable? | |
37 // Don't include dimension/drawing stuff because it's renderer specific and content should not be! | 38 // Don't include dimension/drawing stuff because it's renderer specific and content should not be! |
38 // NOTE: an interface or a class? | 39 // NOTE: an interface or a class? |
39 interface IContent | 40 interface IContent |
40 { | 41 { |
41 /+ NOTE: None of this is really used yet, but was (mostly) intended for clipboard copying. | 42 /+ NOTE: None of this is really used yet, but was (mostly) intended for clipboard copying. |
48 // FIXME: throw or return null on error or unsupported conversion? | 49 // FIXME: throw or return null on error or unsupported conversion? |
49 ContentText toText (); | 50 ContentText toText (); |
50 ContentInt toInt (); /// ditto | 51 ContentInt toInt (); /// ditto |
51 +/ | 52 +/ |
52 | 53 |
53 /** Every Content should be convertible to a string, which, if possible, should be a sensible | 54 |
54 * conversion of its content. */ | 55 |
55 char[] toString (); | 56 /** Generically return strings. |
57 * | |
58 * Every Content should return a string for i == 0; preferably its value. Other values of i | |
59 * can be used to return other strings. For unsupported values of i, null should be returned. | |
60 */ | |
61 char[] toString (uint i); | |
56 } | 62 } |
57 | 63 /+ |
64 /** Extension to interface providing text-specific tools. */ | |
65 interface IContentText : IContent | |
66 { | |
67 char[] text (); /// Get/set the value. | |
68 void text (char[] v); /// ditto | |
69 } | |
70 +/ | |
71 /+ FIXME - use content lists or drop? | |
58 /** Get a content from the list (what list?). */ | 72 /** Get a content from the list (what list?). */ |
59 ContentText getContentText (char[] id) { | 73 ContentText getContentText (char[] id) { |
60 return new ContentText (id); // forget the list for now | 74 return new ContentText (id); // forget the list for now |
61 } | 75 } |
62 | 76 |
63 /** ditto */ | 77 /** ditto */ |
64 ContentInt getContentInt (char[] id) { | 78 ContentInt getContentInt (char[] id) { |
65 return new ContentInt (42); // forget the list for now | 79 return new ContentInt (42); // forget the list for now |
66 } | 80 } |
81 +/ | |
67 | 82 |
83 /+FIXME - currently unused | |
68 /** Text content. */ | 84 /** Text content. */ |
69 /* May end up extending a universal content type. | 85 /* May end up extending a universal content type. |
70 * Services like copy/paste could work on universal content. | 86 * Services like copy/paste could work on universal content. |
71 * | 87 * |
72 * NOTE: Needs to be a reference type really. | 88 * NOTE: Needs to be a reference type really. |
133 } | 149 } |
134 | 150 |
135 protected: | 151 protected: |
136 int int_; | 152 int int_; |
137 } | 153 } |
154 +/ |