Develop and Download Open Source Software

Browse CVS Repository

Diff of /malonnote/mnTextCtrl.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1 by maloninc, Thu Aug 11 07:19:39 2005 UTC revision 1.2 by maloninc, Sat Aug 13 02:00:29 2005 UTC
# Line 6  END_EVENT_TABLE() Line 6  END_EVENT_TABLE()
6    
7  void mnTextCtrl::handleKeyDown(wxKeyEvent& event)  void mnTextCtrl::handleKeyDown(wxKeyEvent& event)
8  {  {
9    #ifdef __WXMSW__
10            MSW_handleKeyDown(event);
11    #endif
12    
13    #ifdef __WXMAC__
14            MAC_handleKeyDown(event);
15    #endif
16    
17    #ifdef __WXGTK__
18            GTK_handleKeyDown(event);
19    #endif
20    }
21    
22    void mnTextCtrl::MSW_handleKeyDown(wxKeyEvent& event)
23    {
24          long pos, x, y, oldY;          long pos, x, y, oldY;
25          bool isLineUp   = FALSE;          bool isLineUp   = FALSE;
26          bool isLineDown = FALSE;          bool isLineDown = FALSE;
# Line 75  void mnTextCtrl::handleKeyDown(wxKeyEven Line 90  void mnTextCtrl::handleKeyDown(wxKeyEven
90          }          }
91          event.Skip();          event.Skip();
92  }  }
93    
94    void mnTextCtrl::MAC_handleKeyDown(wxKeyEvent& event)
95    {
96            long pos, x, y;
97    
98            if(event.ControlDown()) {
99                    pos = GetInsertionPoint();
100                    PositionToXY(pos, &x, &y);
101                    
102                    switch(event.GetKeyCode()){
103                            case 'N':  // Next line
104                                    y++;
105                                    x-=1;
106                                    break;
107    
108                            case 'P':  // Previous line
109                                    y--;
110                                    x-=1;
111                                    break;
112    
113                            case 'F':  // Forward
114                                    x+=0;
115                                    break;
116    
117                            case 'B':  // Backward
118                                    x-=2;
119                                    break;
120    
121                            case 'E':  // End of line
122                                    x = GetLineLength(y);
123                                    break;
124    
125                            case 'A':  // Begin of line
126                                    x = 0;
127                                    break;
128    
129                            case 'H':  // Backspace
130                                    Remove(pos-1, pos);
131                                    x-=2;
132                                    break;
133    
134                            case 'D':  // Delete
135                                    Remove(pos, pos+1);
136                                    x-=1;
137                                    break;
138    
139                            default:
140                                    event.Skip();
141                                    return;
142                    }
143    
144                    pos = XYToPosition(x, y);
145                    SetInsertionPoint(pos);
146                    return;
147            }
148            event.Skip();
149    }
150    
151    void mnTextCtrl::GTK_handleKeyDown(wxKeyEvent& event)
152    {
153            event.Skip();
154    }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26