class_property(icon) = "<:ecere>controls/dropBox.png";
- watch(foreground)
- {
- listBox.foreground = foreground;
- };
- watch(background)
- {
- listBox.background = background;
- };
+ watch(foreground) { listBox.foreground = foreground; if(editBox) editBox.foreground = foreground; };
+ watch(background) { listBox.background = background; if(editBox) editBox.background = background; };
+ watch(selectionColor) { listBox.selectionColor = selectionColor; if(editBox) editBox.selectionColor = selectionColor; };
+ watch(selectionText) { listBox.selectionText = selectionText; if(editBox) editBox.selectionText = selectionText; };
+ watch(opacity) { listBox.opacity = opacity; if(editBox) editBox.opacity = opacity; };
public:
property bool activeStipple
{
- property_category $"Appearance"
+ property_category $"Appearance"
set
{
style.noStipple = !value;
};
property bool showButton
{
- property_category $"Appearance"
+ property_category $"Appearance"
set
{
button.visible = value;
};
property Alignment alignment
{
- property_category $"Appearance"
+ property_category $"Appearance"
set
{
alignment = value;
};
property bool noHighlight
{
- property_category $"Appearance"
+ property_category $"Appearance"
set
{
if(this)
};
property bool activeColor
{
- property_category $"Appearance"
+ property_category $"Appearance"
set
{
if(this)
};
property DataRow currentRow
{
- property_category $"Private"
+ property_category $"Private"
set
{
if(this)
{
char tempString[4096];
if(currentRow)
- editBox.contents = (char *)dataType._vTbl[__ecereVMethodID_class_OnGetString](dataType, currentRow.GetData(null), tempString, null, null);
+ editBox.contents = ((const char *(*)(void *, void *, char *, void *, bool *))(void *)dataType._vTbl[__ecereVMethodID_class_OnGetString])(dataType, currentRow.GetData(null), tempString, null, null);
else
editBox.contents = "";
- }
+ }
Update(null);
if(style.editText)
{
get { return currentRow; }
};
property DataRow firstRow { get { return this ? listBox.firstRow : null; } };
- property char * contents { property_category $"Data" set { if(editBox) editBox.contents = value; } get { return editBox ? editBox.contents : null; } };
+ property DataRow lastRow { get { return this ? listBox.lastRow : null; } };
+ property const char * contents { property_category $"Data" set { if(editBox) editBox.contents = value; } get { return editBox ? editBox.contents : null; } };
property bool editText
{
- property_category $"Behavior"
+ property_category $"Behavior"
set
{
if(this)
this, textHorzScroll = true, borderStyle = 0;
anchor = Anchor { left = 0, top = 0, right = BTN_WIDTH, bottom = 0 };
// visible = false, modifyVirtualArea = false;
+ foreground = foreground;
+ background = background;
+ selectionColor = selectionColor;
+ selectionText = selectionText;
};
incref editBox;
editBox.Create();
button.inactive = false;
- }
+ }
style.editText = true;
tabCycle = false;
}
property int rowHeight { property_category $"Appearance" set { listBox.rowHeight = value; } get { return listBox.rowHeight; } };
property int maxShown
{
- property_category $"Behavior"
+ property_category $"Behavior"
set
{
listBoxMaxShown = value;
get { return style.showNone; }
}
property Color selectionColor { set { selectionColor = value; } get { return selectionColor; } isset { return selectionColor ? true : false; } };
+ property Color selectionText { set { selectionText = value; } get { return selectionText; } isset { return selectionText ? true : false; } };
property bool changeContents
{
set { style.changeContents = value; }
property ListBox listBox { get { return listBox; } }
+ property int rowCount { get { return listBox.rowCount; } }
+
// Notifications
virtual bool Window::NotifySelect(DropBox dropBox, DataRow row, Modifiers mods);
virtual bool Window::NotifyClose(DropBox dropBox);
virtual bool Window::NotifyHighlight(DropBox dropBox, DataRow row, Modifiers mods);
- virtual bool Window::NotifyTextEntry(DropBox dropBox, char * string, bool confirmed);
+ virtual bool Window::NotifyTextEntry(DropBox dropBox, const char * string, bool confirmed);
virtual Window OnDropDown()
{
ResizeListbox();
// listBox.visible = true;
- return listBox;
+ return listBox;
}
virtual void OnCloseDropDown(Window pullDown)
}
// Methods
- DataRow AddStringf(char * format, ...)
+ DataRow AddStringf(const char * format, ...)
{
if(this)
{
return null;
}
- DataRow AddString(char * string)
+ DataRow AddString(const char * string)
{
if(this)
{
any_object GetData(DataField field)
{
- if(this)
- {
- // TODO: Fix this shouldn't be required (memguard?)
- return (void *)currentRow.GetData(field);
- }
- return null;
+ return this ? currentRow.GetData(field) : null;
}
void Sort(DataField field, int order)
{
if(!field)
field = DataField { alignment = alignment };
-
+
listBox.AddField(field);
this.field = listBox.firstField;
dataType = this.field.dataType;
return null;
}
- DataRow FindSubRow(int tag)
+ DataRow FindSubRow(int64 tag)
{
if(this)
{
{
char tempString[4096];
if(currentRow)
- editBox.contents = (char *)dataType._vTbl[__ecereVMethodID_class_OnGetString](dataType, currentRow.GetData(null), tempString, null, null);
+ editBox.contents = ((const char *(*)(void *, void *, char *, void *, bool *))(void *)dataType._vTbl[__ecereVMethodID_class_OnGetString])(dataType, currentRow.GetData(null), tempString, null, null);
else
editBox.contents = "";
- }
+ }
listBox.SelectRow(currentRow ? currentRow : (style.showNone ? noneRow : null));
Update(null);
if(ly + height > availHeight)
height = ((availHeight - ly) / ROW_HEIGHT) * ROW_HEIGHT;
}
-
+
if(!pulledWindow.initSize.w)
pulledWindow.size.w = size.w;
else
OnPosition(position.x, position.y, clientSize.w, clientSize.h);
if(pulledWindow) pulledWindow.visible = true;
button.checked = true;
- }
- Update(null);
+ }
+ Update(null);
return false;
case enter:
case keyPadEnter:
pulledWindow = null;
button.checked = false;
Update(null);
-
+
if(!NotifyClose(master, this))
{
delete this;
{
char tempString[4096];
if(currentRow)
- editBox.contents = (char *)dataType._vTbl[__ecereVMethodID_class_OnGetString](dataType, currentRow.GetData(null), tempString, null, null);
+ editBox.contents = ((const char *(*)(void *, void *, char *, void *, bool *))(void *)dataType._vTbl[__ecereVMethodID_class_OnGetString])(dataType, currentRow.GetData(null), tempString, null, null);
else
editBox.contents = "";
- }
+ }
NotifySelect(master, this, currentRow, key.modifiers | { closingDropDown = true });
-
- delete this;
+
+ delete this;
return false;
}
return false;
button.anchor = { right = 0, top = 0, bottom = 0 };
button.size = { guiApp.textMode ? 8 : BTN_WIDTH, 0 };
}
-
+
/*Timer timer
{
window = this, delay = 0.01;
if(!isEnabled)
surface.SetForeground(Color { 85,85,85 } );
else
- surface.SetForeground((active && style.activeColor && !pulledWindow /*listBox.visible*/) ? SELECTION_TEXT : foreground);
+ surface.SetForeground((active && style.activeColor && !pulledWindow /*listBox.visible*/) ? selectionText : foreground);
surface.TextOpacity(true);
if(currentRow)
{
DataDisplayFlags displayFlags { active = active, current = true, dropBox = true, selected = true, fullRow = true };
- dataType._vTbl[__ecereVMethodID_class_OnDisplay](dataType, currentRow.GetData(null), surface, 3,
- 1+(clientSize.h - listBox.rowHeight) / 2, clientSize.w - (button.visible ? button.size.w : 0) - 3,
+ ((void (*)(void *, void *, void *, int, int, int, void *, uint, uint))(void *)dataType._vTbl[__ecereVMethodID_class_OnDisplay])(dataType, currentRow.GetData(null), surface, 3,
+ 1+(clientSize.h - listBox.rowHeight) / 2, clientSize.w - (button.visible ? button.size.w : 0) - 3,
field.userData, alignment, displayFlags);
}
else
{
int rowHeight = 0;
- display.FontExtent(fontObject, "W", 1, null, &rowHeight);
+ display.FontExtent(fontObject, "W", 1, null, &rowHeight);
rowHeight = Max(rowHeight, 16);
if(!*width) *width = Max(*width, rowHeight * 100 / 16);
OnCloseDropDown(pulledWindow);
button.checked = false;
pulledWindow = null;
-
+
if(!NotifyClose(master, this))
return false;
}
bool OnKeyHit(Key key, unichar ch)
{
DataRow currentRow = this.currentRow;
-
+
if(!pulledWindow /*listBox.visible*/)
{
int c;
{
char tempString[4096];
if(currentRow)
- editBox.contents = (char *)dataType._vTbl[__ecereVMethodID_class_OnGetString](dataType, currentRow.GetData(null), tempString, null, null);
+ editBox.contents = ((const char *(*)(void *, void *, char *, void *, bool *))(void *)dataType._vTbl[__ecereVMethodID_class_OnGetString])(dataType, currentRow.GetData(null), tempString, null, null);
else
editBox.contents = "";
if(active)
editBox.SelectAll();
- }
+ }
button.Deactivate();
return NotifySelect(master, this, currentRow, mods);
}
EditBox editBox;
Alignment alignment;
DataRow noneRow;
- Color selectionColor;
+ ColorAlpha selectionColor, selectionText;
+
+ selectionColor = SELECTION_COLOR;
+ selectionText = SELECTION_TEXT;
};