1 /* 2 * aui_controls.h 3 * PHD Guiding 4 * 5 * Created by Bruce Waddington 6 * Copyright (c) 2016-2017 Bruce Waddington and Andy Galasso 7 * All rights reserved. 8 * 9 * This source code is distributed under the following "BSD" license 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions are met: 12 * Redistributions of source code must retain the above copyright notice, 13 * this list of conditions and the following disclaimer. 14 * Redistributions in binary form must reproduce the above copyright notice, 15 * this list of conditions and the following disclaimer in the 16 * documentation and/or other materials provided with the distribution. 17 * Neither the name of Bret McKee, Dad Dog Development, 18 * Craig Stark, Stark Labs nor the names of its 19 * contributors may be used to endorse or promote products derived from 20 * this software without specific prior written permission. 21 * 22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 26 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 * POSSIBILITY OF SUCH DAMAGE. 33 * 34 */ 35 36 #ifndef _AUI_CONTROLS_H_ 37 #define _AUI_CONTROLS_H_ 38 39 class SBPanel; 40 class SBStateIndicators; 41 class SBStarIndicators; 42 class SBGuideIndicators; 43 44 // Child of normal status bar - used for status bar with color-coded messages and state indicators 45 class PHDStatusBar : public wxStatusBar 46 { 47 SBPanel *m_ctrlPanel; 48 SBStateIndicators *m_StateIndicators; 49 SBStarIndicators *m_StarIndicators; 50 SBGuideIndicators *m_GuideIndicators; 51 wxStaticText *m_Msg1; 52 53 PHDStatusBar(wxWindow *parent, long style = wxSTB_DEFAULT_STYLE); 54 virtual ~PHDStatusBar(); 55 56 public: 57 static PHDStatusBar *CreateInstance(wxWindow *parent, long style = wxSTB_DEFAULT_STYLE); 58 59 void StatusMsg(const wxString& text); 60 61 void OverlayMsg(const wxString& text); 62 void ClearOverlayMsg(); 63 64 void UpdateStates(); 65 66 void UpdateStarInfo(double SNR, bool Saturated); ClearStarInfo()67 void ClearStarInfo() { UpdateStarInfo(-1, 0); } 68 69 void UpdateGuiderInfo(const GuideStepInfo& step); 70 void ClearGuiderInfo(); 71 72 int GetMinSBWidth(); 73 74 // event handlers 75 void OnSize(wxSizeEvent& event); 76 77 private: 78 wxDECLARE_EVENT_TABLE(); 79 }; 80 81 // Minor subclass to force the toolbar background to be what we want 82 class PHDToolBarArt : public wxAuiDefaultToolBarArt 83 { 84 virtual void DrawBackground(wxDC& dc, wxWindow *parent, const wxRect& rect); Clone()85 virtual wxAuiToolBarArt *Clone() { return new PHDToolBarArt(*this); } 86 }; 87 88 #endif // AUI_CONTROLS_H 89