protected virtual void ProcessKey(string key) { CheckDisposed(); string focus = StflApi.stfl_get_focus(f_Handle); OnKeyPressed(new KeyPressedEventArgs(key, focus)); }
protected virtual void Dispose(bool disposing) { if (f_Handle != IntPtr.Zero) { StflApi.stfl_free(f_Handle); } }
void Resize() { var width = Width; if (!AutoLineWrap || width <= 0) { // nothing to do return; } // re-wrap all lines and re-apply offset WrappedLineCount = 0; var offset = Offset; var items = new StringBuilder("{list", Lines.Count + 2); foreach (var line in Lines) { foreach (var wrappedLine in WrapLine(line, width)) { WrappedLineCount++; items.AppendFormat("{{listitem text:{0}}}", StflApi.stfl_quote(wrappedLine)); } } items.Append("}"); Form.Modify(WidgetName, "replace_inner", items.ToString()); Offset = offset; }
public string this[string name] { get { return(StflApi.stfl_get(f_Handle, name)); } set { StflApi.stfl_set(f_Handle, name, value); } }
public Form(string text) { f_Handle = StflApi.stfl_create(text); // initialize ncurses StflApi.stfl_run(f_Handle, -3); //StflApi.raw(); NcursesApi.nocbreak(); }
public string this[string name] { get { CheckDisposed(); return(StflApi.stfl_get(f_Handle, name)); } set { CheckDisposed(); StflApi.stfl_set(f_Handle, name, value); } }
public void AppendWrappedLine(string line) { WrappedLineCount++; Form.Modify( WidgetName, "append", String.Format("{{listitem text:{0}}}", StflApi.stfl_quote(line)) ); }
static void Main() { //IntPtr handle = StflApi.stfl_create("<MainWindow.stfl>"); IntPtr handle = StflApi.stfl_create("vbox[vbox_1]"); StflApi.stfl_modify(handle, "vbox_1", "append", "textview[tv_0]"); StflApi.stfl_modify(handle, "vbox_1", "append", "textview[tv_2]"); StflApi.stfl_modify(handle, "vbox_1", "append", "textview[tv_3]"); StflApi.stfl_run(handle, 0); }
public virtual void Run(int timeout) { CheckDisposed(); string @event = StflApi.stfl_run(f_Handle, timeout); if (timeout == -3) { // HACK: timeout of -3 should never return an event but // sometimes does which causes event duplication return; } ProcessEvent(@event); }
protected virtual void Dispose(bool disposing) { var disposed = Disposed; if (disposed) { return; } if (f_Handle != IntPtr.Zero) { StflApi.stfl_free(f_Handle); } }
public Form(Assembly assembly, string resourceName) { if (assembly == null) { assembly = Assembly.GetCallingAssembly(); } using (Stream stream = assembly.GetManifestResourceStream(resourceName)) using (StreamReader reader = new StreamReader(stream)) { if (stream == null) { throw new ArgumentException(resourceName + " could not be found in assembly", "resourceName"); } string text = reader.ReadToEnd(); if (String.IsNullOrEmpty(text)) { throw new ArgumentException(resourceName + " in assembly is missing or empty.", "resourceName"); } f_Handle = StflApi.stfl_create(text); } }
void Resize() { var width = Width; if (!AutoLineWrap || width <= 0) { // nothing to do return; } var estimatedLines = Math.Max(WrappedLineCount, Lines.Count); // see items.AppendFormat() below var lineStyleOverhead = 18; var listStyleOverhead = 6; var estimatedLength = listStyleOverhead + (estimatedLines * (width + lineStyleOverhead)); estimatedLength = (int)(estimatedLength * 1.2); // re-wrap all lines and re-apply offset WrappedLineCount = 0; var offset = Offset; var items = new StringBuilder("{list", estimatedLength); foreach (var line in Lines) { foreach (var wrappedLine in WrapLine(line, width)) { WrappedLineCount++; items.AppendFormat("{{listitem text:{0}}}", StflApi.stfl_quote(wrappedLine)); } } items.Append("}"); Form.Modify(WidgetName, "replace_inner", items.ToString()); Offset = offset; }
public string Dump(string name, string prefix, int focus) { CheckDisposed(); return(StflApi.stfl_dump(f_Handle, name, prefix, focus)); }
public void Reset() { CheckDisposed(); Dispose(); StflApi.stfl_reset(); }
public string Dump(string name, string prefix, int focus) { return(StflApi.stfl_dump(f_Handle, name, prefix, focus)); }
public void Modify(string name, string mode, string text) { StflApi.stfl_modify(f_Handle, name, mode, text); }
public virtual void Run(int timeout) { string @event = StflApi.stfl_run(f_Handle, timeout); ProcessEvent(@event); }
public void Modify(string name, string mode, string text) { CheckDisposed(); StflApi.stfl_modify(f_Handle, name, mode, text); }