def __init__(self, scrolling='hv', **kwds): gtk_sw = gtk.ScrolledWindow() gtk_sw.show() gtk_tv = gtk.TextView() gtk_tv.show() gtk_sw.add(gtk_tv) gtk_tb = gtk.TextBuffer() self._gtk_textbuffer = gtk_tb gtk_tv.set_buffer(self._gtk_textbuffer) tag = gtk.TextTag() tabs = pango.TabArray(1, True) tabs.set_tab(0, pango.TAB_LEFT, 28) tag.set_property('tabs', tabs) tag.set_property('tabs-set', True) self._gtk_tag = tag gtk_tb.get_tag_table().add(tag) GTextEditor.__init__(self, _gtk_outer=gtk_sw, _gtk_inner=gtk_tv, _gtk_focus=gtk_tv, **kwds) self.set_hscrolling('h' in scrolling) self.set_vscrolling('v' in scrolling) if 'h' not in scrolling: gtk_tv.set_wrap_mode(gtk.WRAP_WORD) self._gtk_apply_tag()
def __init__(self, scrolling='hv', **kwds): width = 100 height = 100 frame = ((0, 0), (width, height)) ns_outer = NSScrollView.alloc().initWithFrame_(frame) ns_outer.setHasHorizontalScroller_('h' in scrolling) ns_outer.setHasVerticalScroller_('v' in scrolling) if 'h' in scrolling: cwidth = 2000 else: cwidth = ns_outer.contentSize()[0] frame = ((0, 0), (cwidth, height)) ns_inner = PyGUI_NSTextView.alloc().initWithFrame_(frame) ns_inner.pygui_component = self ps = NSMutableParagraphStyle.alloc().init() ps.setDefaultTabInterval_(ps.tabStops()[0].location()) ps.setTabStops_([]) ns_inner.setDefaultParagraphStyle_(ps) ns_inner.setAllowsUndo_(True) ns_outer.setDocumentView_(ns_inner) if 'h' not in scrolling: ns_inner.setAutoresizingMask_(NSViewWidthSizable) if 'font' not in kwds: kwds['font'] = StdFonts.application_font GTextEditor.__init__(self, ns_outer, _ns_inner_view=ns_inner, **kwds)
def __init__(self, scrolling = 'hv', **kwds): width = 100 height = 100 frame = ((0, 0), (width, height)) ns_outer = NSScrollView.alloc().initWithFrame_(frame) ns_outer.setHasHorizontalScroller_('h' in scrolling) ns_outer.setHasVerticalScroller_('v' in scrolling) if 'h' in scrolling: cwidth = 2000 else: cwidth = ns_outer.contentSize()[0] frame = ((0, 0), (cwidth, height)) ns_inner = PyGUI_NSTextView.alloc().initWithFrame_(frame) ns_inner.pygui_component = self ps = NSMutableParagraphStyle.alloc().init() ps.setDefaultTabInterval_(ps.tabStops()[0].location()) ps.setTabStops_([]) ns_inner.setDefaultParagraphStyle_(ps) ns_inner.setAllowsUndo_(True) ns_outer.setDocumentView_(ns_inner) if 'h' not in scrolling: ns_inner.setAutoresizingMask_(NSViewWidthSizable) if 'font' not in kwds: kwds['font'] = StdFonts.application_font GTextEditor.__init__(self, ns_outer, _ns_inner_view = ns_inner, **kwds)
def __init__(self, scrolling = 'hv', **kwds): win_style = ui.AFX_WS_DEFAULT_VIEW #| wc.WS_HSCROLL | wc.WS_VSCROLL win = ui.CreateRichEditView() ctl = win.GetRichEditCtrl() self._win_ctl = ctl if 'h' in scrolling: win.SetWordWrap(0) # Must do before CreateWindow win.CreateWindow(win_none, 1, win_style, (0, 0, 100, 100)) #if 'v' not in scrolling: # Disabled because it doesn't work properly -- auto-scrolling is prevented # but a vertical scroll bar still appears when text goes past bottom of window. #ctl.SetOptions(wc.ECOOP_XOR, wc.ECO_AUTOVSCROLL) # Must do after CreateWindow ctl.SetOptions(wc.ECOOP_XOR, wc.ECO_NOHIDESEL) win.ShowScrollBar(wc.SB_BOTH, False) # We allow automatic scroll bar show/hide -- resistance is futile win.ShowWindow() kwds.setdefault('font', application_font) GTextEditor.__init__(self, _win = win, **kwds)
def __init__(self, scrolling="hv", **kwds): gtk_sw = gtk.ScrolledWindow() gtk_sw.show() gtk_tv = gtk.TextView() gtk_tv.show() gtk_sw.add(gtk_tv) gtk_tb = gtk.TextBuffer() self._gtk_textbuffer = gtk_tb gtk_tv.set_buffer(self._gtk_textbuffer) tag = gtk.TextTag() tabs = pango.TabArray(1, True) tabs.set_tab(0, pango.TAB_LEFT, 28) tag.set_property("tabs", tabs) tag.set_property("tabs-set", True) self._gtk_tag = tag gtk_tb.get_tag_table().add(tag) GTextEditor.__init__(self, _gtk_outer=gtk_sw, _gtk_inner=gtk_tv, _gtk_focus=gtk_tv, **kwds) self.set_hscrolling("h" in scrolling) self.set_vscrolling("v" in scrolling) if "h" not in scrolling: gtk_tv.set_wrap_mode(gtk.WRAP_WORD) self._gtk_apply_tag()
def __init__(self, scrolling = 'hv', **kwds): gtk_sw = Gtk.ScrolledWindow() gtk_sw.show() gtk_tv = Gtk.TextView() gtk_tv.show() gtk_sw.add(gtk_tv) gtk_tb = Gtk.TextBuffer() self._gtk_textbuffer = gtk_tb gtk_tv.set_buffer(self._gtk_textbuffer) tag = Gtk.TextTag() tabs = Pango.TabArray(1, True) tabs.set_tab(0, Pango.TabAlign.LEFT, 28) tag.set_property('tabs', tabs) tag.set_property('tabs-set', True) self._gtk_tag = tag gtk_tb.get_tag_table().add(tag) GTextEditor.__init__(self, _gtk_outer = gtk_sw, _gtk_inner = gtk_tv, _gtk_focus = gtk_tv, **kwds) self.set_hscrolling('h' in scrolling) self.set_vscrolling('v' in scrolling) if 'h' not in scrolling: gtk_tv.set_wrap_mode(Gtk.WrapMode.WORD) self._gtk_apply_tag()
def paste_cmd(self): GTextEditor.paste_cmd(self) self._ns_apply_style()