本文整理汇总了C++中PasteClip::GetAction方法的典型用法代码示例。如果您正苦于以下问题:C++ PasteClip::GetAction方法的具体用法?C++ PasteClip::GetAction怎么用?C++ PasteClip::GetAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PasteClip
的用法示例。
在下文中一共展示了PasteClip::GetAction方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GtkDnd
PasteClip Ctrl::GtkDnd(GtkWidget *widget, GdkDragContext *context, gint x, gint y,
guint time, gpointer user_data, bool paste)
{
DndTargets(context);
g_object_ref(context); // make sure these always survive the action...
g_object_ref(widget);
dnd_context = context;
dnd_widget = widget;
dnd_time = time;
PasteClip clip;
clip.type = 1;
clip.paste = paste;
clip.accepted = false;
clip.allowed = DND_MOVE|DND_COPY;
gint dummy;
GdkModifierType mod;
gdk_window_get_pointer(gdk_get_default_root_window(), &dummy, &dummy, &mod);
clip.action = mod & GDK_CONTROL_MASK ? DND_COPY : DND_MOVE;
Ctrl *w = DragWnd(user_data);
if(w) {
gint mx, my;
GdkModifierType mod;
gdk_window_get_pointer(gdk_get_default_root_window(), &mx, &my, &mod);
CurrentState = mod;
CurrentMousePos = Point(x, y) + w->GetScreenRect().TopLeft();
w->DnD(CurrentMousePos, clip);
}
gdk_drag_status(context, clip.IsAccepted() ? clip.GetAction() == DND_MOVE ? GDK_ACTION_MOVE
: GDK_ACTION_COPY
: GdkDragAction(0), time);
return clip;
}
示例2: GtkDragDrop
gboolean Ctrl::GtkDragDrop(GtkWidget *widget, GdkDragContext *context, gint x, gint y,
guint time, gpointer user_data)
{
LLOG("GtkDragDrop");
PasteClip clip = GtkDnd(widget, context, x, y, time, user_data, true);
gtk_drag_finish(context, clip.IsAccepted(), clip.IsAccepted() && clip.GetAction() == DND_MOVE, time);
g_object_unref(widget);
g_object_unref(context);
DnDLeave();
return TRUE;
}
示例3: DnD
void DnDLoop::DnD(bool paste)
{
PasteClip d;
d.paste = paste;
d.accepted = false;
d.allowed = (byte)actions;
d.action = GetCtrl() ? DND_COPY : DND_MOVE;
d.dnd = true;
if(target)
target->DnD(GetMousePos(), d);
action = d.IsAccepted() ? d.GetAction() : DND_NONE;
}
示例4: DragAndDrop
void LineEdit::DragAndDrop(Point p, PasteClip& d)
{
if(IsReadOnly()) return;
int c = GetMousePos(p);
if(AcceptText(d)) {
NextUndo();
int a = sb.y;
int sell, selh;
WString text = GetWString(d);
if(GetSelection(sell, selh)) {
if(c >= sell && c < selh) {
if(!IsReadOnly())
RemoveSelection();
if(IsDragAndDropSource())
d.SetAction(DND_COPY);
c = sell;
}
else
if(d.GetAction() == DND_MOVE && IsDragAndDropSource()) {
if(c > sell)
c -= selh - sell;
if(!IsReadOnly())
RemoveSelection();
d.SetAction(DND_COPY);
}
}
int count = Insert(c, text);
sb.y = a;
SetFocus();
SetSelection(c, c + count);
Action();
return;
}
if(!d.IsAccepted()) return;
if(!isdrag) {
isdrag = true;
ScrollIntoCursor();
}
Point dc = Null;
if(c >= 0)
dc = GetColumnLine(c);
if(dc != dropcaret) {
RefreshDropCaret();
dropcaret = dc;
RefreshDropCaret();
}
}
示例5: DragAndDrop
void DocEdit::DragAndDrop(Point p, PasteClip& d)
{
if(IsReadOnly()) return;
int c = GetMousePos(p);
if(AcceptText(d)) {
NextUndo();
int a = sb;
int sell, selh;
WString txt = GetWString(d);
if(GetSelection(sell, selh)) {
if(c >= sell && c < selh) {
if(!IsReadOnly())
RemoveSelection();
if(IsDragAndDropSource())
d.SetAction(DND_COPY);
c = sell;
}
else
if(d.GetAction() == DND_MOVE && IsDragAndDropSource()) {
if(c > sell)
c -= selh - sell;
if(!IsReadOnly())
RemoveSelection();
d.SetAction(DND_COPY);
}
}
int count = Insert(c, txt);
sb = a;
SetFocus();
SetSelection(c, c + count);
Action();
return;
}
if(!d.IsAccepted()) return;
Point dc = Null;
if(c >= 0) {
Point cr = GetCaret(c);
dc = Point(cr.x + 1, cr.y);
}
if(dc != dropcaret) {
RefreshDropCaret();
dropcaret = dc;
RefreshDropCaret();
}
}