Changeset 3644


Ignore:
Timestamp:
05/05/10 17:31:58 (12 years ago)
Author:
mkommend
Message:

added collapsed property for Sidebar class (ticket #972)

Location:
trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/DockForm.cs

    r3571 r3644  
    5353              break;
    5454          }
    55           if (view is Sidebar)
     55          Sidebar sidebar = view as Sidebar;
     56          if (sidebar != null) {
     57            if (sidebar.Collapsed)
     58              this.ShowHint = DockState.DockLeftAutoHide;
     59            else
     60              this.ShowHint = DockState.DockLeft;
    5661            this.DockAreas = DockAreas.DockLeft | DockAreas.DockRight;
     62          }
    5763
    5864          Type viewType = view.GetType();
     
    8490    }
    8591
     92    protected override void OnDockStateChanged(EventArgs e) {
     93      base.OnDockStateChanged(e);
     94      Sidebar sidebar = view as Sidebar;
     95      if (sidebar != null) {
     96        if (this.DockState == DockState.DockLeftAutoHide || this.DockState == DockState.DockRightAutoHide)
     97          sidebar.Collapsed = true;
     98        else
     99          sidebar.Collapsed = false;
     100      }
     101    }
     102
    86103    #region View Events
    87104    private void View_CaptionChanged(object sender, EventArgs e) {
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/SideBar.cs

    r3571 r3644  
    2828using System.Text;
    2929using System.Windows.Forms;
     30using WeifenLuo.WinFormsUI.Docking;
    3031
    3132namespace HeuristicLab.MainForm.WindowsForms {
     
    3334    public Sidebar() {
    3435      InitializeComponent();
     36    }
     37
     38    private bool collapsed;
     39    public bool Collapsed {
     40      get { return this.collapsed; }
     41      set {
     42        if (this.collapsed != value) {
     43          this.collapsed = value;
     44
     45          DockForm form = MainFormManager.GetMainForm<MainForm>().GetForm(this) as DockForm;
     46          if (form != null) {
     47            if (form.DockState == DockState.DockLeft || form.DockState == DockState.DockLeftAutoHide)
     48              form.DockState = collapsed ? DockState.DockLeftAutoHide : DockState.DockLeft;
     49            else if (form.DockState == DockState.DockRight || form.DockState == DockState.DockRightAutoHide)
     50              form.DockState = collapsed ? DockState.DockRightAutoHide : DockState.DockRight;
     51          }
     52
     53          this.OnCollapsedChanged();
     54        }
     55      }
     56    }
     57
     58    protected virtual void OnCollapsedChanged() {
    3559    }
    3660
Note: See TracChangeset for help on using the changeset viewer.