mirror of
https://github.com/aseprite/aseprite.git
synced 2024-09-02 21:19:10 +00:00
Add simple crosshair using native mouse cursors (fix #1236)
This commit is contained in:
parent
891e660355
commit
bebbd71d31
@ -77,6 +77,10 @@
|
|||||||
<value id="HORIZONTAL" value="1" />
|
<value id="HORIZONTAL" value="1" />
|
||||||
<value id="VERTICAL" value="2" />
|
<value id="VERTICAL" value="2" />
|
||||||
</enum>
|
</enum>
|
||||||
|
<enum id="PaintingCursorType">
|
||||||
|
<value id="SIMPLE_CROSSHAIR" value="0" />
|
||||||
|
<value id="CROSSHAIR_ON_SPRITE" value="1" />
|
||||||
|
</enum>
|
||||||
</types>
|
</types>
|
||||||
|
|
||||||
<global>
|
<global>
|
||||||
@ -110,6 +114,7 @@
|
|||||||
<option id="use_native_cursor" type="bool" default="false" migrate="experimental.use_native_cursor" />
|
<option id="use_native_cursor" type="bool" default="false" migrate="experimental.use_native_cursor" />
|
||||||
<option id="cursor_scale" type="int" default="1" />
|
<option id="cursor_scale" type="int" default="1" />
|
||||||
<option id="cursor_color" type="app::Color" default="app::Color::fromMask()" migrate="editor.cursor_color" />
|
<option id="cursor_color" type="app::Color" default="app::Color::fromMask()" migrate="editor.cursor_color" />
|
||||||
|
<option id="painting_cursor_type" type="PaintingCursorType" default="PaintingCursorType::CROSSHAIR_ON_SPRITE" />
|
||||||
<option id="brush_preview" type="BrushPreview" default="BrushPreview::FULL" migrate="editor.brush_preview" />
|
<option id="brush_preview" type="BrushPreview" default="BrushPreview::FULL" migrate="editor.brush_preview" />
|
||||||
</section>
|
</section>
|
||||||
<section id="preview" text="Preview">
|
<section id="preview" text="Preview">
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
@ -109,6 +109,7 @@
|
|||||||
<cursors>
|
<cursors>
|
||||||
<cursor id="normal" x="80" y="0" w="16" h="16" focusx="0" focusy="0" />
|
<cursor id="normal" x="80" y="0" w="16" h="16" focusx="0" focusy="0" />
|
||||||
<cursor id="normal_add" x="80" y="16" w="16" h="16" focusx="0" focusy="0" />
|
<cursor id="normal_add" x="80" y="16" w="16" h="16" focusx="0" focusy="0" />
|
||||||
|
<cursor id="crosshair" x="96" y="32" w="16" h="16" focusx="7" focusy="7" />
|
||||||
<cursor id="forbidden" x="80" y="32" w="16" h="16" focusx="0" focusy="0" />
|
<cursor id="forbidden" x="80" y="32" w="16" h="16" focusx="0" focusy="0" />
|
||||||
<cursor id="hand" x="80" y="48" w="16" h="16" focusx="5" focusy="3" />
|
<cursor id="hand" x="80" y="48" w="16" h="16" focusx="5" focusy="3" />
|
||||||
<cursor id="scroll" x="80" y="64" w="16" h="16" focusx="8" focusy="8" />
|
<cursor id="scroll" x="80" y="64" w="16" h="16" focusx="8" focusy="8" />
|
||||||
|
@ -96,21 +96,30 @@
|
|||||||
</hbox>
|
</hbox>
|
||||||
|
|
||||||
<separator text="Painting Cursors" horizontal="true" />
|
<separator text="Painting Cursors" horizontal="true" />
|
||||||
<label text="Precise Cursor Color:" />
|
|
||||||
<hbox>
|
<grid columns="2">
|
||||||
|
<label text="Crosshair Type:" />
|
||||||
|
<combobox id="painting_cursor_type">
|
||||||
|
<listitem text="Simple Crosshair" value="0" />
|
||||||
|
<listitem text="Crosshair on Sprite" value="1" />
|
||||||
|
</combobox>
|
||||||
|
|
||||||
|
<label text="Brush Preview:" />
|
||||||
|
<combobox id="brush_preview">
|
||||||
|
<listitem text="None" value="0" />
|
||||||
|
<listitem text="Brush Edges" value="1" />
|
||||||
|
<listitem text="Full Real-time Brush Preview" value="2" />
|
||||||
|
</combobox>
|
||||||
|
|
||||||
|
<label text="Crosshair & Brush Edges Color:" />
|
||||||
<combobox group="1" id="cursor_color_type">
|
<combobox group="1" id="cursor_color_type">
|
||||||
<listitem text="Negative Black and White" value="0" />
|
<listitem text="Negative Black and White" value="0" />
|
||||||
<listitem text="Specific Color" value="1" />
|
<listitem text="Specific Color" value="1" />
|
||||||
</combobox>
|
</combobox>
|
||||||
<box id="cursor_color_placeholder" /><!-- custom widget -->
|
|
||||||
</hbox>
|
|
||||||
|
|
||||||
<label text="Brush Preview:" />
|
<boxfiller />
|
||||||
<combobox id="brush_preview">
|
<box id="cursor_color_placeholder" /><!-- custom widget -->
|
||||||
<listitem text="None" value="0" />
|
</grid>
|
||||||
<listitem text="Brush Edges" value="1" />
|
|
||||||
<listitem text="Full Real-time Brush Preview" value="2" />
|
|
||||||
</combobox>
|
|
||||||
</vbox>
|
</vbox>
|
||||||
|
|
||||||
<!-- Grid & background -->
|
<!-- Grid & background -->
|
||||||
|
@ -78,6 +78,7 @@ public:
|
|||||||
sectionListbox()->Change.connect(base::Bind<void>(&OptionsWindow::onChangeSection, this));
|
sectionListbox()->Change.connect(base::Bind<void>(&OptionsWindow::onChangeSection, this));
|
||||||
|
|
||||||
// Cursor
|
// Cursor
|
||||||
|
paintingCursorType()->setSelectedItemIndex(int(m_pref.cursor.paintingCursorType()));
|
||||||
cursorColorPlaceholder()->addChild(m_cursorColor);
|
cursorColorPlaceholder()->addChild(m_cursorColor);
|
||||||
|
|
||||||
if (m_cursorColor->getColor().getType() == app::Color::MaskType) {
|
if (m_cursorColor->getColor().getType() == app::Color::MaskType) {
|
||||||
@ -269,6 +270,7 @@ public:
|
|||||||
m_pref.editor.zoomWithSlide(slideZoom()->isSelected());
|
m_pref.editor.zoomWithSlide(slideZoom()->isSelected());
|
||||||
#endif
|
#endif
|
||||||
m_pref.editor.rightClickMode(static_cast<app::gen::RightClickMode>(rightClickBehavior()->getSelectedItemIndex()));
|
m_pref.editor.rightClickMode(static_cast<app::gen::RightClickMode>(rightClickBehavior()->getSelectedItemIndex()));
|
||||||
|
m_pref.cursor.paintingCursorType(static_cast<app::gen::PaintingCursorType>(paintingCursorType()->getSelectedItemIndex()));
|
||||||
m_pref.cursor.cursorColor(m_cursorColor->getColor());
|
m_pref.cursor.cursorColor(m_cursorColor->getColor());
|
||||||
m_pref.cursor.brushPreview(static_cast<app::gen::BrushPreview>(brushPreview()->getSelectedItemIndex()));
|
m_pref.cursor.brushPreview(static_cast<app::gen::BrushPreview>(brushPreview()->getSelectedItemIndex()));
|
||||||
m_pref.cursor.useNativeCursor(nativeCursor()->isSelected());
|
m_pref.cursor.useNativeCursor(nativeCursor()->isSelected());
|
||||||
|
@ -32,6 +32,9 @@
|
|||||||
#include "doc/layer.h"
|
#include "doc/layer.h"
|
||||||
#include "doc/primitives.h"
|
#include "doc/primitives.h"
|
||||||
#include "doc/site.h"
|
#include "doc/site.h"
|
||||||
|
#include "she/display.h"
|
||||||
|
#include "ui/manager.h"
|
||||||
|
#include "ui/system.h"
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
|
|
||||||
@ -39,8 +42,9 @@ using namespace doc;
|
|||||||
|
|
||||||
BrushPreview::BrushPreview(Editor* editor)
|
BrushPreview::BrushPreview(Editor* editor)
|
||||||
: m_editor(editor)
|
: m_editor(editor)
|
||||||
, m_type(CROSS)
|
, m_type(CROSSHAIR)
|
||||||
, m_onScreen(false)
|
, m_onScreen(false)
|
||||||
|
, m_withModifiedPixels(false)
|
||||||
, m_withRealPreview(false)
|
, m_withRealPreview(false)
|
||||||
, m_screenPosition(0, 0)
|
, m_screenPosition(0, 0)
|
||||||
, m_editorPosition(0, 0)
|
, m_editorPosition(0, 0)
|
||||||
@ -77,6 +81,9 @@ color_t BrushPreview::getBrushColor(Sprite* sprite, Layer* layer)
|
|||||||
// Draws the brush cursor in the specified absolute mouse position
|
// Draws the brush cursor in the specified absolute mouse position
|
||||||
// given in 'pos' param. Warning: You should clean the cursor before
|
// given in 'pos' param. Warning: You should clean the cursor before
|
||||||
// to use this routine with other editor.
|
// to use this routine with other editor.
|
||||||
|
//
|
||||||
|
// TODO the logic in this function is really complex, we should think
|
||||||
|
// a way to simplify all possibilities
|
||||||
void BrushPreview::show(const gfx::Point& screenPos)
|
void BrushPreview::show(const gfx::Point& screenPos)
|
||||||
{
|
{
|
||||||
if (m_onScreen)
|
if (m_onScreen)
|
||||||
@ -96,9 +103,8 @@ void BrushPreview::show(const gfx::Point& screenPos)
|
|||||||
|
|
||||||
// Get cursor color
|
// Get cursor color
|
||||||
const auto& pref = Preferences::instance();
|
const auto& pref = Preferences::instance();
|
||||||
app::Color app_cursor_color = pref.cursor.cursorColor();
|
app::Color appCursorColor = pref.cursor.cursorColor();
|
||||||
gfx::Color ui_cursor_color = color_utils::color_for_ui(app_cursor_color);
|
m_blackAndWhiteNegative = (appCursorColor.getType() == app::Color::MaskType);
|
||||||
m_blackAndWhiteNegative = (app_cursor_color.getType() == app::Color::MaskType);
|
|
||||||
|
|
||||||
// Cursor in the screen (view)
|
// Cursor in the screen (view)
|
||||||
m_screenPosition = screenPos;
|
m_screenPosition = screenPos;
|
||||||
@ -118,7 +124,7 @@ void BrushPreview::show(const gfx::Point& screenPos)
|
|||||||
color_t mask_index = sprite->transparentColor();
|
color_t mask_index = sprite->transparentColor();
|
||||||
|
|
||||||
if (ink->isSelection() || ink->isSlice()) {
|
if (ink->isSelection() || ink->isSlice()) {
|
||||||
m_type = SELECTION_CROSS;
|
m_type = SELECTION_CROSSHAIR;
|
||||||
}
|
}
|
||||||
else if (
|
else if (
|
||||||
(brush->type() == kImageBrushType ||
|
(brush->type() == kImageBrushType ||
|
||||||
@ -134,33 +140,43 @@ void BrushPreview::show(const gfx::Point& screenPos)
|
|||||||
m_type = BRUSH_BOUNDARIES;
|
m_type = BRUSH_BOUNDARIES;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_type = CROSS;
|
m_type = CROSSHAIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool usePreview = false;
|
bool showPreview = false;
|
||||||
|
|
||||||
auto brushPreview = pref.cursor.brushPreview();
|
auto brushPreview = pref.cursor.brushPreview();
|
||||||
if (!m_editor->docPref().show.brushPreview())
|
if (!m_editor->docPref().show.brushPreview())
|
||||||
brushPreview = app::gen::BrushPreview::NONE;
|
brushPreview = app::gen::BrushPreview::NONE;
|
||||||
|
|
||||||
switch (brushPreview) {
|
switch (brushPreview) {
|
||||||
case app::gen::BrushPreview::NONE:
|
case app::gen::BrushPreview::NONE:
|
||||||
m_type = CROSS;
|
m_type = CROSSHAIR;
|
||||||
break;
|
break;
|
||||||
case app::gen::BrushPreview::EDGES:
|
case app::gen::BrushPreview::EDGES:
|
||||||
m_type = BRUSH_BOUNDARIES;
|
m_type = BRUSH_BOUNDARIES;
|
||||||
break;
|
break;
|
||||||
case app::gen::BrushPreview::FULL:
|
case app::gen::BrushPreview::FULL:
|
||||||
usePreview = m_editor->getState()->requireBrushPreview();
|
showPreview = m_editor->getState()->requireBrushPreview();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_type & SELECTION_CROSSHAIR)
|
||||||
|
showPreview = false;
|
||||||
|
|
||||||
|
// Use a simple cross
|
||||||
|
if (pref.cursor.paintingCursorType() == gen::PaintingCursorType::SIMPLE_CROSSHAIR) {
|
||||||
|
m_type &= ~(CROSSHAIR | SELECTION_CROSSHAIR);
|
||||||
|
m_type |= NATIVE_CROSSHAIR;
|
||||||
|
}
|
||||||
|
|
||||||
// For cursor type 'bounds' we have to generate cursor boundaries
|
// For cursor type 'bounds' we have to generate cursor boundaries
|
||||||
if (m_type & BRUSH_BOUNDARIES)
|
if (m_type & BRUSH_BOUNDARIES) {
|
||||||
|
showPreview = false;
|
||||||
generateBoundaries();
|
generateBoundaries();
|
||||||
|
}
|
||||||
|
|
||||||
// Draw pixel/brush preview
|
// Draw pixel/brush preview
|
||||||
if ((m_type & CROSS) && usePreview) {
|
if (showPreview) {
|
||||||
gfx::Rect origBrushBounds = (isFloodfill ? gfx::Rect(0, 0, 1, 1): brush->bounds());
|
gfx::Rect origBrushBounds = (isFloodfill ? gfx::Rect(0, 0, 1, 1): brush->bounds());
|
||||||
gfx::Rect brushBounds = origBrushBounds;
|
gfx::Rect brushBounds = origBrushBounds;
|
||||||
brushBounds.offset(spritePos);
|
brushBounds.offset(spritePos);
|
||||||
@ -222,12 +238,16 @@ void BrushPreview::show(const gfx::Point& screenPos)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Save area and draw the cursor
|
// Save area and draw the cursor
|
||||||
{
|
if (!(m_type & NATIVE_CROSSHAIR) ||
|
||||||
|
(m_type & BRUSH_BOUNDARIES)) {
|
||||||
ui::ScreenGraphics g;
|
ui::ScreenGraphics g;
|
||||||
ui::SetClip clip(&g, gfx::Rect(0, 0, g.width(), g.height()));
|
ui::SetClip clip(&g, gfx::Rect(0, 0, g.width(), g.height()));
|
||||||
|
gfx::Color uiCursorColor = color_utils::color_for_ui(appCursorColor);
|
||||||
|
|
||||||
forEachBrushPixel(&g, m_screenPosition, spritePos, ui_cursor_color, &BrushPreview::savePixelDelegate);
|
forEachBrushPixel(&g, m_screenPosition, spritePos, uiCursorColor, &BrushPreview::savePixelDelegate);
|
||||||
forEachBrushPixel(&g, m_screenPosition, spritePos, ui_cursor_color, &BrushPreview::drawPixelDelegate);
|
forEachBrushPixel(&g, m_screenPosition, spritePos, uiCursorColor, &BrushPreview::drawPixelDelegate);
|
||||||
|
|
||||||
|
m_withModifiedPixels = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cursor in the editor (model)
|
// Cursor in the editor (model)
|
||||||
@ -236,6 +256,9 @@ void BrushPreview::show(const gfx::Point& screenPos)
|
|||||||
|
|
||||||
// Save the clipping-region to know where to clean the pixels
|
// Save the clipping-region to know where to clean the pixels
|
||||||
m_oldClippingRegion = m_clippingRegion;
|
m_oldClippingRegion = m_clippingRegion;
|
||||||
|
|
||||||
|
if (m_type & NATIVE_CROSSHAIR)
|
||||||
|
ui::set_mouse_cursor(ui::kCrosshairCursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cleans the brush cursor from the specified editor.
|
// Cleans the brush cursor from the specified editor.
|
||||||
@ -259,7 +282,7 @@ void BrushPreview::hide()
|
|||||||
m_clippingRegion.createSubtraction(m_clippingRegion,
|
m_clippingRegion.createSubtraction(m_clippingRegion,
|
||||||
m_editor->getUpdateRegion());
|
m_editor->getUpdateRegion());
|
||||||
|
|
||||||
{
|
if (m_withModifiedPixels) {
|
||||||
// Restore pixels
|
// Restore pixels
|
||||||
ui::ScreenGraphics g;
|
ui::ScreenGraphics g;
|
||||||
ui::SetClip clip(&g, gfx::Rect(0, 0, g.width(), g.height()));
|
ui::SetClip clip(&g, gfx::Rect(0, 0, g.width(), g.height()));
|
||||||
@ -347,10 +370,10 @@ void BrushPreview::forEachBrushPixel(
|
|||||||
{
|
{
|
||||||
m_savedPixelsIterator = 0;
|
m_savedPixelsIterator = 0;
|
||||||
|
|
||||||
if (m_type & CROSS)
|
if (m_type & CROSSHAIR)
|
||||||
traceCrossPixels(g, screenPos, color, pixelDelegate);
|
traceCrossPixels(g, screenPos, color, pixelDelegate);
|
||||||
|
|
||||||
if (m_type & SELECTION_CROSS)
|
if (m_type & SELECTION_CROSSHAIR)
|
||||||
traceSelectionCrossPixels(g, spritePos, color, 1, pixelDelegate);
|
traceSelectionCrossPixels(g, spritePos, color, 1, pixelDelegate);
|
||||||
|
|
||||||
if (m_type & BRUSH_BOUNDARIES)
|
if (m_type & BRUSH_BOUNDARIES)
|
||||||
@ -358,8 +381,10 @@ void BrushPreview::forEachBrushPixel(
|
|||||||
|
|
||||||
// Depending on the editor zoom, maybe we need subpixel movement (a
|
// Depending on the editor zoom, maybe we need subpixel movement (a
|
||||||
// little dot inside the active pixel)
|
// little dot inside the active pixel)
|
||||||
if (m_editor->zoom().scale() >= 4.0)
|
if (!(m_type & NATIVE_CROSSHAIR) &&
|
||||||
|
m_editor->zoom().scale() >= 4.0) {
|
||||||
(this->*pixelDelegate)(g, screenPos, color);
|
(this->*pixelDelegate)(g, screenPos, color);
|
||||||
|
}
|
||||||
|
|
||||||
m_savedPixelsLimit = m_savedPixelsIterator;
|
m_savedPixelsLimit = m_savedPixelsIterator;
|
||||||
}
|
}
|
||||||
@ -480,7 +505,7 @@ void BrushPreview::drawPixelDelegate(ui::Graphics* gfx, const gfx::Point& pt, gf
|
|||||||
if (m_savedPixelsIterator < (int)m_savedPixels.size() &&
|
if (m_savedPixelsIterator < (int)m_savedPixels.size() &&
|
||||||
m_clippingRegion.contains(pt)) {
|
m_clippingRegion.contains(pt)) {
|
||||||
if (m_blackAndWhiteNegative) {
|
if (m_blackAndWhiteNegative) {
|
||||||
int c = m_savedPixels[m_savedPixelsIterator++];
|
int c = m_savedPixels[m_savedPixelsIterator];
|
||||||
int r = gfx::getr(c);
|
int r = gfx::getr(c);
|
||||||
int g = gfx::getg(c);
|
int g = gfx::getg(c);
|
||||||
int b = gfx::getb(c);
|
int b = gfx::getb(c);
|
||||||
@ -490,6 +515,7 @@ void BrushPreview::drawPixelDelegate(ui::Graphics* gfx, const gfx::Point& pt, gf
|
|||||||
else {
|
else {
|
||||||
gfx->putPixel(color, pt.x, pt.y);
|
gfx->putPixel(color, pt.x, pt.y);
|
||||||
}
|
}
|
||||||
|
++m_savedPixelsIterator;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2001-2015 David Capello
|
// Copyright (C) 2001-2016 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
// the End-User License Agreement for Aseprite.
|
// the End-User License Agreement for Aseprite.
|
||||||
@ -37,9 +37,10 @@ namespace app {
|
|||||||
public:
|
public:
|
||||||
// Brush type
|
// Brush type
|
||||||
enum {
|
enum {
|
||||||
CROSS = 1,
|
CROSSHAIR = 1,
|
||||||
SELECTION_CROSS = 2,
|
SELECTION_CROSSHAIR = 2,
|
||||||
BRUSH_BOUNDARIES = 4,
|
BRUSH_BOUNDARIES = 4,
|
||||||
|
NATIVE_CROSSHAIR = 8,
|
||||||
};
|
};
|
||||||
|
|
||||||
BrushPreview(Editor* editor);
|
BrushPreview(Editor* editor);
|
||||||
@ -85,6 +86,7 @@ namespace app {
|
|||||||
|
|
||||||
// The brush preview is on the screen.
|
// The brush preview is on the screen.
|
||||||
bool m_onScreen;
|
bool m_onScreen;
|
||||||
|
bool m_withModifiedPixels;
|
||||||
bool m_withRealPreview;
|
bool m_withRealPreview;
|
||||||
gfx::Point m_screenPosition; // Position in the screen (view)
|
gfx::Point m_screenPosition; // Position in the screen (view)
|
||||||
gfx::Point m_editorPosition; // Position in the editor (model)
|
gfx::Point m_editorPosition; // Position in the editor (model)
|
||||||
|
@ -103,6 +103,7 @@ static const char* cursor_names[kCursorTypes] = {
|
|||||||
"null", // kNoCursor
|
"null", // kNoCursor
|
||||||
"normal", // kArrowCursor
|
"normal", // kArrowCursor
|
||||||
"normal_add", // kArrowPlusCursor
|
"normal_add", // kArrowPlusCursor
|
||||||
|
"crosshair", // kCrosshairCursor
|
||||||
"forbidden", // kForbiddenCursor
|
"forbidden", // kForbiddenCursor
|
||||||
"hand", // kHandCursor
|
"hand", // kHandCursor
|
||||||
"scroll", // kScrollCursor
|
"scroll", // kScrollCursor
|
||||||
|
@ -558,6 +558,7 @@ bool Alleg4Display::setNativeMouseCursor(NativeCursor cursor)
|
|||||||
newCursor = MOUSE_CURSOR_QUESTION;
|
newCursor = MOUSE_CURSOR_QUESTION;
|
||||||
break;
|
break;
|
||||||
#ifdef ALLEGRO4_WITH_EXTRA_CURSORS
|
#ifdef ALLEGRO4_WITH_EXTRA_CURSORS
|
||||||
|
case kCrosshairCursor: newCursor = MOUSE_CURSOR_CROSS; break;
|
||||||
case kForbiddenCursor: newCursor = MOUSE_CURSOR_FORBIDDEN; break;
|
case kForbiddenCursor: newCursor = MOUSE_CURSOR_FORBIDDEN; break;
|
||||||
case kMoveCursor: newCursor = MOUSE_CURSOR_MOVE; break;
|
case kMoveCursor: newCursor = MOUSE_CURSOR_MOVE; break;
|
||||||
case kLinkCursor: newCursor = MOUSE_CURSOR_LINK; break;
|
case kLinkCursor: newCursor = MOUSE_CURSOR_LINK; break;
|
||||||
|
@ -15,6 +15,7 @@ namespace she {
|
|||||||
enum NativeCursor {
|
enum NativeCursor {
|
||||||
kNoCursor,
|
kNoCursor,
|
||||||
kArrowCursor,
|
kArrowCursor,
|
||||||
|
kCrosshairCursor,
|
||||||
kIBeamCursor,
|
kIBeamCursor,
|
||||||
kWaitCursor,
|
kWaitCursor,
|
||||||
kLinkCursor,
|
kLinkCursor,
|
||||||
|
@ -120,6 +120,9 @@ using namespace she;
|
|||||||
case kSizeSWCursor:
|
case kSizeSWCursor:
|
||||||
nsCursor = [NSCursor arrowCursor];
|
nsCursor = [NSCursor arrowCursor];
|
||||||
break;
|
break;
|
||||||
|
case kCrosshairCursor:
|
||||||
|
nsCursor = [NSCursor crosshairCursor];
|
||||||
|
break;
|
||||||
case kIBeamCursor:
|
case kIBeamCursor:
|
||||||
nsCursor = [NSCursor IBeamCursor];
|
nsCursor = [NSCursor IBeamCursor];
|
||||||
break;
|
break;
|
||||||
|
@ -141,6 +141,9 @@ namespace she {
|
|||||||
case kArrowCursor:
|
case kArrowCursor:
|
||||||
hcursor = LoadCursor(NULL, IDC_ARROW);
|
hcursor = LoadCursor(NULL, IDC_ARROW);
|
||||||
break;
|
break;
|
||||||
|
case kCrosshairCursor:
|
||||||
|
hcursor = LoadCursor(NULL, IDC_CROSS);
|
||||||
|
break;
|
||||||
case kIBeamCursor:
|
case kIBeamCursor:
|
||||||
hcursor = LoadCursor(NULL, IDC_IBEAM);
|
hcursor = LoadCursor(NULL, IDC_IBEAM);
|
||||||
break;
|
break;
|
||||||
|
@ -17,6 +17,7 @@ namespace ui {
|
|||||||
kNoCursor = 0,
|
kNoCursor = 0,
|
||||||
kArrowCursor,
|
kArrowCursor,
|
||||||
kArrowPlusCursor,
|
kArrowPlusCursor,
|
||||||
|
kCrosshairCursor,
|
||||||
kForbiddenCursor,
|
kForbiddenCursor,
|
||||||
kHandCursor,
|
kHandCursor,
|
||||||
kScrollCursor,
|
kScrollCursor,
|
||||||
|
@ -111,6 +111,9 @@ static void update_mouse_cursor()
|
|||||||
case ui::kArrowPlusCursor:
|
case ui::kArrowPlusCursor:
|
||||||
nativeCursor = she::kArrowCursor;
|
nativeCursor = she::kArrowCursor;
|
||||||
break;
|
break;
|
||||||
|
case ui::kCrosshairCursor:
|
||||||
|
nativeCursor = she::kCrosshairCursor;
|
||||||
|
break;
|
||||||
case ui::kForbiddenCursor:
|
case ui::kForbiddenCursor:
|
||||||
nativeCursor = she::kForbiddenCursor;
|
nativeCursor = she::kForbiddenCursor;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user