Skip to content
This repository was archived by the owner on Sep 4, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .project
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>full,incremental,</triggers>
<triggers>clean,full,incremental,</triggers>
<arguments>
<dictionary>
<key>?name?</key>
Expand Down
406 changes: 203 additions & 203 deletions LICENSE

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
TouchControlOverlay
Copyright (c) 2011 Research In Motion Limited.
This product includes software developed at
Research In Motion Limited (http://www.rim.com/).
TouchControlOverlay
Copyright (c) 2011 Research In Motion Limited.

This product includes software developed at
Research In Motion Limited (http://www.rim.com/).
90 changes: 45 additions & 45 deletions inc/configwindow.h
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
/*
* Copyright (c) 2011 Research In Motion Limited.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef CONFIGWINDOW_H_
#define CONFIGWINDOW_H_
#include <screen/screen.h>
#include "window.h"
class Control;
class TCOContext;
class ConfigWindow : public EmulationWindow
{
public:
static ConfigWindow *createConfigWindow(screen_context_t context, screen_window_t parent=0);
void runEventLoop(TCOContext *emuContext);
protected:
ConfigWindow(screen_context_t screenContext, screen_window_t parent=0)
: EmulationWindow(screenContext, parent)
, m_selected(0)
{}
private:
screen_buffer_t draw(TCOContext *emuContext);
Control *m_selected;
};
#endif /* CONFIGWINDOW_H_ */
/*
* Copyright (c) 2011 Research In Motion Limited.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef CONFIGWINDOW_H_
#define CONFIGWINDOW_H_

#include <screen/screen.h>
#include "window.h"

class Control;
class TCOContext;

class ConfigWindow : public EmulationWindow
{
public:
static ConfigWindow *createConfigWindow(screen_context_t context, screen_window_t parent=0);

void runEventLoop(TCOContext *emuContext);

protected:
ConfigWindow(screen_context_t screenContext, screen_window_t parent=0)
: EmulationWindow(screenContext, parent)
, m_selected(0)
{}

private:
screen_buffer_t draw(TCOContext *emuContext);

Control *m_selected;
};

#endif /* CONFIGWINDOW_H_ */
168 changes: 84 additions & 84 deletions inc/control.h
Original file line number Diff line number Diff line change
@@ -1,84 +1,84 @@
/*
* Copyright (c) 2011 Research In Motion Limited.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef CONTROL_H_
#define CONTROL_H_
#include <screen/screen.h>
#include <vector>
class EventDispatcher;
class Label;
class Control
{
public:
enum ControlType {
KEY, // Used to provide keyboard input
DPAD, // Provides angle and magnitude from center (0 east, 90 north, 180 west, 270 south)
TOUCHAREA, // Used to provide relative mouse motion
MOUSEBUTTON, // Used to provide mouse button state
TOUCHSCREEN // Provides: mouse move, left click tap and right click tap-hold
};
Control(screen_context_t context, ControlType type,
int x, int y, unsigned width, unsigned height,
EventDispatcher *dispatcher, EventDispatcher *tapDispatcher=0);
~Control();
void fill();
bool loadFromPNG(const char *filename);
void draw(screen_buffer_t buffer) const;
bool handleTouch(int type, int contactId, const int pos[], long long timestamp);
bool handleTap(int contactId, const int pos[]);
bool handlesTap() const { return m_tapDispatcher != 0; }
bool inBounds(const int pos[]) const;
void move(int dx, int dy, unsigned maxDimensions[]);
void showLabel(screen_window_t window);
void addLabel(Label *label);
private:
ControlType m_type;
int m_x;
int m_y;
unsigned m_width;
unsigned m_height;
unsigned m_srcWidth;
unsigned m_srcHeight;
EventDispatcher *m_dispatcher;
EventDispatcher *m_tapDispatcher;
screen_context_t m_context;
screen_pixmap_t m_pixmap;
screen_buffer_t m_buffer;
int m_contactId;
// For touch areas
int m_lastPos[2];
long long m_touchDownTime;
// For touch screens
int m_startPos[2];
long long m_touchScreenStartTime;
bool m_touchScreenInMoveEvent;
bool m_touchScreenInHoldEvent;
std::vector<Label *> m_labels;
};
#endif /* CONTROL_H_ */
/*
* Copyright (c) 2011 Research In Motion Limited.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef CONTROL_H_
#define CONTROL_H_

#include <screen/screen.h>
#include <vector>

class EventDispatcher;
class Label;

class Control
{
public:
enum ControlType {
KEY, // Used to provide keyboard input
DPAD, // Provides angle and magnitude from center (0 east, 90 north, 180 west, 270 south)
TOUCHAREA, // Used to provide relative mouse motion
MOUSEBUTTON, // Used to provide mouse button state
TOUCHSCREEN // Provides: mouse move, left click tap and right click tap-hold
};

Control(screen_context_t context, ControlType type,
int x, int y, unsigned width, unsigned height,
EventDispatcher *dispatcher, EventDispatcher *tapDispatcher=0);
~Control();
void fill();
bool loadFromPNG(const char *filename);

void draw(screen_buffer_t buffer) const;
bool handleTouch(int type, int contactId, const int pos[], long long timestamp);
bool handleTap(int contactId, const int pos[]);
bool handlesTap() const { return m_tapDispatcher != 0; }
bool inBounds(const int pos[]) const;
void move(int dx, int dy, unsigned maxDimensions[]);

void showLabel(screen_window_t window);
void addLabel(Label *label);

private:

ControlType m_type;
int m_x;
int m_y;
unsigned m_width;
unsigned m_height;
unsigned m_srcWidth;
unsigned m_srcHeight;
EventDispatcher *m_dispatcher;
EventDispatcher *m_tapDispatcher;

screen_context_t m_context;
screen_pixmap_t m_pixmap;
screen_buffer_t m_buffer;

int m_contactId;

// For touch areas
int m_lastPos[2];
long long m_touchDownTime;

// For touch screens
int m_startPos[2];
long long m_touchScreenStartTime;
bool m_touchScreenInMoveEvent;
bool m_touchScreenInHoldEvent;

std::vector<Label *> m_labels;
};
#endif /* CONTROL_H_ */
68 changes: 34 additions & 34 deletions inc/controlfactory.h
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
/*
* Copyright (c) 2011 Research In Motion Limited.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef CONTROLFACTORY_H_
#define CONTROLFACTORY_H_
#include <sstream>
#include <screen/screen.h>
#include <libxml/tree.h>
class Control;
class TCOContext;
class ControlFactory
{
public:
static Control *createControl(TCOContext *context, int type, int x, int y, int w, int h, std::stringstream &ss);
static Control *createControl(TCOContext *context, xmlNode *node);
};
#endif /* CONTROLFACTORY_H_ */
/*
* Copyright (c) 2011 Research In Motion Limited.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef CONTROLFACTORY_H_
#define CONTROLFACTORY_H_

#include <sstream>
#include <screen/screen.h>
#include <libxml/tree.h>

class Control;
class TCOContext;

class ControlFactory
{
public:
static Control *createControl(TCOContext *context, int type, int x, int y, int w, int h, std::stringstream &ss);
static Control *createControl(TCOContext *context, xmlNode *node);
};

#endif /* CONTROLFACTORY_H_ */
Loading