GetOrientation() public method

Gets the button orienation.
public GetOrientation ( IPalette palette ) : ButtonOrientation
palette IPalette Palette to use for inheriting values.
return ButtonOrientation
Beispiel #1
0
        private ButtonSpecView AddButtonSpec(ButtonSpec buttonSpec)
        {
            // Find the docker index that is the target for the button spec
            int viewDockerIndex = GetTargetDockerIndex(buttonSpec.GetLocation(_redirector));

            IPaletteMetric       viewPaletteMetric = null;
            PaletteMetricPadding viewMetricPadding = PaletteMetricPadding.None;

            // Are we applying metrics
            if ((_viewMetrics != null) &&
                (_viewMetrics.Length > viewDockerIndex) &&
                (_viewMetricPaddings.Length > viewDockerIndex))
            {
                viewPaletteMetric = _viewMetrics[viewDockerIndex];
                viewMetricPadding = _viewMetricPaddings[viewDockerIndex];

                // Create an instance to manage the individual button spec
                ButtonSpecView buttonView = CreateButtonSpecView(_redirector, viewPaletteMetric, viewMetricPadding, buttonSpec);

                // Add a lookup from the button spec to the button spec view
                _specLookup.Add(buttonSpec, buttonView);

                // Update the button with the same orientation as the view header
                buttonView.ViewButton.Orientation = CalculateOrientation(DockerOrientation(viewDockerIndex),
                                                                         buttonSpec.GetOrientation(_redirector));

                buttonView.ViewCenter.Orientation = DockerOrientation(viewDockerIndex);

                // Insert the button view into the docker
                AddViewToDocker(viewDockerIndex, GetDockStyle(buttonSpec), buttonView.ViewCenter, (_viewMetrics != null));

                // Perform any last construction steps for button spec
                ButtonSpecCreated(buttonSpec, buttonView, viewDockerIndex);

                // Hook in to the button spec change event
                buttonSpec.ButtonSpecPropertyChanged += new PropertyChangedEventHandler(OnPropertyChanged);

                return(buttonView);
            }

            return(null);
        }