comparison Framework/Widgets/TestWorldSceneWidget.cpp @ 327:8716176ff7f0 am-2

added support for arrow keys
author am@osimis.io
date Tue, 16 Oct 2018 15:25:21 +0200
parents 300d8b8c48b3
children 885f0a5eaa49
comparison
equal deleted inserted replaced
326:612238b3f3e8 327:8716176ff7f0
11 * 11 *
12 * This program is distributed in the hope that it will be useful, but 12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of 13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Affero General Public License for more details. 15 * Affero General Public License for more details.
16 * 16 *
17 * You should have received a copy of the GNU Affero General Public License 17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. 18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 **/ 19 **/
20 20
21 21
79 statusBar->SetMessage(direction == MouseWheelDirection_Down ? "Wheel down" : "Wheel up"); 79 statusBar->SetMessage(direction == MouseWheelDirection_Down ? "Wheel down" : "Wheel up");
80 } 80 }
81 } 81 }
82 82
83 virtual void KeyPressed(WorldSceneWidget& widget, 83 virtual void KeyPressed(WorldSceneWidget& widget,
84 char key, 84 KeyboardKeys key,
85 char keyChar,
85 KeyboardModifiers modifiers, 86 KeyboardModifiers modifiers,
86 IStatusBar* statusBar) 87 IStatusBar* statusBar)
87 { 88 {
88 if (statusBar) 89 if (statusBar)
89 { 90 {
90 statusBar->SetMessage("Key pressed: \"" + std::string(1, key) + "\""); 91 statusBar->SetMessage("Key pressed: \"" + std::string(1, keyChar) + "\"");
91 } 92 }
92 } 93 }
93 }; 94 };
94 95
95 96
96 bool TestWorldSceneWidget::RenderScene(CairoContext& context, 97 bool TestWorldSceneWidget::RenderScene(CairoContext& context,
97 const ViewportGeometry& view) 98 const ViewportGeometry& view)
98 { 99 {
99 cairo_t* cr = context.GetObject(); 100 cairo_t* cr = context.GetObject();
100 101
101 // Clear background 102 // Clear background
102 cairo_set_source_rgb(cr, 0, 0, 0); 103 cairo_set_source_rgb(cr, 0, 0, 0);