def OnCreateClient(self, cp, context): # handlers for toolbar buttons self.HookCommand(self.OnPrevious, 401) self.HookCommand(self.OnNext, 402) # Its not necessary for us to hook both of these - the # common controls should fall-back all by themselves. # Indeed, given we hook TTN_NEEDTEXTW, commctrl.TTN_NEEDTEXTA # will not be called. self.HookNotify(self.GetTTText, commctrl.TTN_NEEDTEXT) self.HookNotify(self.GetTTText, commctrl.TTN_NEEDTEXTW) # parent = win32ui.GetMainFrame() parent = self style = win32con.WS_CHILD | win32con.WS_VISIBLE | \ afxres.CBRS_SIZE_DYNAMIC | afxres.CBRS_TOP | afxres.CBRS_TOOLTIPS | afxres.CBRS_FLYBY buttons = (win32ui.ID_APP_ABOUT, win32ui.ID_VIEW_INTERACTIVE) bitmap = win32ui.IDB_BROWSER_HIER tbid = 0xE840 self.toolbar = tb = win32ui.CreateToolBar(parent, style, tbid) tb.LoadBitmap(bitmap) tb.SetButtons(buttons) tb.EnableDocking(afxres.CBRS_ALIGN_ANY) tb.SetWindowText("Test") parent.EnableDocking(afxres.CBRS_ALIGN_ANY) parent.DockControlBar(tb) parent.LoadBarState("ToolbarTest") window.MDIChildWnd.OnCreateClient(self, cp, context) return 1
def OnCreate(self, createStruct): self.closing = 0 if app.MainFrame.OnCreate(self, createStruct) == -1: return -1 style = win32con.WS_CHILD | afxres.CBRS_SIZE_DYNAMIC | afxres.CBRS_TOP | afxres.CBRS_TOOLTIPS | afxres.CBRS_FLYBY self.EnableDocking(afxres.CBRS_ALIGN_ANY) tb = win32ui.CreateToolBar(self, style | win32con.WS_VISIBLE) tb.ModifyStyle(0, commctrl.TBSTYLE_FLAT) tb.LoadToolBar(win32ui.IDR_MAINFRAME) tb.EnableDocking(afxres.CBRS_ALIGN_ANY) tb.SetWindowText("Standard") self.DockControlBar(tb) # Any other packages which use toolbars from pywin.debugger.debugger import PrepareControlBars PrepareControlBars(self) # Note "interact" also uses dockable windows, but they already happen # And a "Tools" menu on the main frame. menu = self.GetMenu() from . import toolmenu toolmenu.SetToolsMenu(menu, 2) # And fix the "Help" menu on the main frame from pywin.framework import help help.SetHelpMenuOtherHelp(menu)
def PrepareControlBars(frame): style = win32con.WS_CHILD | afxres.CBRS_SIZE_DYNAMIC | afxres.CBRS_TOP | afxres.CBRS_TOOLTIPS | afxres.CBRS_FLYBY tbd = win32ui.CreateToolBar(frame, style, win32ui.ID_VIEW_TOOLBAR_DBG) tbd.ModifyStyle(0, commctrl.TBSTYLE_FLAT) tbd.LoadToolBar(win32ui.IDR_DEBUGGER) tbd.EnableDocking(afxres.CBRS_ALIGN_ANY) tbd.SetWindowText("Debugger") frame.DockControlBar(tbd) # and the other windows. for id, klass, float in DebuggerDialogInfos: try: frame.GetControlBar(id) exists = 1 except win32ui.error: exists = 0 if exists: continue bar = pywin.docking.DockingBar.DockingBar() style = win32con.WS_CHILD | afxres.CBRS_LEFT # don't create visible. bar.CreateWindow(frame, CreateDebuggerDialog, klass.title, id, style, childCreatorArgs=(klass, )) bar.SetBarStyle(bar.GetBarStyle() | afxres.CBRS_TOOLTIPS | afxres.CBRS_FLYBY | afxres.CBRS_SIZE_DYNAMIC) bar.EnableDocking(afxres.CBRS_ALIGN_ANY) if float is None: frame.DockControlBar(bar) else: frame.FloatControlBar(bar, float, afxres.CBRS_ALIGN_ANY)
def __init__(self, parent, name, barid, resid, enabledrag): CBRS_GRIPPER = 0x00400000 # Missing from afxres.py style = (win32con.WS_CHILD | win32con.WS_VISIBLE | afxres.CBRS_TOP | afxres.CBRS_TOOLTIPS | afxres.CBRS_FLYBY | afxres.CBRS_SIZE_DYNAMIC | CBRS_GRIPPER) wndToolBar = win32ui.CreateToolBar(parent, style, barid) wndToolBar.LoadToolBar(resid) wndToolBar.EnableDocking(afxres.CBRS_ALIGN_ANY) wndToolBar.SetWindowText(name) wndToolBar.ModifyStyle(0, commctrl.TBSTYLE_FLAT) window.Wnd.__init__(self, wndToolBar) # enable/disable tools draging self._enableToolDrag = enabledrag if self._enableToolDrag: self.hookMessages() self._dragging = None # # Dropdown combos in this toolbar. Indexed by dropdown name # (found in ToolbarTemplate and in the windowinterface.newdocument # adornments). # Values are comboobjects. # self._toolbarCombos = {} self.name = name self.parent = parent