summaryrefslogtreecommitdiff
path: root/frontends/windows/pointers.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2016-05-05 22:28:51 +0100
committerVincent Sanders <vince@kyllikki.org>2016-05-15 13:44:34 +0100
commitd21447d096a320a08b3efb2b8768fad0dcdcfd64 (patch)
tree1a83814b7c9e94b2f13c473261f23dd3a17dee64 /frontends/windows/pointers.c
parent2cbb337756d9af5bda4d594964d446439f602551 (diff)
downloadnetsurf-d21447d096a320a08b3efb2b8768fad0dcdcfd64.tar.gz
netsurf-d21447d096a320a08b3efb2b8768fad0dcdcfd64.tar.bz2
move frontends into sub directory
Diffstat (limited to 'frontends/windows/pointers.c')
-rw-r--r--frontends/windows/pointers.c128
1 files changed, 128 insertions, 0 deletions
diff --git a/frontends/windows/pointers.c b/frontends/windows/pointers.c
new file mode 100644
index 000000000..b5b74545d
--- /dev/null
+++ b/frontends/windows/pointers.c
@@ -0,0 +1,128 @@
+/*
+ * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdbool.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <windows.h>
+
+#include "utils/errors.h"
+#include "utils/nsurl.h"
+#include "utils/log.h"
+#include "utils/utils.h"
+#include "utils/corestrings.h"
+#include "utils/url.h"
+#include "utils/file.h"
+#include "desktop/browser.h"
+#include "desktop/gui_clipboard.h"
+
+#include "windows/schedule.h"
+#include "windows/window.h"
+#include "windows/filetype.h"
+#include "windows/pointers.h"
+
+struct nsws_pointers {
+ HCURSOR hand;
+ HCURSOR ibeam;
+ HCURSOR cross;
+ HCURSOR sizeall;
+ HCURSOR sizewe;
+ HCURSOR sizens;
+ HCURSOR sizenesw;
+ HCURSOR sizenwse;
+ HCURSOR wait;
+ HCURSOR appstarting;
+ HCURSOR no;
+ HCURSOR help;
+ HCURSOR arrow;
+};
+
+/** pre loaded pointer cursors */
+static struct nsws_pointers nsws_pointer;
+
+/* exported interface documented in windows/pointers.h */
+void nsws_window_init_pointers(HINSTANCE hinstance)
+{
+ nsws_pointer.hand = LoadCursor(NULL, IDC_HAND);
+ nsws_pointer.ibeam = LoadCursor(NULL, IDC_IBEAM);
+ nsws_pointer.cross = LoadCursor(NULL, IDC_CROSS);
+ nsws_pointer.sizeall = LoadCursor(NULL, IDC_SIZEALL);
+ nsws_pointer.sizewe = LoadCursor(NULL, IDC_SIZEWE);
+ nsws_pointer.sizens = LoadCursor(NULL, IDC_SIZENS);
+ nsws_pointer.sizenesw = LoadCursor(NULL, IDC_SIZENESW);
+ nsws_pointer.sizenwse = LoadCursor(NULL, IDC_SIZENWSE);
+ nsws_pointer.wait = LoadCursor(NULL, IDC_WAIT);
+ nsws_pointer.appstarting = LoadCursor(NULL, IDC_APPSTARTING);
+ nsws_pointer.no = LoadCursor(NULL, IDC_NO);
+ nsws_pointer.help = LoadCursor(NULL, IDC_HELP);
+ nsws_pointer.arrow = LoadCursor(NULL, IDC_ARROW);
+}
+
+/* exported interface documented in windows/pointers.h */
+HCURSOR nsws_get_pointer(gui_pointer_shape shape)
+{
+ switch (shape) {
+ case GUI_POINTER_POINT: /* link */
+ case GUI_POINTER_MENU:
+ return nsws_pointer.hand;
+
+ case GUI_POINTER_CARET: /* input */
+ return nsws_pointer.ibeam;
+
+ case GUI_POINTER_CROSS:
+ return nsws_pointer.cross;
+
+ case GUI_POINTER_MOVE:
+ return nsws_pointer.sizeall;
+
+ case GUI_POINTER_RIGHT:
+ case GUI_POINTER_LEFT:
+ return nsws_pointer.sizewe;
+
+ case GUI_POINTER_UP:
+ case GUI_POINTER_DOWN:
+ return nsws_pointer.sizens;
+
+ case GUI_POINTER_RU:
+ case GUI_POINTER_LD:
+ return nsws_pointer.sizenesw;
+
+ case GUI_POINTER_RD:
+ case GUI_POINTER_LU:
+ return nsws_pointer.sizenwse;
+
+ case GUI_POINTER_WAIT:
+ return nsws_pointer.wait;
+
+ case GUI_POINTER_PROGRESS:
+ return nsws_pointer.appstarting;
+
+ case GUI_POINTER_NO_DROP:
+ case GUI_POINTER_NOT_ALLOWED:
+ return nsws_pointer.no;
+
+ case GUI_POINTER_HELP:
+ return nsws_pointer.help;
+
+ default:
+ break;
+ }
+
+ return nsws_pointer.arrow;
+}