from pyunicon.UCScreen import UCScreen
from pyunicon.util import UCMouseKey
from util.UCFactory import UCFactory

__author__ = 'cansik'


class UCMouse(object):
    def __init__(self):
        self.__mouse = UCFactory.get_mouse()
        self.__screen = UCScreen()

    def move(self, x, y):
        width, height = self.__screen.get_size()

        # check bounds
        x = min(width - 1, max(0, x))
        y = min(height - 1, max(0, y))

        self.__mouse.move(x, y)

    def move_relative(self, dx, dy):
        x, y = self.get_position()
        self.move(x + dx, y + dy)

    def get_position(self):
        return self.__mouse.get_position()

    def press(self, mouse_key):
        self.__mouse.press(mouse_key)

    def release(self, mouse_key):
        self.__mouse.release(mouse_key)

    def click(self, mouse_key):
        self.__mouse.press(mouse_key)
        self.__mouse.release(mouse_key)

    def click_left(self):
        self.click(UCMouseKey.UC_MOUSE_LEFT)

    def click_right(self):
        self.click(UCMouseKey.UC_MOUSE_RIGHT)
236cd74a93dd97697ae82a54fd1a8d0ee0e9b116
<mask token>


class UCMouse(object):
    <mask token>

    def move(self, x, y):
        width, height = self.__screen.get_size()
        x = min(width - 1, max(0, x))
        y = min(height - 1, max(0, y))
        self.__mouse.move(x, y)

    def move_relative(self, dx, dy):
        x, y = self.get_position()
        self.move(x + dx, y + dy)

    def get_position(self):
        return self.__mouse.get_position()
    <mask token>

    def release(self, mouse_key):
        self.__mouse.release(mouse_key)
    <mask token>

    def click_left(self):
        self.click(UCMouseKey.UC_MOUSE_LEFT)

    def click_right(self):
        self.click(UCMouseKey.UC_MOUSE_RIGHT)

<mask token>


class UCMouse(object):
    <mask token>

    def move(self, x, y):
        width, height = self.__screen.get_size()
        x = min(width - 1, max(0, x))
        y = min(height - 1, max(0, y))
        self.__mouse.move(x, y)

    def move_relative(self, dx, dy):
        x, y = self.get_position()
        self.move(x + dx, y + dy)

    def get_position(self):
        return self.__mouse.get_position()
    <mask token>

    def release(self, mouse_key):
        self.__mouse.release(mouse_key)

    def click(self, mouse_key):
        self.__mouse.press(mouse_key)
        self.__mouse.release(mouse_key)

    def click_left(self):
        self.click(UCMouseKey.UC_MOUSE_LEFT)

    def click_right(self):
        self.click(UCMouseKey.UC_MOUSE_RIGHT)

<mask token>
__author__ = 'cansik'


class UCMouse(object):

    def __init__(self):
        self.__mouse = UCFactory.get_mouse()
        self.__screen = UCScreen()

    def move(self, x, y):
        width, height = self.__screen.get_size()
        x = min(width - 1, max(0, x))
        y = min(height - 1, max(0, y))
        self.__mouse.move(x, y)

    def move_relative(self, dx, dy):
        x, y = self.get_position()
        self.move(x + dx, y + dy)

    def get_position(self):
        return self.__mouse.get_position()

    def press(self, mouse_key):
        self.__mouse.press(mouse_key)

    def release(self, mouse_key):
        self.__mouse.release(mouse_key)

    def click(self, mouse_key):
        self.__mouse.press(mouse_key)
        self.__mouse.release(mouse_key)

    def click_left(self):
        self.click(UCMouseKey.UC_MOUSE_LEFT)

    def click_right(self):
        self.click(UCMouseKey.UC_MOUSE_RIGHT)

from pyunicon.UCScreen import UCScreen
from pyunicon.util import UCMouseKey
from util.UCFactory import UCFactory
__author__ = 'cansik'


class UCMouse(object):

    def __init__(self):
        self.__mouse = UCFactory.get_mouse()
        self.__screen = UCScreen()

    def move(self, x, y):
        width, height = self.__screen.get_size()
        x = min(width - 1, max(0, x))
        y = min(height - 1, max(0, y))
        self.__mouse.move(x, y)

    def move_relative(self, dx, dy):
        x, y = self.get_position()
        self.move(x + dx, y + dy)

    def get_position(self):
        return self.__mouse.get_position()

    def press(self, mouse_key):
        self.__mouse.press(mouse_key)

    def release(self, mouse_key):
        self.__mouse.release(mouse_key)

    def click(self, mouse_key):
        self.__mouse.press(mouse_key)
        self.__mouse.release(mouse_key)

    def click_left(self):
        self.click(UCMouseKey.UC_MOUSE_LEFT)

    def click_right(self):
        self.click(UCMouseKey.UC_MOUSE_RIGHT)

from pyunicon.UCScreen import UCScreen
from pyunicon.util import UCMouseKey
from util.UCFactory import UCFactory

__author__ = 'cansik'


class UCMouse(object):
    def __init__(self):
        self.__mouse = UCFactory.get_mouse()
        self.__screen = UCScreen()

    def move(self, x, y):
        width, height = self.__screen.get_size()

        # check bounds
        x = min(width - 1, max(0, x))
        y = min(height - 1, max(0, y))

        self.__mouse.move(x, y)

    def move_relative(self, dx, dy):
        x, y = self.get_position()
        self.move(x + dx, y + dy)

    def get_position(self):
        return self.__mouse.get_position()

    def press(self, mouse_key):
        self.__mouse.press(mouse_key)

    def release(self, mouse_key):
        self.__mouse.release(mouse_key)

    def click(self, mouse_key):
        self.__mouse.press(mouse_key)
        self.__mouse.release(mouse_key)

    def click_left(self):
        self.click(UCMouseKey.UC_MOUSE_LEFT)

    def click_right(self):
        self.click(UCMouseKey.UC_MOUSE_RIGHT)