本文整理汇总了C++中PasteClip::SetAction方法的典型用法代码示例。如果您正苦于以下问题:C++ PasteClip::SetAction方法的具体用法?C++ PasteClip::SetAction怎么用?C++ PasteClip::SetAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PasteClip
的用法示例。
在下文中一共展示了PasteClip::SetAction方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
}
示例2: AcceptFiles
bool AcceptFiles(PasteClip& clip)
{
if(clip.Accept("files")) {
clip.SetAction(DND_COPY);
return true;
}
return false;
}
示例3: 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();
}
}
示例4: DropWatch
void Pdb::DropWatch(PasteClip& clip)
{
String s = StringStream(GetString(clip)).GetLine();
if(s.GetCount()) {
watches.Add(s);
clip.SetAction(DND_COPY);
Data();
}
}
示例5: DropSum
void DropSum(int ii, PasteClip& d) {
if(AcceptInternal<ColumnList>(d, "mydrag")) {
const ColumnList& src = GetInternal<ColumnList>(d);
int sum = 0;
for(int i = 0; i < src.GetCount(); i++)
if(src.IsSel(i))
sum += atoi(~String(src[i]));
list.Set(ii, AsString(sum));
d.SetAction(DND_COPY);
list.SetCursor(ii);
}
}