예제 #1
0
 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)
예제 #2
0
 def __init__(self, doc):
     View.__init__(self, win32ui.CreateRichEditView(doc))
예제 #3
0
#  and doesn't provide any way of creating a real one without using a resource.

if 1:
    #  The following uses a resource included in win32ui.pyd.
    import pywin.mfc.object
    win_dummy_doc_template = pywin.mfc.object.CmdTarget(
        ui.CreateDocTemplate(ui.IDR_PYTHONTYPE))
    ui.GetApp().AddDocTemplate(win_dummy_doc_template)

    def win_get_dummy_doc():
        return win_dummy_doc_template.DoCreateDoc()
else:
    #  The following hack creates something that looks enough
    #  like a CDocument to keep it happy. But it doesn't work with
    #  pywin32 builds later than 212.
    win_dummy_doc = ui.CreateRichEditView().GetDocument()

    def win_get_dummy_doc():
        return win_dummy_doc


class ScrollableView(GScrollableView):

    _line_scroll_amount = default_line_scroll_amount

    def __init__(self, **kwds):
        kwds.setdefault('extent', default_extent)
        doc = win_get_dummy_doc()
        win = ui.CreateView(doc)
        #win.CreateWindow(win_none, 0, win_style, (0, 0, 100, 100))
        win.CreateWindow(win_none, ui.AFX_IDW_PANE_FIRST, win_style,