Display the shadow object, given the position of the menu itself
10703
function (x, y, e) {
            var cmenu = this;
            if (cmenu.shadow) {
                cmenu.shadowObj.css({
                    width: (cmenu.menu.width() + cmenu.shadowWidthAdjust) + "px",
                    height: (cmenu.menu.height() + cmenu.shadowHeightAdjust) + "px",
                    top: (y + cmenu.shadowOffsetY) + "px",
                    left: (x + cmenu.shadowOffsetX) + "px"
                }).addClass(cmenu.shadowClass)[cmenu.showTransition](cmenu.showSpeed);
            }
        }
326435
def display_current(self):
        """"""
        if self.idx_current in self.scene.items():
            self.scene.removeItem(self.idx_current)

        item = QGraphicsRectItem(0,
                                 CURR['pos0'],
                                 self.parent.value('window_length'),
                                 CURR['pos1'])
        # it's necessary to create rect first, and then move it
        item.setPos(self.parent.value('window_start'), 0)
        item.setPen(QPen(Qt.lightGray))
        item.setBrush(QBrush(Qt.lightGray))
        item.setZValue(-10)
        self.scene.addItem(item)
        self.idx_current = item
77966
def OnMenu(self, event):
        """"""

        __id = event.GetId()
        try:
            menuitem = event.GetEventObject().FindItemById(__id)
            selected_text = menuitem.GetItemLabel()
            self.search.SetValue(selected_text)
        except AttributeError:
            # Not called by menu
            event.Skip()
814228
def position_input(obj, visible=False):
    """"""
    if not obj.generic_position.all():
        ObjectPosition.objects.create(content_object=obj)
    return {'obj': obj, 'visible': visible,
            'object_position': obj.generic_position.all()[0]}
1107388
private void updateMenuIcon() {
        Icon            frameIcon = frame.getFrameIcon();
        SeaGlassContext context   = getContext(this);

        if (frameIcon != null) {
            Dimension maxSize   = (Dimension) context.getStyle().get(context, "InternalFrameTitlePane.maxFrameIconSize");
            int       maxWidth  = 16;
            int       maxHeight = 16;

            if (maxSize != null) {
                maxWidth  = maxSize.width;
                maxHeight = maxSize.height;
            }

            if ((frameIcon.getIconWidth() > maxWidth || frameIcon.getIconHeight() > maxHeight) && (frameIcon instanceof ImageIcon)) {
                frameIcon = new ImageIcon(((ImageIcon) frameIcon).getImage().getScaledInstance(maxWidth, maxHeight, Image.SCALE_SMOOTH));
            }
        }

        context.dispose();
        menuButton.setIcon(frameIcon);
    }
691435
def showMenu(self, pos):
        
        glbl_pos = self.viewport().mapToGlobal(pos)
        
        # lookup the specific item at the given position
        item = self.itemAt(pos)
        selected = self.selectedRecords()
        
        if not self._recordEditors:
            return
        
        if item and not isinstance(item, XOrbRecordItem):
            return
        
        menu = QMenu(self)
        acts = {}
        
        # modify a particular item
        if item:
            if self.editorFlags() & XOrbTreeWidget.EditorFlags.Edit:
                record = item.record()
                editor = self.recordEditor(type(record))
                
                if editor:
                    name = record.schema().displayName()
                    act = menu.addAction('Edit {}...'.format(name))
                    act.setIcon(QIcon(resources.find('img/edit.png')))
                    acts[act] = (editor, 'edit', record)
        
        # add items
        if self.editorFlags() & XOrbTreeWidget.EditorFlags.Create:
            menu.addSeparator()
            
            typs = self._recordEditors.keys()
            typs.sort(key=lambda x: x.schema().displayName())
            
            for typ in typs:
                name = typ.schema().displayName()
                act  = menu.addAction('Add {}...'.format(name))
                act.setIcon(QIcon(resources.find('img/add.png')))
                acts[act] = (self._recordEditors[typ], 'create', None)
        
        # remove selected items
        if selected and self.editorFlags() & XOrbTreeWidget.EditorFlags.Remove:
            menu.addSeparator()
            
            act = menu.addAction('Remove Selected Records')
            act.setIcon(QIcon(resources.find('img/remove.png')))
            acts[act] =(None, 'remove', selected)
        
        if not acts:
            return
        
        act = menu.exec_(glbl_pos)
        
        editor, action, record = acts.get(act, (None, None, None))
        
        # create a new record
        if action == 'create':
            record = editor.create(autoCommit=False)
            if record:
                self.recordCreated.emit(record)
                record.commit()
                self.refresh()
        
        # edit an existing record
        elif action == 'edit':
            self.editRecord(record, glbl_pos)
        
        # remove selected records
        elif action == 'remove':
            title = 'Remove Records'
            msg = 'Are you sure you want to remove these records?'
            btns = QMessageBox.Yes | QMessageBox.No
            ans = QMessageBox.information(self.window(), title, msg, btns)
            if ans == QMessageBox.Yes:
                self.recordsRemoved.emit(selected)
                if RecordSet(selected).remove():
                    self.refresh()
31306
function onShow(scope, element, opts) {
      sanitizeAndConfigure(opts);

      if (opts.menuContentEl[0]) {
        // Inherit the theme from the target element.
        $mdTheming.inherit(opts.menuContentEl, opts.target);
      } else {
        $log.warn(
          '$mdMenu: Menu elements should always contain a `md-menu-content` element,' +
          'otherwise interactivity features will not work properly.',
          element
        );
      }

      // Register various listeners to move menu on resize/orientation change
      opts.cleanupResizing = startRepositioningOnResize();
      opts.hideBackdrop = showBackdrop(scope, element, opts);

      // Return the promise for when our menu is done animating in
      return showMenu()
        .then(function(response) {
          opts.alreadyOpen = true;
          opts.cleanupInteraction = activateInteraction();
          opts.cleanupBackdrop = setupBackdrop();

          // Since the menu finished its animation, mark the menu as clickable.
          element.addClass('md-clickable');

          return response;
        });

      /**
       * Place the menu into the DOM and call positioning related functions
       */
      function showMenu() {
        opts.parent.append(element);
        element[0].style.display = '';

        return $q(function(resolve) {
          var position = calculateMenuPosition(element, opts);

          element.removeClass('md-leave');

          // Animate the menu scaling, and opacity [from its position origin (default == top-left)]
          // to normal scale.
          $animateCss(element, {
            addClass: 'md-active',
            from: animator.toCss(position),
            to: animator.toCss({transform: ''})
          })
          .start()
          .then(resolve);

        });
      }

      /**
       * Check for valid opts and set some sane defaults
       */
      function sanitizeAndConfigure() {
        if (!opts.target) {
          throw Error(
            '$mdMenu.show() expected a target to animate from in options.target'
          );
        }
        angular.extend(opts, {
          alreadyOpen: false,
          isRemoved: false,
          target: angular.element(opts.target), // make sure it's not a naked DOM node
          parent: angular.element(opts.parent),
          menuContentEl: angular.element(element[0].querySelector('md-menu-content'))
        });
      }

      /**
       * Configure various resize listeners for screen changes
       */
      function startRepositioningOnResize() {

        var repositionMenu = (function(target, options) {
          return $$rAF.throttle(function() {
            if (opts.isRemoved) return;
            var position = calculateMenuPosition(target, options);

            target.css(animator.toCss(position));
          });
        })(element, opts);

        $window.addEventListener('resize', repositionMenu);
        $window.addEventListener('orientationchange', repositionMenu);

        return function stopRepositioningOnResize() {

          // Disable resizing handlers
          $window.removeEventListener('resize', repositionMenu);
          $window.removeEventListener('orientationchange', repositionMenu);

        };
      }

      /**
       * Sets up the backdrop and listens for click elements.
       * Once the backdrop will be clicked, the menu will automatically close.
       * @returns {!Function} Function to remove the backdrop.
       */
      function setupBackdrop() {
        if (!opts.backdrop) return angular.noop;

        opts.backdrop.on('click', onBackdropClick);

        return function() {
          opts.backdrop.off('click', onBackdropClick);
        };
      }

      /**
       * Function to be called whenever the backdrop is clicked.
       * @param {!MouseEvent} event
       */
      function onBackdropClick(event) {
        event.preventDefault();
        event.stopPropagation();

        scope.$apply(function() {
          opts.mdMenuCtrl.close(true, { closeAll: true });
        });
      }

      /**
       * Activate interaction on the menu. Resolves the focus target and closes the menu on
       * escape or option click.
       * @returns {!Function} Function to deactivate the interaction listeners.
       */
      function activateInteraction() {
        if (!opts.menuContentEl[0]) return angular.noop;

        // Wire up keyboard listeners.
        // - Close on escape,
        // - focus next item on down arrow,
        // - focus prev item on up
        opts.menuContentEl.on('keydown', onMenuKeyDown);
        opts.menuContentEl[0].addEventListener('click', captureClickListener, true);

        // kick off initial focus in the menu on the first enabled element
        var focusTarget = opts.menuContentEl[0]
          .querySelector(prefixer.buildSelector(['md-menu-focus-target', 'md-autofocus']));

        if (!focusTarget) {
          var childrenLen = opts.menuContentEl[0].children.length;
          for (var childIndex = 0; childIndex < childrenLen; childIndex++) {
            var child = opts.menuContentEl[0].children[childIndex];
            focusTarget = child.querySelector('.md-button:not([disabled])');
            if (focusTarget) {
              break;
            }
            if (child.firstElementChild && !child.firstElementChild.disabled) {
              focusTarget = child.firstElementChild;
              break;
            }
          }
        }

        focusTarget && focusTarget.focus();

        return function cleanupInteraction() {
          opts.menuContentEl.off('keydown', onMenuKeyDown);
          opts.menuContentEl[0].removeEventListener('click', captureClickListener, true);
        };

        // ************************************
        // internal functions
        // ************************************

        function onMenuKeyDown(ev) {
          var handled;
          switch (ev.keyCode) {
            case $mdConstant.KEY_CODE.ESCAPE:
              opts.mdMenuCtrl.close(false, { closeAll: true });
              handled = true;
              break;
            case $mdConstant.KEY_CODE.TAB:
              opts.mdMenuCtrl.close(false, { closeAll: true });
              // Don't prevent default or stop propagation on this event as we want tab
              // to move the focus to the next focusable element on the page.
              handled = false;
              break;
            case $mdConstant.KEY_CODE.UP_ARROW:
              if (!focusMenuItem(ev, opts.menuContentEl, opts, -1) && !opts.nestLevel) {
                opts.mdMenuCtrl.triggerContainerProxy(ev);
              }
              handled = true;
              break;
            case $mdConstant.KEY_CODE.DOWN_ARROW:
              if (!focusMenuItem(ev, opts.menuContentEl, opts, 1) && !opts.nestLevel) {
                opts.mdMenuCtrl.triggerContainerProxy(ev);
              }
              handled = true;
              break;
            case $mdConstant.KEY_CODE.LEFT_ARROW:
              if (opts.nestLevel) {
                opts.mdMenuCtrl.close();
              } else {
                opts.mdMenuCtrl.triggerContainerProxy(ev);
              }
              handled = true;
              break;
            case $mdConstant.KEY_CODE.RIGHT_ARROW:
              var parentMenu = $mdUtil.getClosest(ev.target, 'MD-MENU');
              if (parentMenu && parentMenu != opts.parent[0]) {
                ev.target.click();
              } else {
                opts.mdMenuCtrl.triggerContainerProxy(ev);
              }
              handled = true;
              break;
          }
          if (handled) {
            ev.preventDefault();
            ev.stopImmediatePropagation();
          }
        }

        function onBackdropClick(e) {
          e.preventDefault();
          e.stopPropagation();
          scope.$apply(function() {
            opts.mdMenuCtrl.close(true, { closeAll: true });
          });
        }

        // Close menu on menu item click, if said menu-item is not disabled
        function captureClickListener(e) {
          var target = e.target;
          // Traverse up the event until we get to the menuContentEl to see if
          // there is an ng-click and that the ng-click is not disabled
          do {
            if (target == opts.menuContentEl[0]) return;
            if ((hasAnyAttribute(target, ['ng-click', 'ng-href', 'ui-sref']) ||
                target.nodeName == 'BUTTON' || target.nodeName == 'MD-BUTTON') && !hasAnyAttribute(target, ['md-prevent-menu-close'])) {
              var closestMenu = $mdUtil.getClosest(target, 'MD-MENU');
              if (!target.hasAttribute('disabled') && (!closestMenu || closestMenu == opts.parent[0])) {
                close();
              }
              break;
            }
          } while (target = target.parentNode);

          function close() {
            scope.$apply(function() {
              opts.mdMenuCtrl.close(true, { closeAll: true });
            });
          }

          function hasAnyAttribute(target, attrs) {
            if (!target) return false;

            for (var i = 0, attr; attr = attrs[i]; ++i) {
              if (prefixer.hasAttribute(target, attr)) {
                return true;
              }
            }

            return false;
          }
        }

      }
    }
1067282
def on_menu(self, event):
        ''''''
        state = self.state
        # see if it is a popup menu
        if state.popup_object is not None:
            obj = state.popup_object
            ret = obj.popup_menu.find_selected(event)
            if ret is not None:
                ret.call_handler()
                state.event_queue.put(SlipMenuEvent(state.popup_latlon, event,
                                                    [SlipObjectSelection(obj.key, 0, obj.layer, obj.selection_info())],
                                                    ret))
                state.popup_object = None
                state.popup_latlon = None
        if state.default_popup is not None:
            ret = state.default_popup.popup.find_selected(event)
            if ret is not None:
                ret.call_handler()
                state.event_queue.put(SlipMenuEvent(state.popup_latlon, event, [], ret))
            
        # otherwise a normal menu
        ret = self.menu.find_selected(event)
        if ret is None:
            return
        ret.call_handler()
        if ret.returnkey == 'toggleGrid':
            state.grid = ret.IsChecked()
        elif ret.returnkey == 'toggleFollow':
            state.follow = ret.IsChecked()
        elif ret.returnkey == 'toggleDownload':
            state.download = ret.IsChecked()
        elif ret.returnkey == 'setService':
            state.mt.set_service(ret.get_choice())
        elif ret.returnkey == 'gotoPosition':
            state.panel.enter_position()
        elif ret.returnkey == 'increaseBrightness':
            state.brightness *= 1.25
        elif ret.returnkey == 'decreaseBrightness':
            state.brightness /= 1.25
        state.need_redraw = True
100502
function () {

		var nDisplayRegionHeight = getDisplayRegionHeight(),
			bMenuHasItems = (oMenu.getItems().length > 0),
			nMenuMinScrollHeight,
			fnReturnVal;


		if (nMenuOffsetHeight > nDisplayRegionHeight) {

			nMenuMinScrollHeight = 
				bMenuHasItems ? oMenu.cfg.getProperty(_MIN_SCROLL_HEIGHT) : nMenuOffsetHeight;


			if ((nDisplayRegionHeight > nMenuMinScrollHeight) && bMenuHasItems) {
				nMaxHeight = nDisplayRegionHeight;
			}
			else {
				nMaxHeight = nInitialMaxHeight;
			}


			oMenu._setScrollHeight(nMaxHeight);
			oMenu.hideEvent.subscribe(resetMaxHeight);
			

			// Re-align the Menu since its height has just changed
			// as a result of the setting of the maxheight property.

			alignY();
			

			if (nDisplayRegionHeight < nMenuMinScrollHeight) {

				if (bFlipped) {
	
					/*
						 All possible positions and values for the "maxheight" 
						 configuration property have been tried, but none were 
						 successful, so fall back to the original size and position.
					*/

					flipVertical();
					
				}
				else {
	
					flipVertical();

					bFlipped = true;
	
					fnReturnVal = setVerticalPosition();
	
				}
				
			}
		
		}
		else if (nMaxHeight && (nMaxHeight !== nInitialMaxHeight)) {
		
			oMenu._setScrollHeight(nInitialMaxHeight);
			oMenu.hideEvent.subscribe(resetMaxHeight);

			// Re-align the Menu since its height has just changed
			// as a result of the setting of the maxheight property.

			alignY();
		
		}

		return fnReturnVal;

	}
489290
function onMenu( item ) {
    var squire = this.squire;
    var id = item.id;

    switch ( id ) {
    case 'undo':
        squire.undo();
        break;
    case 'redo':
        squire.redo();
        break;
    case 'eraser':
        squire.removeAllFormatting();
        break;
    case 'link':
        makeLink.call( squire );
        break;
    case 'image':
        this.insertImage();
        break;
    case 'format-bold':
        if ( squire.hasFormat( 'b' ) ) {
            squire.removeBold();
        } else {
            squire.bold();
        }
        break;
    case 'format-italic':
        if ( squire.hasFormat( 'i' ) || squire.hasFormat( 'em' ) ) {
            squire.removeItalic();
        } else {
            squire.italic();
        }
        break;
    case 'format-underline':
        if ( squire.hasFormat( 'u' ) ) {
            squire.removeUnderline();
        } else {
            squire.underline();
        }
        break;
    case 'format-align-left':
        squire.setTextAlignment( 'left' );
        break;
    case 'format-align-center':
        squire.setTextAlignment( 'center' );
        break;
    case 'format-align-right':
        squire.setTextAlignment( 'right' );
        break;
    case 'format-align-justify':
        squire.setTextAlignment( 'justify' );
        break;
    case 'font':
        setFontFaceSizeColor.call( squire );
        break;
    case 'format-float-left':
        setFloat.call( squire, 'left' );
        break;
    case 'format-float-center':
        setFloat.call( squire, 'center' );
        break;
    case 'format-float-right':
        setFloat.call( squire, 'right' );
        break;
    case 'format-float-none':
        setFloat.call( squire, 'none' );
        break;
    case 'format-header':
        setHeader.call( squire );
        break;
    default:
        this.processButton( id );
    }
    this.focus = true;
}
281784
function (t, e) {
            var cmenu = this, x = e.pageX, y = e.pageY;

            if (cmenu._div)
                cmenu._div.css('height', 'auto').css('overflow-y', 'auto');

            cmenu.target = t; // Preserve the object that triggered this context menu so menu item click methods can see it
            cmenu._showEvent = e; // Preserve the event that triggered this context menu so menu item click methods can see it
            if (cmenu.beforeShow() !== false) {
                // If the menu content is a function, call it to populate the menu each time it is displayed
                if (cmenu.menuFunction) {
                    if (cmenu.menu) {
                        $(cmenu.menu).remove();
                    }
                    cmenu.menu = cmenu.createMenu(cmenu.menuFunction(cmenu, t), cmenu);
                    cmenu.menu.css({display: 'none'});
                    $(cmenu.appendTo).append(cmenu.menu);
                }
                var $c = cmenu.menu;
                x += cmenu.offsetX;
                y += cmenu.offsetY;
                var pos = cmenu.getPosition(x, y, cmenu, e); // Extracted to method for extensibility
                cmenu.showShadow(pos.x, pos.y, e);
                // Resize the iframe if needed
                if (cmenu.useIframe) {
                    $c.find('iframe').css({
                        width: $c.width() + cmenu.shadowOffsetX + cmenu.shadowWidthAdjust,
                        height: $c.height() + cmenu.shadowOffsetY + cmenu.shadowHeightAdjust
                    });
                }
                if (cmenu.dropDown) {
                    $c.css('visibility', 'hidden').show();

                    var bodySize = {x: $(window).width(), y: $(window).height()};

                    if ($(t).offset().top + $(t).outerHeight() + $c.height() > bodySize.y) {
                        if ($(t).offset().left + $(t).outerWidth() + $c.width() > bodySize.x)
                            $c.css({
                                top: ($(t).offset().top - $c.outerHeight()) + "px",
                                left: ($(t).offset().left - $c.outerWidth()) + "px",
                                position: "absolute",
                                zIndex: 9999
                            })[cmenu.showTransition](cmenu.showSpeed, ((cmenu.showCallback) ? function () {
                                cmenu.showCallback.call(cmenu);
                            } : null));
                        else
                            $c.css({
                                top: ($(t).offset().top - $c.outerHeight()) + "px",
                                left: ($(t).offset().left) + "px",
                                position: "absolute",
                                zIndex: 9999
                            })[cmenu.showTransition](cmenu.showSpeed, ((cmenu.showCallback) ? function () {
                                cmenu.showCallback.call(cmenu);
                            } : null));
                    }
                    else {

                        if ($(t).offset().left + $(t).outerWidth() + $c.width() > bodySize.x)
                            $c.css({
                                top: ($(t).offset().top + $(t).outerHeight()) + "px",
                                left: ($(t).offset().left - $c.outerWidth()) + "px",
                                position: "absolute",
                                zIndex: 9999
                            })[cmenu.showTransition](cmenu.showSpeed, ((cmenu.showCallback) ? function () {
                                cmenu.showCallback.call(cmenu);
                            } : null));
                        else
                            $c.css({
                                top: ($(t).offset().top + $(t).outerHeight()) + "px",
                                left: ($(t).offset().left) + "px",
                                position: "absolute",
                                zIndex: 9999
                            })[cmenu.showTransition](cmenu.showSpeed, ((cmenu.showCallback) ? function () {
                                cmenu.showCallback.call(cmenu);
                            } : null));

                    }
                    $c.css('visibility', 'visible');
                }
                else
                    $c.css({
                        top: pos.y + "px",
                        left: pos.x + "px",
                        position: "absolute",
                        zIndex: 9999
                    })[cmenu.showTransition](cmenu.showSpeed, ((cmenu.showCallback) ? function () {
                        cmenu.showCallback.call(cmenu);
                    } : null));
                cmenu.shown = true;
                $(document).one('click', null, function () {
                    cmenu.hide();
                }); // Handle a single click to the document to hide the menu
            }
        }
442371
function Menu() {
  ui.Emitter.call(this);
  this.items = {};
  this.el = $(html).hide().appendTo('body');
  this.el.hover(this.deselect.bind(this));
  $('html').click(this.hide.bind(this));
  this.on('show', this.bindKeyboardEvents.bind(this));
  this.on('hide', this.unbindKeyboardEvents.bind(this));
}
1058682
def display(self, display_before=False):
        """"""
        try:
            copy = self.image.copy()
        except AttributeError:
            raise Exception("You need to set the Filter.image attribute for displaying")
        copy = BrightnessProcessor(brightness=0.6).process(copy)
        s, g = self._input, self.good_segments_indexes
        draw_segments(copy, s[g], (0, 255, 0))
        draw_segments(copy, s[True ^ g], (0, 0, 255))
        show_image_and_wait_for_key(copy, "segments filtered by " + self.__class__.__name__)
211619
def _onMenuButton(self, evt):
        """"""
        x, y = self.GetPositionTuple()
        w, h = self.GetSizeTuple()
        self.PopupMenuXY(self._menu, x, y+h-4)
                # When menu returned, indicate selection in button
        evt.Skip()
1182321
function() {
        var options = this.options,
            node = this.node,
            element = this.loadElement(node);

        // Only position if the menu has children
        if (!element.children().length) {
            return;
        }

        this.fireEvent('showing');

        var height = element.outerHeight(),
            coords = node.offset(),
            x = coords.left + options.xOffset,
            y = coords.top + options.yOffset + node.outerHeight(),
            windowScroll = $(window).height(),
            dir = 'left';

        // If menu goes below half page, position it above
        if (y > (windowScroll / 2)) {
            y = coords.top - options.yOffset - height;
        }

        // Change position for RTL
        if (Toolkit.isRTL) {
            x = $(window).width() - coords.left - node.outerWidth();
            dir = 'right';
        }

        element
            .css('top', y)
            .css(dir, x)
            .reveal();

        this.fireEvent('shown');
    }
169983
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
	private void offsetMenu(int offsetPixels) {
		 if (!mOffsetMenu || mSwipeBackViewSize == 0) {
			 return;
		 }

		 final int width = getWidth();
		 final int height = getHeight();

		 final int menuSize = mSwipeBackViewSize;
		 final int sign = (int) (mOffsetPixels / Math.abs(mOffsetPixels));
		 final float openRatio = Math.abs(mOffsetPixels) / menuSize;
		 final int offset = (int) (-0.25f * ((1.0f - openRatio) * menuSize) * sign);

		 switch (getPosition()) {
		 case LEFT: {
			 if (USE_TRANSLATIONS) {
				 if (offsetPixels > 0) {
					mSwipeBackContainer.setTranslationX(offset);
				 } else {
					mSwipeBackContainer.setTranslationX(-menuSize);
				 }

			 } else {
				mSwipeBackContainer.offsetLeftAndRight(offset
						- mSwipeBackContainer.getLeft());
				mSwipeBackContainer.setVisibility(offsetPixels == 0 ? INVISIBLE
						: VISIBLE);
			 }
			 break;
		 }

		 case RIGHT: {
			 if (USE_TRANSLATIONS) {
				 if (offsetPixels != 0) {
					mSwipeBackContainer.setTranslationX(offset);
				 } else {
					mSwipeBackContainer.setTranslationX(menuSize);
				 }

			 } else {
				final int oldOffset = mSwipeBackContainer.getRight() - width;
				 final int offsetBy = offset - oldOffset;
				mSwipeBackContainer.offsetLeftAndRight(offsetBy);
				mSwipeBackContainer.setVisibility(offsetPixels == 0 ? INVISIBLE
						: VISIBLE);
			 }
			 break;
		 }

		 case TOP: {
			 if (USE_TRANSLATIONS) {
				 if (offsetPixels > 0) {
					mSwipeBackContainer.setTranslationY(offset);
				 } else {
					mSwipeBackContainer.setTranslationY(-menuSize);
				 }

			 } else {
				mSwipeBackContainer.offsetTopAndBottom(offset
						- mSwipeBackContainer.getTop());
				mSwipeBackContainer.setVisibility(offsetPixels == 0 ? INVISIBLE
						: VISIBLE);
			 }
			 break;
		 }

		 case BOTTOM: {
			 if (USE_TRANSLATIONS) {
				 if (offsetPixels != 0) {
					mSwipeBackContainer.setTranslationY(offset);
				 } else {
					mSwipeBackContainer.setTranslationY(menuSize);
				 }

			 } else {
				final int oldOffset = mSwipeBackContainer.getBottom() - height;
				 final int offsetBy = offset - oldOffset;
				mSwipeBackContainer.offsetTopAndBottom(offsetBy);
				mSwipeBackContainer.setVisibility(offsetPixels == 0 ? INVISIBLE
						: VISIBLE);
			 }
			 break;
		 }
		 }

	 }
321107
private void offsetMenu(int offsetPixels) {
        if (!mOffsetMenu || mMenuSize == 0) {
            return;
        }

        final int width = getWidth();
        final int height = getHeight();

        final int menuSize = mMenuSize;
        final int sign = (int) (mOffsetPixels / Math.abs(mOffsetPixels));
        final float openRatio = Math.abs(mOffsetPixels) / menuSize;
        final int offset = (int) (-0.25f * ((1.0f - openRatio) * menuSize) * sign);

        switch (getPosition()) {
            case LEFT: {
                if (USE_TRANSLATIONS) {
                    if (offsetPixels > 0) {
                        mMenuContainer.setTranslationX(offset);
                    } else {
                        mMenuContainer.setTranslationX(-menuSize);
                    }

                } else {
                    mMenuContainer.offsetLeftAndRight(offset - mMenuContainer.getLeft());
                    mMenuContainer.setVisibility(offsetPixels == 0 ? INVISIBLE : VISIBLE);
                }
                break;
            }

            case RIGHT: {
                if (USE_TRANSLATIONS) {
                    if (offsetPixels != 0) {
                        mMenuContainer.setTranslationX(offset);
                    } else {
                        mMenuContainer.setTranslationX(menuSize);
                    }

                } else {
                    final int oldOffset = mMenuContainer.getRight() - width;
                    final int offsetBy = offset - oldOffset;
                    mMenuContainer.offsetLeftAndRight(offsetBy);
                    mMenuContainer.setVisibility(offsetPixels == 0 ? INVISIBLE : VISIBLE);
                }
                break;
            }

            case TOP: {
                if (USE_TRANSLATIONS) {
                    if (offsetPixels > 0) {
                        mMenuContainer.setTranslationY(offset);
                    } else {
                        mMenuContainer.setTranslationY(-menuSize);
                    }

                } else {
                    mMenuContainer.offsetTopAndBottom(offset - mMenuContainer.getTop());
                    mMenuContainer.setVisibility(offsetPixels == 0 ? INVISIBLE : VISIBLE);
                }
                break;
            }

            case BOTTOM: {
                if (USE_TRANSLATIONS) {
                    if (offsetPixels != 0) {
                        mMenuContainer.setTranslationY(offset);
                    } else {
                        mMenuContainer.setTranslationY(menuSize);
                    }

                } else {
                    final int oldOffset = mMenuContainer.getBottom() - height;
                    final int offsetBy = offset - oldOffset;
                    mMenuContainer.offsetTopAndBottom(offsetBy);
                    mMenuContainer.setVisibility(offsetPixels == 0 ? INVISIBLE : VISIBLE);
                }
                break;
            }
        }

    }