Exemplo n.º 1
0
 def __init__(self, **kwds):
     style = kwds.get('style', 'standard')
     flags = win_calculate_flags(style, kwds)
     #if style == 'fullscreen':
     #	rect = WinUtils.win_screen_rect
     #else:
     rect = (0, 0, self._default_width, self._default_height)
     frame = ui.CreateFrame()
     frame.CreateWindow(None, "New Window", 0, rect)
     hwnd = frame.GetSafeHwnd()
     #api.SetClassLong(hwnd, wc.GCL_HBRBACKGROUND, win_bg_hbrush)
     api.SetClassLong(hwnd, wc.GCL_HBRBACKGROUND, 0)
     #		print "Window: Setting style:" ###
     #		win_deconstruct_style(flags) ###
     frame.ModifyStyle(-1, flags)
     #		print "Window: Style is now:" ###
     #		win_deconstruct_style(frame.GetStyle()) ###
     frame.ModifyStyleEx(win_no_ex_flags, win_ex_flags)
     if style == 'fullscreen':
         self._win_fullscreen = True
     frame.HookMessage(self._win_wm_initmenu, wc.WM_INITMENU)
     self._win = frame
     if style in win_no_menu_styles:
         self._win_has_menubar = False
     else:
         self._win_set_empty_menubar()
     kwds['closable'] = flags & wc.WS_CAPTION <> 0
     GWindow.__init__(self, _win=frame, **kwds)
Exemplo n.º 2
0
 def __init__(self, **kwds):
     style = kwds.get("style", "standard")
     flags = win_calculate_flags(style, kwds)
     # if style == 'fullscreen':
     # 	rect = WinUtils.win_screen_rect
     # else:
     rect = (0, 0, self._default_width, self._default_height)
     frame = ui.CreateFrame()
     frame.CreateWindow(None, "New Window", 0, rect)
     hwnd = frame.GetSafeHwnd()
     # api.SetClassLong(hwnd, wc.GCL_HBRBACKGROUND, win_bg_hbrush)
     api.SetClassLong(hwnd, wc.GCL_HBRBACKGROUND, 0)
     # 		print "Window: Setting style:" ###
     # 		win_deconstruct_style(flags) ###
     frame.ModifyStyle(-1, flags)
     # 		print "Window: Style is now:" ###
     # 		win_deconstruct_style(frame.GetStyle()) ###
     frame.ModifyStyleEx(win_no_ex_flags, win_ex_flags)
     if style == "fullscreen":
         self._win_fullscreen = True
     frame.HookMessage(self._win_wm_initmenu, wc.WM_INITMENU)
     self._win = frame
     if style in win_no_menu_styles:
         self._win_has_menubar = False
     else:
         self._win_set_empty_menubar()
     kwds["closable"] = flags & wc.WS_CAPTION <> 0
     GWindow.__init__(self, _win=frame, **kwds)
Exemplo n.º 3
0
 def __init__(self, style='standard', zoomable=None, **kwds):
     # We ignore zoomable, since it's the same as resizable.
     self._style = style
     options = dict(_default_options_for_style[style])
     for option in ['movable', 'closable', 'hidable', 'resizable']:
         if option in kwds:
             options[option] = kwds.pop(option)
     self._ns_style_mask = self._ns_window_style_mask(**options)
     if style == 'fullscreen':
         ns_rect = NSScreen.mainScreen().frame()
     else:
         ns_rect = NSRect(NSPoint(0, 0),
                          NSSize(self._default_width, self._default_height))
     ns_window = PyGUI_NSWindow.alloc()
     ns_window.initWithContentRect_styleMask_backing_defer_(
         ns_rect, self._ns_style_mask, AppKit.NSBackingStoreBuffered, True)
     ns_content = PyGUI_NS_ContentView.alloc()
     ns_content.initWithFrame_(NSRect(NSPoint(0, 0), NSSize(0, 0)))
     ns_content.pygui_component = self
     ns_window.setContentView_(ns_content)
     ns_window.setAcceptsMouseMovedEvents_(True)
     ns_window.setDelegate_(ns_window)
     ns_window.pygui_component = self
     self._ns_window = ns_window
     GWindow.__init__(self,
                      style=style,
                      closable=options['closable'],
                      _ns_view=ns_window.contentView(),
                      _ns_responder=ns_window,
                      _ns_set_autoresizing_mask=False,
                      **kwds)
Exemplo n.º 4
0
 def __init__(self, style = 'standard', zoomable = None, **kwds):
     # We ignore zoomable, since it's the same as resizable.
     self._style = style
     options = dict(_default_options_for_style[style])
     for option in ['movable', 'closable', 'hidable', 'resizable']:
         if option in kwds:
             options[option] = kwds.pop(option)
     self._ns_style_mask = self._ns_window_style_mask(**options)
     if style == 'fullscreen':
         ns_rect = NSScreen.mainScreen().frame()
     else:
         ns_rect = NSRect(NSPoint(0, 0), NSSize(self._default_width, self._default_height))
     ns_window = PyGUI_NSWindow.alloc()
     ns_window.initWithContentRect_styleMask_backing_defer_(
         ns_rect, self._ns_style_mask, AppKit.NSBackingStoreBuffered, True)
     ns_content = PyGUI_NS_ContentView.alloc()
     ns_content.initWithFrame_(NSRect(NSPoint(0, 0), NSSize(0, 0)))
     ns_content.pygui_component = self
     ns_window.setContentView_(ns_content)
     ns_window.setAcceptsMouseMovedEvents_(True)
     ns_window.setDelegate_(ns_window)
     ns_window.pygui_component = self
     self._ns_window = ns_window
     GWindow.__init__(self, style = style, closable = options['closable'],
         _ns_view = ns_window.contentView(), _ns_responder = ns_window,
         _ns_set_autoresizing_mask = False,
         **kwds)
Exemplo n.º 5
0
 def __init__(self,
              style='standard',
              title="New Window",
              movable=1,
              closable=1,
              hidable=None,
              resizable=1,
              zoomable=1,
              **kwds):
     self._all_menus = []
     modal = style in _modal_styles
     if hidable is None:
         hidable = not modal
     self._resizable = resizable
     gtk_win = gtk.Window(gtk.WINDOW_TOPLEVEL)
     gtk_win.set_gravity(gdk.GRAVITY_STATIC)
     gtk_win.set_decorated(style <> 'fullscreen'
                           and (movable or closable or hidable or zoomable))
     gtk_win.set_resizable(resizable)
     gtk_win.set_modal(style in _modal_styles)
     gtk_content = gtk.Layout()
     gtk_content.show()
     if style in _dialog_styles:
         gtk_win.set_type_hint(gdk.WINDOW_TYPE_HINT_DIALOG)
         gtk_win.add(gtk_content)
     else:
         self._gtk_create_menubar()
         gtk_box = gtk.VBox()
         gtk_box.show()
         gtk_box.pack_start(self._gtk_menubar, expand=0, fill=0)
         gtk_box.pack_end(gtk_content, expand=1, fill=1)
         gtk_win.add(gtk_box)
     self._need_menubar_update = 1
     self._gtk_connect(gtk_win, 'configure-event',
                       self._gtk_configure_event)
     self._gtk_connect(gtk_win, 'key-press-event',
                       self._gtk_key_press_event)
     self._gtk_connect(gtk_win, 'delete-event', self._gtk_delete_event)
     GWindow.__init__(self,
                      _gtk_outer=gtk_win,
                      _gtk_inner=gtk_content,
                      _gtk_focus=gtk_content,
                      _gtk_input=gtk_content,
                      style=style,
                      title=title,
                      closable=closable)
     if style == 'fullscreen':
         size = (gdk.screen_width(), gdk.screen_height())
     else:
         size = (_default_width, _default_height)
     self.set_size(size)
     self.set(**kwds)
     self.become_target()
Exemplo n.º 6
0
 def __init__(self,
              style='standard',
              title="New Window",
              movable=1,
              closable=1,
              hidable=None,
              resizable=1,
              zoomable=1,
              **kwds):
     self._all_menus = []
     modal = style in _modal_styles
     if hidable is None:
         hidable = not modal
     self._resizable = resizable
     gtk_win = Gtk.Window.new(Gtk.WindowType.TOPLEVEL)
     gtk_win.set_gravity(Gdk.Gravity.STATIC)
     gtk_win.set_decorated(movable or closable or hidable or zoomable)
     gtk_win.set_resizable(resizable)
     gtk_win.set_modal(style in _modal_styles)
     gtk_content = Gtk.Layout()
     gtk_content.show()
     if style in _dialog_styles:
         gtk_win.set_type_hint(Gdk.WindowTypeHint.DIALOG)
         gtk_win.add(gtk_content)
     else:
         self._gtk_create_menubar()
         gtk_box = Gtk.VBox()
         gtk_box.show()
         gtk_box.pack_start(self._gtk_menubar, 0, 0, 0)
         gtk_box.pack_end(gtk_content, 1, 1, 0)
         gtk_win.add(gtk_box)
     self._need_menubar_update = 1
     self._gtk_connect(gtk_win, 'configure-event',
                       self._gtk_configure_event)
     self._gtk_connect(gtk_win, 'key-press-event',
                       self._gtk_key_press_event)
     self._gtk_connect(gtk_win, 'delete-event', self._gtk_delete_event)
     #GtkInput.__init__(self, gtk_content)
     GWindow.__init__(self,
                      _gtk_outer=gtk_win,
                      _gtk_inner=gtk_content,
                      _gtk_focus=gtk_content,
                      _gtk_input=gtk_content,
                      title=title,
                      closable=closable)
     self.set_size((_default_width, _default_height))
     self.set(**kwds)
     self.become_target()
Exemplo n.º 7
0
 def __init__(self, style = 'standard', title = "New Window",
         movable = 1, closable = 1, hidable = None, resizable = 1,
         zoomable = 1, **kwds):
     self._all_menus = []
     modal = style in _modal_styles
     if hidable is None:
         hidable = not modal
     self._resizable = resizable
     gtk_win = gtk.Window(gtk.WINDOW_TOPLEVEL)
     gtk_win.set_gravity(gdk.GRAVITY_STATIC)
     gtk_win.set_decorated(style <> 'fullscreen'
         and (movable or closable or hidable or zoomable))
     gtk_win.set_resizable(resizable)
     gtk_win.set_modal(style in _modal_styles)
     gtk_content = gtk.Layout()
     gtk_content.show()
     if style in _dialog_styles:
         gtk_win.set_type_hint(gdk.WINDOW_TYPE_HINT_DIALOG)
         gtk_win.add(gtk_content)
     else:
         self._gtk_create_menubar()
         gtk_box = gtk.VBox()
         gtk_box.show()
         gtk_box.pack_start(self._gtk_menubar, expand = 0, fill = 0)
         gtk_box.pack_end(gtk_content, expand = 1, fill = 1)
         gtk_win.add(gtk_box)
     self._need_menubar_update = 1
     self._gtk_connect(gtk_win, 'configure-event', self._gtk_configure_event)
     self._gtk_connect(gtk_win, 'key-press-event', self._gtk_key_press_event)
     self._gtk_connect(gtk_win, 'delete-event', self._gtk_delete_event)
     GWindow.__init__(self, _gtk_outer = gtk_win, _gtk_inner = gtk_content, 
         _gtk_focus = gtk_content, _gtk_input = gtk_content,
         style = style, title = title, closable = closable)
     if style == 'fullscreen':
         size = (gdk.screen_width(), gdk.screen_height())
     else:
         size = (_default_width, _default_height)
     self.set_size(size)
     self.set(**kwds)
     self.become_target()