Darwin  1.10(beta)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
drwnStatusBar.h
1 /*****************************************************************************
2 ** DARWIN: A FRAMEWORK FOR MACHINE LEARNING RESEARCH AND DEVELOPMENT
3 ** Distributed under the terms of the BSD license (see the LICENSE file)
4 ** Copyright (c) 2007-2015, Stephen Gould
5 ** All rights reserved.
6 **
7 ******************************************************************************
8 ** FILENAME: drwnStatusBar.h
9 ** AUTHOR(S): Stephen Gould <stephen.gould@anu.edu.au>
10 ** DESCRIPTION:
11 ** Darwin statusbar class.
12 **
13 *****************************************************************************/
14 
15 #pragma once
16 
17 #include "wx/wx.h"
18 #include "wx/utils.h"
19 
20 #if !wxUSE_STATUSBAR
21  #error "You need to set wxUSE_STATUSBAR to 1"
22 #endif
23 
24 #include "drwnBase.h"
25 #include "drwnEngine.h"
26 
27 // drwnProgressBar -----------------------------------------------------------
28 
29 class drwnProgressBar : public wxWindow
30 {
31  protected:
32  wxBitmap *_bmpProgress;
33  int _progressLevel;
34  string _statusText;
35 
36  public:
37  drwnProgressBar(wxWindow *parent,
38  wxWindowID id = wxID_ANY,
39  const wxPoint& pos = wxDefaultPosition,
40  const wxSize& size = wxDefaultSize,
41  long style = wxDEFAULT_FRAME_STYLE | wxNO_BORDER,
42  const wxString& name = wxPanelNameStr);
43  ~drwnProgressBar();
44 
45  // update progress
46  void setProgress(double p);
47  void setStatusText(const char *s);
48 
49  // event handling
50  void on_erase_background(wxEraseEvent &event);
51  void on_paint(wxPaintEvent &event);
52  void on_size(wxSizeEvent &event);
53 
54  protected:
55  DECLARE_EVENT_TABLE()
56 };
57 
58 // drwnStatusBar --------------------------------------------------------------
59 
60 class drwnStatusBar : public wxStatusBar
61 {
62  protected:
63  static const int NUM_FIELDS;
64  drwnProgressBar *_progressBar;
65  wxStaticBitmap *_bmpDBNone;
66  wxStaticBitmap *_bmpDBConnected;
67 
68  public:
69  drwnStatusBar(wxWindow *parent);
70  virtual ~drwnStatusBar();
71 
72  // update status bar
73  void updateProgress(double p = 0.0);
74  void updateMemory(double m = 0.0);
75  void updateDatabase(const drwnDatabase *db);
76  void updateMessage(const wxString& msg);
77 
78  // event handling
79  void on_erase_background(wxEraseEvent &event);
80  void on_paint(wxPaintEvent &event);
81  void on_size(wxSizeEvent& event);
82 
83  private:
84  DECLARE_EVENT_TABLE()
85 };
Definition: drwnStatusBar.h:60
Definition: drwnStatusBar.h:29