当前位置: 首页>>代码示例>>C#>>正文


C# Gdk.Equals方法代码示例

本文整理汇总了C#中Gdk.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Gdk.Equals方法的具体用法?C# Gdk.Equals怎么用?C# Gdk.Equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gdk的用法示例。


在下文中一共展示了Gdk.Equals方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetSize

    public override void GetSize(Widget widget, ref Gdk.Rectangle cell_area, out int x_offset, out int y_offset, out int width, out int height)
    {
        int calc_width = (int) this.Xpad * 2 + 10;
        int calc_height = (int) this.Ypad * 2 + 10;

        width = calc_width;
        height = calc_height;

        x_offset = 0;
        y_offset = 0;
        if (!cell_area.Equals (Gdk.Rectangle.Zero)) {
            x_offset = (int) (this.Xalign * (cell_area.Width - calc_width));
            x_offset = Math.Max (x_offset, 0);

            y_offset = (int) (this.Yalign * (cell_area.Height - calc_height));
            y_offset = Math.Max (y_offset, 0);
        }
    }
开发者ID:mono,项目名称:heap-prof,代码行数:18,代码来源:TypeGraphViewer.cs

示例2: MapRawKeys

		//from MonoDevelop.Components.Commands.KeyBindingManager
		internal static void MapRawKeys (Gdk.EventKey evt, out Gdk.Key key, out Gdk.ModifierType mod)
		{
			mod = evt.State;
			key = evt.Key;
			
			uint keyval;
			int effectiveGroup, level;
			Gdk.ModifierType consumedModifiers;
			keymap.TranslateKeyboardState (evt.HardwareKeycode, evt.State, evt.Group, out keyval, out effectiveGroup,
			                               out level, out consumedModifiers);
			
			key = (Gdk.Key)keyval;
			mod = evt.State & ~consumedModifiers;
			
			if (IsX11) {
				//this is a workaround for a common X mapping issue
				//where the alt key is mapped to the meta key when the shift modifier is active
				if (key.Equals (Gdk.Key.Meta_L) || key.Equals (Gdk.Key.Meta_R))
					key = Gdk.Key.Alt_L;
			}
			
			//HACK: the MAC GTK+ port currently does some horrible, un-GTK-ish key mappings
			// so we work around them by playing some tricks to remap and decompose modifiers.
			// We also decompose keys to the root physical key so that the Mac command 
			// combinations appear as expected, e.g. shift-{ is treated as shift-[.
			if (IsMac && !IsX11) {
				// Mac GTK+ maps the command key to the Mod1 modifier, which usually means alt/
				// We map this instead to meta, because the Mac GTK+ has mapped the cmd key
				// to the meta key (yay inconsistency!). IMO super would have been saner.
				if ((mod & Gdk.ModifierType.Mod1Mask) != 0) {
					mod ^= Gdk.ModifierType.Mod1Mask;
					mod |= Gdk.ModifierType.MetaMask;
				}
				
				// If Mod5 is active it *might* mean that opt/alt is active,
				// so we can unset this and map it back to the normal modifier.
				if ((mod & Gdk.ModifierType.Mod5Mask) != 0) {
					mod ^= Gdk.ModifierType.Mod5Mask;
					mod |= Gdk.ModifierType.Mod1Mask;
				}
				
				// When opt modifier is active, we need to decompose this to make the command appear correct for Mac.
				// In addition, we can only inspect whether the opt/alt key is pressed by examining
				// the key's "group", because the Mac GTK+ treats opt as a group modifier and does
				// not expose it as an actual GDK modifier.
				if (evt.Group == (byte) 1) {
					mod |= Gdk.ModifierType.Mod1Mask;
					key = GetGroupZeroKey (key, evt);
				}
			}
			
			//fix shift-tab weirdness. There isn't a nice name for untab, so make it shift-tab
			if (key == Gdk.Key.ISO_Left_Tab) {
				key = Gdk.Key.Tab;
				mod |= Gdk.ModifierType.ShiftMask;
			}
		}
开发者ID:pgoron,项目名称:monodevelop,代码行数:58,代码来源:Platform.cs

示例3: MapRawKeys

		//from MonoDevelop.Components.Commands.KeyBindingManager
		internal static void MapRawKeys (Gdk.EventKey evt, out Gdk.Key key, out Gdk.ModifierType mod, out uint keyval)
		{
			mod = evt.State;
			key = evt.Key;
			keyval = evt.KeyValue;
			
			int effectiveGroup, level;
			Gdk.ModifierType consumedModifiers;
			ModifierType modifier = evt.State;
			byte grp = evt.Group;
			// Workaround for bug "Bug 688247 - Ctrl+Alt key not work on windows7 with bootcamp on a Mac Book Pro"
			// Ctrl+Alt should behave like right alt key - unfortunately TranslateKeyboardState doesn't handle it. 
			if (IsWindows && (modifier & ~ModifierType.LockMask) == (ModifierType.Mod1Mask | ModifierType.ControlMask)) {
				modifier = ModifierType.Mod2Mask;
				grp = 1;
			}
			
			keymap.TranslateKeyboardState (evt.HardwareKeycode, modifier, grp, out keyval, out effectiveGroup,
			                               out level, out consumedModifiers);
			key = (Gdk.Key)keyval;
			mod = modifier & ~consumedModifiers;
			
			if (IsX11) {
				//this is a workaround for a common X mapping issue
				//where the alt key is mapped to the meta key when the shift modifier is active
				if (key.Equals (Gdk.Key.Meta_L) || key.Equals (Gdk.Key.Meta_R))
					key = Gdk.Key.Alt_L;
			}
			
			//HACK: the MAC GTK+ port currently does some horrible, un-GTK-ish key mappings
			// so we work around them by playing some tricks to remap and decompose modifiers.
			// We also decompose keys to the root physical key so that the Mac command 
			// combinations appear as expected, e.g. shift-{ is treated as shift-[.
			if (IsMac && !IsX11) {
				// Mac GTK+ maps the command key to the Mod1 modifier, which usually means alt/
				// We map this instead to meta, because the Mac GTK+ has mapped the cmd key
				// to the meta key (yay inconsistency!). IMO super would have been saner.
				if ((mod & Gdk.ModifierType.Mod1Mask) != 0) {
					mod ^= Gdk.ModifierType.Mod1Mask;
					mod |= Gdk.ModifierType.MetaMask;
				}
				
				// If Mod5 is active it *might* mean that opt/alt is active,
				// so we can unset this and map it back to the normal modifier.
				if ((mod & Gdk.ModifierType.Mod5Mask) != 0) {
					mod ^= Gdk.ModifierType.Mod5Mask;
					mod |= Gdk.ModifierType.Mod1Mask;
				}
				
				// When opt modifier is active, we need to decompose this to make the command appear correct for Mac.
				// In addition, we can only inspect whether the opt/alt key is pressed by examining
				// the key's "group", because the Mac GTK+ treats opt as a group modifier and does
				// not expose it as an actual GDK modifier.
				if (evt.Group == (byte) 1) {
					mod |= Gdk.ModifierType.Mod1Mask;
					key = GetGroupZeroKey (key, evt);
				}
				
				// Fix for allow ctrl+shift+a/ctrl+shift+e keys on mac (select to line begin/end actions)
				if ((key == Gdk.Key.A || key == Gdk.Key.E) && (evt.State & (Gdk.ModifierType.ShiftMask | Gdk.ModifierType.ControlMask)) == (Gdk.ModifierType.ShiftMask | Gdk.ModifierType.ControlMask))
					mod = Gdk.ModifierType.ShiftMask | Gdk.ModifierType.ControlMask;
			}
			
			//fix shift-tab weirdness. There isn't a nice name for untab, so make it shift-tab
			if (key == Gdk.Key.ISO_Left_Tab) {
				key = Gdk.Key.Tab;
				mod |= Gdk.ModifierType.ShiftMask;
			}
			
			if ((key == Gdk.Key.space || key == Gdk.Key.parenleft || key == Gdk.Key.parenright) && (mod & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask)
				mod = ModifierType.None;
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:73,代码来源:Platform.cs

示例4: GetSize

        // ============================================
        // PUBLIC Methods
        // ============================================
        /// Obtains the width and height needed to render the cell
        public override void GetSize(Gtk.Widget widget, 
										 ref Gdk.Rectangle cell_area, 
										 out int x_offset, out int y_offset, 
										 out int width, out int height)
        {
            int calc_height;
            int calc_width;

            x_offset = 0;
            y_offset = 0;
            if (!cell_area.Equals(Gdk.Rectangle.Zero)) {
                calc_width  = Math.Max(MIN_CELL_WIDTH, cell_area.Width);
                calc_height = Math.Max(MIN_CELL_HEIGHT, cell_area.Height);

                x_offset = (int) (this.Xalign * (cell_area.Width - calc_width));
                x_offset = Math.Max(x_offset, 0);

                y_offset = (int) (this.Yalign * (cell_area.Height - calc_height));
                y_offset = Math.Max (y_offset, 0);
            } else {
                calc_width  = MIN_CELL_WIDTH;
                calc_height = MIN_CELL_HEIGHT;
            }

            width = calc_width;
            height = calc_height;
        }
开发者ID:BackupTheBerlios,项目名称:niry-sharp-svn,代码行数:31,代码来源:CellRendererBitArray.cs

示例5: ModifierToPartialAccel

        static string ModifierToPartialAccel(Gdk.ModifierType mod, Gdk.Key key, out bool keyIsModifier)
        {
            //Console.WriteLine("PRESSED MOD: {0} ; KEY {1}",mod,key);

            string labelMod = String.Empty;
            string labelKey = String.Empty;

            if ((mod & Gdk.ModifierType.ControlMask) != 0)
                labelMod += "Control+";
            if ((mod & Gdk.ModifierType.Mod1Mask) != 0)
                labelMod += "Alt+";
            if ((mod & Gdk.ModifierType.ShiftMask) != 0)
                labelMod += "Shift+";
            if ((mod & Gdk.ModifierType.MetaMask) != 0)
                labelMod += "Command+";//labelMod += "Meta+";
            if ((mod & Gdk.ModifierType.SuperMask) != 0)
                labelMod += "Super+";

            //Console.WriteLine("labelMod-> {0}",labelMod);

            keyIsModifier = true;
            if (key.Equals (Gdk.Key.Control_L) || key.Equals (Gdk.Key.Control_R))
                labelKey += "Control+";
            else if (key.Equals (Gdk.Key.Alt_L) || key.Equals (Gdk.Key.Alt_R))
                labelKey += "Alt+";
            else if (key.Equals (Gdk.Key.Shift_L) || key.Equals (Gdk.Key.Shift_R))
                labelKey += "Shift+";
            else if (key.Equals (Gdk.Key.Meta_L) || key.Equals (Gdk.Key.Meta_R))
                labelKey += "Command+";//labelKey += "Meta+";
            else if (key.Equals (Gdk.Key.Super_L) || key.Equals (Gdk.Key.Super_L))
                labelKey += "Super+";
            else
                keyIsModifier = false;

            //Console.WriteLine("labelKey-> {0}",labelKey);

            if(labelMod.Contains(labelKey)){

                return labelMod;
            } else return labelMod+labelKey;
        }
开发者ID:moscrif,项目名称:ide,代码行数:41,代码来源:KeyBindingPanel.cs

示例6: ModifierToPartialAccel

		static string ModifierToPartialAccel (Gdk.ModifierType mod, Gdk.Key key, out bool keyIsModifier)
		{
			string label = String.Empty;
			
			if ((mod & Gdk.ModifierType.ControlMask) != 0)
				label += "Control+";
			if ((mod & Gdk.ModifierType.Mod1Mask) != 0)
				label += "Alt+";
			if ((mod & Gdk.ModifierType.ShiftMask) != 0)
				label += "Shift+";
			if ((mod & Gdk.ModifierType.MetaMask) != 0)
				label += "Meta+";
			if ((mod & Gdk.ModifierType.SuperMask) != 0)
				label += "Super+";
			
			keyIsModifier = true;
			if (key.Equals (Gdk.Key.Control_L) || key.Equals (Gdk.Key.Control_R))
				label += "Control+";
			else if (key.Equals (Gdk.Key.Alt_L) || key.Equals (Gdk.Key.Alt_R))
				label += "Alt+";
			else if (key.Equals (Gdk.Key.Shift_L) || key.Equals (Gdk.Key.Shift_R))
				label += "Shift+";
			else if (key.Equals (Gdk.Key.Meta_L) || key.Equals (Gdk.Key.Meta_R))
				label += "Meta+";
			else if (key.Equals (Gdk.Key.Super_L) || key.Equals (Gdk.Key.Super_L))
				label += "Super+";
			else
				keyIsModifier = false;
			
			return label;
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:31,代码来源:KeyBindingManager.cs


注:本文中的Gdk.Equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。