X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=dev4%2Fpsychlops%2Fextention%2Fstandard%2Fwidget.cs;h=4fe21e7c4b628fa1b5fd5f9c3d0f5e996db5fd4e;hb=8d02b5d184f6209f65920c2e63bba907e2221f75;hp=bb540ecc46829bc31015b026be280da81b108908;hpb=cb8916a7a5cd929f57b3f9edd99209680db90546;p=psychlops%2Fsilverlight.git diff --git a/dev4/psychlops/extention/standard/widget.cs b/dev4/psychlops/extention/standard/widget.cs index bb540ec..4fe21e7 100644 --- a/dev4/psychlops/extention/standard/widget.cs +++ b/dev4/psychlops/extention/standard/widget.cs @@ -7,14 +7,84 @@ using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Media.Imaging; using System.Windows.Shapes; +using System.Windows.Browser; + namespace Psychlops { + /* + class Widget : public Figure { + public: + class Event { + public: + }; + }; + * */ + namespace Widgets { + /* + struct Theme { + static bool initialized__; + static Image default_button, default_horiz_grad; + enum TYPE_TAG { NORMAL, ALERT }; + public: + Color normal_foreground[2], active_foreground[2]; + Color normal_background[2], active_background[2], over_background[2]; + Stroke normal_stroke[2], active_stroke[2]; + Image button_back, *horiz_grad; + + static Theme current; + static void initialize(); + }; + * */ + + /* + class WidgetRect : Widget + { + protected: + HumanInterfaceDevice::ButtonStateHolder mleft; + bool pushed_; + + public: + //Theme *theme; + //Theme::TYPE_TAG theme_type; + public Rectangle area; + public Letters label; + + public abstract WidgetRect(); + public virtual const Point getDatum() const; + public virtual WidgetRect& setDatum(const Point&); + public virtual WidgetRect& centering(const Point&); + public double getWidth() const; + public double getHeight() const; + public double getLeft() const; + public double getTop() const; + public double getRight() const; + public double getBottom() const; + public WidgetRect& alignLeft(const double lef); + public WidgetRect& alignTop(const double to_); + public WidgetRect& alignRight(const double rig); + public WidgetRect& alignBottom(const double bot); + + public virtual WidgetRect& set(double wid, double hei); + public virtual WidgetRect& set(std::wstring name); + public virtual WidgetRect& set(std::wstring name, double hei); + public virtual WidgetRect& setLabel(std::wstring s); + public virtual WidgetRect& draw(Drawable &target = *Drawable::prime); + public bool pushed(); + public WidgetRect& pushThis(); + }; + */ + /* + public class Slider + { + public Rectangle outer; + } + */ public class Slider { @@ -41,10 +111,81 @@ namespace Psychlops } + public class Browser + { + public class Element + { + HtmlElement elem; + System.Object retval; + + public Element() + { + retval = 0; + } + + public static Element byID(string id_tag) + { + return getElementById(id_tag); + } + public static Element getElementById(string id_tag) + { + Element tmp = new Element(); + Internal.Main.widgetStack.Dispatcher.BeginInvoke(new Connector.VoidString(tmp.getElementById__), id_tag); + return tmp; + } + void getElementById__(string id_tag) + { + elem = HtmlPage.Document.GetElementById(id_tag); + } + + public void setProperty(string name, System.Object value) + { + Internal.Main.widgetStack.Dispatcher.BeginInvoke(new Connector.VoidStringObject(setProperty__), name, value); + } + public void setProperty__(string name, System.Object value) + { + elem.SetProperty(name, value); + } + + + public static implicit operator double(Element i) { return i.getValueAsDouble(); } + public double getValueAsDouble() + { + double v = 0; + getProperty("value"); + try + { + v = double.Parse(retval.ToString()); + } + catch (FormatException e) + { + v = 0; + } + return v; + } + + public static implicit operator string(Element i) { return i.getProperty("value").ToString(); } + public System.Object getProperty(string name) + { + Internal.Main.widgetStack.Dispatcher.BeginInvoke(new Connector.VoidString(getProperty__), name); + return retval; + } + public void getProperty__(string name) + { + retval = elem.GetProperty(name); + } + } + } + internal static class Connector { + internal delegate void VoidString(string s); + internal delegate void VoidStringObject(String s, System.Object o); + + + delegate void StackSlider_(Slider s); internal static void stackSlider(Slider s) {