~ubuntu-branches/ubuntu/oneiric/nux/oneiric

« back to all changes in this revision

Viewing changes to Nux/SpinBox_Logic.h

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2010-11-18 19:17:32 UTC
  • Revision ID: james.westby@ubuntu.com-20101118191732-rn35790vekj6o4my
Tags: upstream-0.9.4
ImportĀ upstreamĀ versionĀ 0.9.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2010 Inalogic Inc.
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify it
 
5
 * under the terms of the GNU Lesser General Public License version 3, as
 
6
 * published by the  Free Software Foundation.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful, but
 
9
 * WITHOUT ANY WARRANTY; without even the implied warranties of
 
10
 * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
 
11
 * PURPOSE.  See the applicable version of the GNU Lesser General Public
 
12
 * License for more details.
 
13
 *
 
14
 * You should have received a copy of both the GNU Lesser General Public
 
15
 * License version 3 along with this program.  If not, see
 
16
 * <http://www.gnu.org/licenses/>
 
17
 *
 
18
 * Authored by: Jay Taoko <jay.taoko_AT_gmail_DOT_com>
 
19
 *
 
20
 */
 
21
 
 
22
 
 
23
#ifndef SPINBOX_LOGIC_H
 
24
#define SPINBOX_LOGIC_H
 
25
 
 
26
#include "EditTextBox.h"
 
27
#include "View.h"
 
28
 
 
29
namespace nux
 
30
{
 
31
 
 
32
  class SpinBox_Logic: public View
 
33
  {
 
34
  public:
 
35
    SpinBox_Logic (NUX_FILE_LINE_PROTO);
 
36
    virtual ~SpinBox_Logic();
 
37
 
 
38
    virtual long ProcessEvent (IEvent &ievent, long TraverseInfo, long ProcessEventInfo) = 0;
 
39
    virtual void Draw (GraphicsEngine &GfxContext, bool force_draw) = 0;
 
40
    virtual void DrawContent (GraphicsEngine &GfxContext, bool force_draw) = 0;
 
41
    virtual void PostDraw (GraphicsEngine &GfxContext, bool force_draw) = 0;
 
42
 
 
43
    //  RECEIVERS
 
44
    void RecvMouseMove (int x, int y, unsigned long button_flags, unsigned long key_flags);
 
45
    void RecvIncrement (int x, int y, unsigned long button_flags, unsigned long key_flags);
 
46
    void RecvDecrement (int x, int y, unsigned long button_flags, unsigned long key_flags);
 
47
    void TimerSpinUpBtn (void *v);
 
48
    void TimerSpinDownBtn (void *v);
 
49
    void RecvMouseDrag (int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
 
50
    void RecvMouseEnter (int x, int y, unsigned long button_flags, unsigned long key_flags);
 
51
    void RecvMouseLeave (int x, int y, unsigned long button_flags, unsigned long key_flags);
 
52
    /*
 
53
        The spinner buttons need to be redrawn when they are released.
 
54
        Their color may have changed when the mouse down was initiated.
 
55
        This receiver is going to initiate the redraw of the whole SpinBox_Logic.
 
56
    */
 
57
    void RecvSpinnerMouseUp (int x, int y, unsigned long button_flags, unsigned long key_flags);
 
58
    void RecvStartKeyboardFocus (EditTextBox *textbox);
 
59
    void RecvEndKeyboardFocus (EditTextBox *textbox);
 
60
    void RecvEscapeKeyboardFocus (EditTextBox *textbox);
 
61
    void RecvEditChange (EditTextBox *textbox);
 
62
    void RecvValidateEntry (EditTextBox *textbox);
 
63
 
 
64
    virtual void ImplementIncrementBtn() = 0;
 
65
    virtual void ImplementDecrementBtn() = 0;
 
66
    virtual void ImplementValidateEntry() = 0;
 
67
 
 
68
 
 
69
    //  SIGNALS
 
70
    sigc::signal<void> sigClick;
 
71
    sigc::signal<void> sigIncrement;
 
72
    sigc::signal<void> sigDecrement;
 
73
    sigc::signal<void> sigValueChanged;
 
74
    sigc::signal<void, int> sigIntValueChanged;
 
75
 
 
76
  protected:
 
77
    void InitializeWidgets();
 
78
    void InitializeLayout();
 
79
    void DestroyLayout();
 
80
 
 
81
  protected:
 
82
    EditTextBox    *m_EditLine;
 
83
    CoreArea       *m_SpinnerUpBtn;
 
84
    CoreArea       *m_SpinnerDownBtn;
 
85
 
 
86
    TimerFunctor *m_UpTimerCallback;
 
87
    TimerFunctor *m_DownTimerCallback;
 
88
    TimerHandle m_UpTimerHandler;
 
89
    TimerHandle m_DownTimerHandler;
 
90
  };
 
91
 
 
92
}
 
93
 
 
94
#endif // SPINBOX_LOGIC_H