コード例 #1
0
ファイル: mactoolbar.py プロジェクト: uckermann/sk1-wx
	def generate_skins(self):
		args = (wx.ART_OTHER, const.DEF_SIZE)
		get_bmp = wx.ArtProvider.GetBitmap
		left_normal = get_bmp(icons.MAC_TBNB_LEFT_NORMAL, *args)
		left_pressed = get_bmp(icons.MAC_TBNB_LEFT_PRESSED, *args)
		middle_normal = get_bmp(icons.MAC_TBNB_MIDDLE_NORMAL, *args)
		middle_pressed = get_bmp(icons.MAC_TBNB_MIDDLE_PRESSED, *args)
		right_normal = get_bmp(icons.MAC_TBNB_RIGHT_NORMAL, *args)
		right_pressed = get_bmp(icons.MAC_TBNB_RIGHT_PRESSED, *args)
		self.spacer_normal = get_bmp(icons.MAC_TBNB_SPACER_NORMAL, *args)
		self.spacer_active = get_bmp(icons.MAC_TBNB_SPACER_ACTIVE, *args)
		self.normal_skins = []
		self.pressed_skins = []
		self.disabled_skins = []
		index = 0
		last = len(self.actions) - 1
		for action in self.actions:
			if const.is_gtk(): icon = action.get_icon(const.DEF_SIZE)
			else: icon = action.get_icon()
			if not index: bg = left_normal; pbg = left_pressed
			elif index == last: bg = right_normal; pbg = right_pressed
			else: bg = middle_normal; pbg = middle_pressed
			self.normal_skins.append(render_tb_icon(bg, icon))
			self.pressed_skins.append(render_tb_icon(pbg, icon))
			self.disabled_skins.append(render_tb_icon(bg, icon, disabled=True))
			index += 1
コード例 #2
0
	def __init__(self, parent, action):
		self.action = action
		artid = action.get_artid()
		tooltip = action.get_tooltip_text()
		text = ''
		if artid is None: text = tooltip
		native = True
		if not const.is_gtk(): native = False
		ImageButton.__init__(self, parent, artid, const.DEF_SIZE, text, tooltip,
							native=native, onclick=action.do_call)
		action.register(self)
コード例 #3
0
ファイル: mactoolbar.py プロジェクト: uckermann/sk1-wx
	def __init__(self, parent, action):
		self.action = action
		bg_normal = wx.ArtProvider.GetBitmap(icons.MAC_TBB_NORMAL,
										wx.ART_OTHER, const.DEF_SIZE)
		bg_pressed = wx.ArtProvider.GetBitmap(icons.MAC_TBB_PRESSED,
								wx.ART_OTHER, const.DEF_SIZE)

		if const.is_gtk(): icon = self.action.get_icon(const.DEF_SIZE)
		else: icon = self.action.get_icon()
		self.bg_normal = render_tb_icon(bg_normal, icon)
		self.bg_disabled = render_tb_icon(bg_normal, icon, disabled=True)
		self.bg_pressed = render_tb_icon(bg_pressed, icon)

		wx.StaticBitmap.__init__(self, parent, wx.ID_ANY, self.bg_normal)
		self.tooltip_win = MacTB_ToolTip(self)
		self.set_tooltip(self.action.get_descr_text())
		self.action.register(self)

		self.Bind(wx.EVT_LEFT_DOWN, self._mouse_down, self)
		self.Bind(wx.EVT_LEFT_UP, self._mouse_up, self)
		self.Bind(wx.EVT_LEAVE_WINDOW, self._mouse_leave, self)
		self.Bind(wx.EVT_MOTION, self._mouse_move, self)