void WINAPI duAnimation::RegisterControlProperty() { //RegisterProperty(_T("acceleration"), DU_PROPERTY_LONG,&m_nAcceleration); RegisterProperty(_T("frame"), DU_PROPERTY_LONG, &m_nFrameCount); RegisterProperty(_T("animation"), DU_PROPERTY_STRING, &m_szAnimation); RegisterProperty(_T("time"), DU_PROPERTY_LONG, &m_nTime); }
Property* EffectImpl::EffectColorImpl::GetDelegate(const char *param) { if( param ) { if( 0 == _stricmp("R", param) ) { return RegisterProperty(new PropertyImpl(this, &m_color.x, 1, "r")); } if( 0 == _stricmp("G", param) ) { return RegisterProperty(new PropertyImpl(this, &m_color.y, 1, "g")); } if( 0 == _stricmp("B", param) ) { return RegisterProperty(new PropertyImpl(this, &m_color.z, 1, "b")); } if( 0 == _stricmp("A", param) ) { return RegisterProperty(new PropertyImpl(this, &m_color.w, 1, "a")); } } else { // return delegate to entire contents return RegisterProperty(new PropertyImpl(this, m_color, 4, "")); } return NULL; }
void WINAPI duComboBox::RegisterControlProperty() { duEdit::RegisterControlProperty(); RegisterProperty(_T("window"), DU_PROPERTY_STRING, m_szWindow); RegisterProperty(_T("windowheight"), DU_PROPERTY_LONG, &m_nWindowHeight); RegisterProperty(_T("listbox"), DU_PROPERTY_STRING, m_szListBox); }
GradientDecoratorInstancer( void ) : DecoratorInstancer() { // register properties for the decorator RegisterProperty( "dir", "" ).AddParser( "string" ).AddParser( "keyword", "horizontal, vertical" ); RegisterProperty( "start", "#ffff" ).AddParser( "color" ); RegisterProperty( "end", "#ffff" ).AddParser( "color" ); RegisterShorthand( "gradient", "dir, start, end" ); // Com_Printf("decorator instancer created\n"); }
namespace Media { DependencyProperty* TimelineGroup::s_ChildrenProperty = RegisterProperty(WSTR("Children"), typeid(TimelineCollection), typeid(TimelineGroup), NULL, PropertyMetaData(None)); TimelineCollection::TimelineCollection() { } // TimelineGroup::TimelineGroup() { set_Children(new TimelineCollection()); } TimelineCollection* TimelineGroup::get_Children() { return static_cast<TimelineCollection*>(GetValue(get_ChildrenProperty())); } void TimelineGroup::set_Children(TimelineCollection* children) { SetValue(get_ChildrenProperty(), children); } } // Media
//------------------------------------------------------------------------------ PingerDriver::PingerDriver( ConfigFile* pConfigFile, int section ) : ThreadedDriver( pConfigFile, section, false, PLAYER_MSGQUEUE_DEFAULT_MAXLEN, PLAYER_DSPIC_CODE ), mBufferSize( "buffer_size", DEFAULT_BUFFER_SIZE, false ) { this->alwayson = true; mpOpaque = NULL; // We must have an opaque device if ( pConfigFile->ReadDeviceAddr( &mOpaqueID, section, "requires", PLAYER_OPAQUE_CODE, -1, NULL ) != 0 ) { PLAYER_ERROR( "No Opaque driver specified" ); SetError(-1); return; } // Read options from the configuration file RegisterProperty( "buffer_size", &mBufferSize, pConfigFile, section ); mBuffer.Init( mBufferSize.GetValue() ); // initializing serial incoming handling globals remainingBytes = 0; state = stIdle; transducer = 0; }
void ApiRegistrar::DefineClass( TypeHandle type, size_t sizeInBytes, std::initializer_list<Constructor> constructors, std::initializer_list<Property> properties, std::initializer_list<Method> methods, std::initializer_list<Operator> operators, std::initializer_list<Field> fields ) { const auto typeName( GetTypeName( type ) ); const auto registerResult( _scriptEngine.RegisterObjectType( typeName, static_cast<int>( sizeInBytes ), ( asEObjTypeFlags::asOBJ_VALUE | asEObjTypeFlags::asOBJ_APP_CLASS_CDAK ) ) ); ETRuntimeAssert( asERetCodes::asSUCCESS <= registerResult || asERetCodes::asALREADY_REGISTERED == registerResult ); const asITypeInfo& typeInfo( *_scriptEngine.GetTypeInfoByName( typeName ) ); // Register the factories. for( const Constructor& constructor : constructors ) { RegisterConstructor( typeInfo, constructor ); } // Register the (virtual) properties. for( const Property& property : properties ) { RegisterProperty( typeInfo, property ); } // Register the methods. for( const Method& method : methods ) { RegisterMethod( typeInfo, method ); } // Register the operators. for( const Operator& op : operators ) { RegisterOperator( typeInfo, op ); } // Register the fields. for( const Field& field : fields ) { RegisterField( typeInfo, field ); } }
void ApiRegistrar::DefineUserAllocatedClass( TypeHandle type, std::initializer_list<Factory> factories, std::initializer_list<Property> properties, std::initializer_list<Method> methods, std::initializer_list<Operator> operators, std::initializer_list<Field> fields ) { const auto typeName( GetTypeName( type ) ); const auto registerResult( _scriptEngine.RegisterObjectType( typeName, 0, asEObjTypeFlags::asOBJ_REF ) ); ETRuntimeAssert( asERetCodes::asSUCCESS <= registerResult || asERetCodes::asALREADY_REGISTERED == registerResult ); const asITypeInfo& typeInfo( *_scriptEngine.GetTypeInfoByName( typeName ) ); // Register the factories. for( const Factory& factory : factories ) { RegisterFactory( typeInfo, factory ); } // Register the (virtual) properties. for( const Property& property : properties ) { RegisterProperty( typeInfo, property ); } // Register the methods. for( const Method& method : methods ) { RegisterMethod( typeInfo, method ); } // Register the operators. for( const Operator& op : operators ) { RegisterOperator( typeInfo, op ); } // Register the fields. for( const Field& field : fields ) { RegisterField( typeInfo, field ); } }
DecoratorTiledVerticalInstancer::DecoratorTiledVerticalInstancer() { RegisterTileProperty("top-image", false); RegisterTileProperty("bottom-image", false); RegisterTileProperty("center-image", true); RegisterProperty("color-multiplier", "white").AddParser(COLOR); }
void WINAPI duListCtrl::RegisterControlProperty() { // RegisterProperty(_T("headerctrl"), DU_PROPERTY_STRING, m_szHeaderCtrl); duScrollView::RegisterControlProperty(); }
void duTreeListItem::RegisterControlProperty() { RegisterProperty(_T("indentx"), DU_PROPERTY_LONG, &m_nIndentStart); RegisterProperty(_T("indentstyle"), DU_PROPERTY_STYLEGROUP, m_szIndentStyle); RegisterProperty(_T("indentwidth"), DU_PROPERTY_LONG, &m_nIndentWidth); RegisterProperty(_T("indentheight"), DU_PROPERTY_LONG, &m_nIndentHeight); RegisterProperty(_T("checkboximage"), DU_PROPERTY_IMAGE, m_szCheckBoxImage); RegisterProperty(_T("checkboxwidth"), DU_PROPERTY_LONG, &m_nCheckBoxWidth); RegisterProperty(_T("checkboxheight"), DU_PROPERTY_LONG, &m_nCheckBoxHeight); RegisterProperty(_T("indentspace"), DU_PROPERTY_LONG, &m_nIndentSpace); RegisterProperty(_T("checkboxspace"), DU_PROPERTY_LONG, &m_nCheckBoxSpace); RegisterProperty(_T("expandspace"), DU_PROPERTY_LONG, &m_nExpandSpace); }
void WINAPI duListBox::RegisterControlProperty() { RegisterProperty(_T("vertscrollbar"), DU_PROPERTY_STRING, m_szVertScroll); RegisterProperty(_T("itemheight"), DU_PROPERTY_LONG, &m_nItemHeight); RegisterProperty(_T("itemstyle"), DU_PROPERTY_STYLEGROUP, m_szItemStyle); RegisterProperty(_T("itemiconx"), DU_PROPERTY_LONG, &m_nItemIconX); RegisterProperty(_T("itemicony"), DU_PROPERTY_LONG, &m_nItemIconY); RegisterProperty(_T("itemiconwidth"), DU_PROPERTY_LONG, &m_nItemIconWidth); RegisterProperty(_T("itemiconheight"), DU_PROPERTY_LONG, &m_nItemIconHeight); RegisterProperty(_T("fade"), DU_PROPERTY_BOOL, &m_fFade); }
void CameraProperties::InitProperties() { Super::InitProperties(); RemoveProperty( &mOrientation ); RegisterProperty( CameraProperties, "FOV Angle", mFovAngle ); RegisterProperty( CameraProperties, "Near Plane", mNearView ); RegisterProperty( CameraProperties, "Far Plane", mFarView ); mFovAngle.SetMinimum( 5 ); mFovAngle.SetMaximum( 179 ); mFovAngle.UseRangeValidation( true ); mFovAngle.UseSlider( true ); mNearView.SetMinimum( 0 ); mNearView.SetMaximum( 100 ); mFarView.SetMinimum( 100 ); }
DecoratorInstancerStarfield::DecoratorInstancerStarfield() { RegisterProperty("num-layers", "3").AddParser("number"); RegisterProperty("top-colour", "#dddc").AddParser("color"); RegisterProperty("bottom-colour", "#333c").AddParser("color"); RegisterProperty("top-speed", "10.0").AddParser("number"); RegisterProperty("bottom-speed", "2.0").AddParser("number"); RegisterProperty("top-density", "15").AddParser("number"); RegisterProperty("bottom-density", "10").AddParser("number"); }
namespace UI { __live_object_ptr<Style> ComboBoxItemStyle; ComboBoxItem::ComboBoxItem() { if (ComboBoxItemStyle == NULL) { ComboBoxItemStyle = dynamic_cast<Style*>(FindResource(GetType())); } set_Style(ComboBoxItemStyle); } ////////////////////////////////////////////// __live_object_ptr<Style> ComboBoxStyle; DependencyProperty* ComboBox::s_IsDropDownOpenProperty = RegisterProperty(WSTR("IsDropDownOpen"), typeid(bool), typeid(ComboBox), BoolObject::get_False()); DependencyProperty* ComboBox::s_IsReadOnlyProperty = NULL; ComboBox::ComboBox() { if (ComboBoxStyle == NULL) { ComboBoxStyle = dynamic_cast<Style*>(FindResource(GetType())); } set_Style(ComboBoxStyle); } bool ComboBox::get_IsDropDownOpen() { return static_cast<BoolObject*>(GetValue(get_IsDropDownOpenProperty()))->GetValue(); } void ComboBox::set_IsDropDownOpen(bool isDropDownOpen) { SetValue(get_IsDropDownOpenProperty(), BoolObject::GetObject(isDropDownOpen)); } bool ComboBox::get_IsReadOnly() { return static_cast<BoolObject*>(GetValue(get_IsReadOnlyProperty()))->GetValue(); } void ComboBox::set_IsReadOnly(bool isReadOnly) { SetValue(get_IsReadOnlyProperty(), BoolObject::GetObject(isReadOnly)); } } // UI
void duSplitter::RegisterControlProperty() { RegisterProperty(_T("firstminpixel"), DU_PROPERTY_LONG, &m_nFMinPixel); RegisterProperty(_T("secondminpixel"), DU_PROPERTY_LONG, &m_nSMinPixel); RegisterProperty(_T("firstpluginname"), DU_PROPERTY_STRING, m_szFName); RegisterProperty(_T("secondpluginname"), DU_PROPERTY_STRING, m_szSName); RegisterProperty(_T("vert"), DU_PROPERTY_BOOL, &m_fVert); RegisterProperty(_T("dockfirst"), DU_PROPERTY_BOOL, &m_fDockFirst); }
void duSpin::RegisterControlProperty() { duEdit::RegisterControlProperty(); RegisterProperty(_T("value"), DU_PROPERTY_LONG, &m_nVal); RegisterProperty(_T("spinleft"), DU_PROPERTY_LONG, &m_nSpinLeft); RegisterProperty(_T("spinwidth"), DU_PROPERTY_LONG, &n_nSpinWidth); RegisterProperty(_T("spintop"), DU_PROPERTY_LONG, &m_nSpinTop); RegisterProperty(_T("spinbottom"), DU_PROPERTY_LONG, &m_nSpinBottom); RegisterProperty(_T("upstyle"), DU_PROPERTY_STYLEGROUP, m_szUpStyle); RegisterProperty(_T("downstyle"), DU_PROPERTY_STYLEGROUP, m_szDownStyle); }
inline_t void RegisterLibCore(RuntimePtr runtime) { auto library = runtime->GetLibrary("core"); // Register core functions library->RegisterFunction(Visibility::Public, { "write {}" }, Write); library->RegisterFunction(Visibility::Public, { "write line {}" }, WriteLine); library->RegisterFunction(Visibility::Public, { "{} (get) size" }, GetSize); library->RegisterFunction(Visibility::Public, { "{} (is) empty" }, IsEmpty); library->RegisterFunction(Visibility::Public, { "{} (get) key" }, GetKey); library->RegisterFunction(Visibility::Public, { "{} (get) value" }, GetValue); library->RegisterFunction(Visibility::Public, { "(get) call stack" }, GetCallStack); // Register core properties library->RegisterProperty(Visibility::Public, Access::ReadOnly, { "newline" }, "\n"); }
// Adds the property declarations for a tile. void DecoratorTiledInstancer::RegisterTileProperty(const String& name, bool register_repeat_modes) { RegisterProperty(String(32, "%s-src", name.CString()), "").AddParser("string"); RegisterProperty(String(32, "%s-s-begin", name.CString()), "0").AddParser("number"); RegisterProperty(String(32, "%s-s-end", name.CString()), "1").AddParser("number"); RegisterProperty(String(32, "%s-t-begin", name.CString()), "0").AddParser("number"); RegisterProperty(String(32, "%s-t-end", name.CString()), "1").AddParser("number"); RegisterShorthand(String(32, "%s-s", name.CString()), String(64, "%s-s-begin, %s-s-end", name.CString(), name.CString())); RegisterShorthand(String(32, "%s-t", name.CString()), String(64, "%s-t-begin, %s-t-end", name.CString(), name.CString())); if (register_repeat_modes) { RegisterProperty(String(32, "%s-repeat", name.CString()), "stretch") .AddParser("keyword", "stretch, clamp-stretch, clamp-truncate, repeat-stretch, repeat-truncate"); RegisterShorthand(name, String(256, "%s-src, %s-repeat, %s-s-begin, %s-t-begin, %s-s-end, %s-t-end", name.CString(), name.CString(), name.CString(), name.CString(), name.CString(), name.CString())); } else RegisterShorthand(name, String(256, "%s-src, %s-s-begin, %s-t-begin, %s-s-end, %s-t-end", name.CString(), name.CString(), name.CString(), name.CString(), name.CString())); }
// Registers Rocket's default style properties. void StyleSheetSpecification::RegisterDefaultProperties() { // Style property specifications (ala RCSS). RegisterProperty(MARGIN_TOP, "0px", false, true) .AddParser("keyword", "auto") .AddParser("number"); RegisterProperty(MARGIN_RIGHT, "0px", false, true) .AddParser("keyword", "auto") .AddParser("number"); RegisterProperty(MARGIN_BOTTOM, "0px", false, true) .AddParser("keyword", "auto") .AddParser("number"); RegisterProperty(MARGIN_LEFT, "0px", false, true) .AddParser("keyword", "auto") .AddParser("number"); RegisterShorthand(MARGIN, "margin-top, margin-right, margin-bottom, margin-left"); RegisterProperty(PADDING_TOP, "0px", false, true).AddParser("number"); RegisterProperty(PADDING_RIGHT, "0px", false, true).AddParser("number"); RegisterProperty(PADDING_BOTTOM, "0px", false, true).AddParser("number"); RegisterProperty(PADDING_LEFT, "0px", false, true).AddParser("number"); RegisterShorthand(PADDING, "padding-top, padding-right, padding-bottom, padding-left"); RegisterProperty(BORDER_TOP_WIDTH, "0px", false, true).AddParser("number"); RegisterProperty(BORDER_RIGHT_WIDTH, "0px", false, true).AddParser("number"); RegisterProperty(BORDER_BOTTOM_WIDTH, "0px", false, true).AddParser("number"); RegisterProperty(BORDER_LEFT_WIDTH, "0px", false, true).AddParser("number"); RegisterShorthand(BORDER_WIDTH, "border-top-width, border-right-width, border-bottom-width, border-left-width"); RegisterProperty(BORDER_TOP_COLOR, "black", false, false).AddParser(COLOR); RegisterProperty(BORDER_RIGHT_COLOR, "black", false, false).AddParser(COLOR); RegisterProperty(BORDER_BOTTOM_COLOR, "black", false, false).AddParser(COLOR); RegisterProperty(BORDER_LEFT_COLOR, "black", false, false).AddParser(COLOR); RegisterShorthand(BORDER_COLOR, "border-top-color, border-right-color, border-bottom-color, border-left-color"); RegisterShorthand(BORDER_TOP, "border-top-width, border-top-color"); RegisterShorthand(BORDER_RIGHT, "border-right-width, border-right-color"); RegisterShorthand(BORDER_BOTTOM, "border-bottom-width, border-bottom-color"); RegisterShorthand(BORDER_LEFT, "border-left-width, border-left-color"); RegisterProperty(DISPLAY, "inline", false, true).AddParser("keyword", "none, block, inline, inline-block"); RegisterProperty(POSITION, "static", false, true).AddParser("keyword", "static, relative, absolute, fixed"); RegisterProperty(TOP, "0px", false, false) .AddParser("keyword", "auto") .AddParser("number"); RegisterProperty(RIGHT, "0px", false, false).AddParser("number") .AddParser("keyword", "auto") .AddParser("number"); RegisterProperty(BOTTOM, "0px", false, false).AddParser("number") .AddParser("keyword", "auto") .AddParser("number"); RegisterProperty(LEFT, "0px", false, false).AddParser("number") .AddParser("keyword", "auto") .AddParser("number"); RegisterProperty(FLOAT, "none", false, true).AddParser("keyword", "none, left, right"); RegisterProperty(CLEAR, "none", false, true).AddParser("keyword", "none, left, right, both"); RegisterProperty(Z_INDEX, "auto", false, false) .AddParser("keyword", "auto, top, bottom") .AddParser("number"); RegisterProperty(WIDTH, "auto", false, true) .AddParser("keyword", "auto") .AddParser("number"); RegisterProperty(MIN_WIDTH, "0px", false, true).AddParser("number"); RegisterProperty(MAX_WIDTH, "-1", false, true).AddParser("number"); RegisterProperty(HEIGHT, "auto", false, true) .AddParser("keyword", "auto") .AddParser("number"); RegisterProperty(MIN_HEIGHT, "0px", false, true).AddParser("number"); RegisterProperty(MAX_HEIGHT, "-1", false, true).AddParser("number"); RegisterProperty(LINE_HEIGHT, "1.2", true, true).AddParser("number"); RegisterProperty(VERTICAL_ALIGN, "baseline", false, true) .AddParser("keyword", "baseline, middle, sub, super, text-top, text-bottom, top, bottom") .AddParser("number"); RegisterProperty(OVERFLOW_X, "visible", false, true).AddParser("keyword", "visible, hidden, auto, scroll"); RegisterProperty(OVERFLOW_Y, "visible", false, true).AddParser("keyword", "visible, hidden, auto, scroll"); RegisterShorthand("overflow", "overflow-x, overflow-y", PropertySpecification::REPLICATE); RegisterProperty(CLIP, "auto", true, false) .AddParser("keyword", "auto, none") .AddParser("number"); RegisterProperty(VISIBILITY, "visible", false, false).AddParser("keyword", "visible, hidden"); // Need some work on this if we are to include images. RegisterProperty(BACKGROUND_COLOR, "transparent", false, false).AddParser(COLOR); RegisterShorthand(BACKGROUND, BACKGROUND_COLOR); RegisterProperty(COLOR, "white", true, false).AddParser(COLOR); RegisterProperty(FONT_FAMILY, "", true, true).AddParser("string"); RegisterProperty(FONT_CHARSET, "U+0020-007E", true, false).AddParser("string"); RegisterProperty(FONT_STYLE, "normal", true, true).AddParser("keyword", "normal, italic"); RegisterProperty(FONT_WEIGHT, "normal", true, true).AddParser("keyword", "normal, bold"); RegisterProperty(FONT_SIZE, "12", true, true).AddParser("number"); RegisterShorthand(FONT, "font-style, font-weight, font-size, font-family, font-charset"); RegisterProperty(TEXT_ALIGN, LEFT, true, true).AddParser("keyword", "left, right, center, justify"); RegisterProperty(TEXT_DECORATION, "none", true, false).AddParser("keyword", "none, underline"/*"none, underline, overline, line-through"*/); RegisterProperty(TEXT_TRANSFORM, "none", true, true).AddParser("keyword", "none, capitalize, uppercase, lowercase"); RegisterProperty(WHITE_SPACE, "normal", true, true).AddParser("keyword", "normal, pre, nowrap, pre-wrap, pre-line"); RegisterProperty(CURSOR, "auto", true, false) .AddParser("keyword", "auto") .AddParser("string"); // Functional property specifications. RegisterProperty(DRAG, "none", false, false).AddParser("keyword", "none, drag, drag-drop, block, clone"); RegisterProperty(TAB_INDEX, "none", false, false).AddParser("keyword", "none, auto"); RegisterProperty(FOCUS, "auto", true, false).AddParser("keyword", "none, auto"); RegisterProperty(SCROLLBAR_MARGIN, "0", false, false).AddParser("number"); }
void duTreeCtrl::RegisterControlProperty() { RegisterProperty(_T("itemstyle"), DU_PROPERTY_STYLEGROUP, m_szItemStyle); RegisterProperty(_T("font"), DU_PROPERTY_FONT, m_szFont); RegisterProperty(_T("indentstyle"), DU_PROPERTY_STYLEGROUP, m_szIndentStyle); RegisterProperty(_T("itemheight"), DU_PROPERTY_LONG, &m_nItemHeight); RegisterProperty(_T("indentwidth"), DU_PROPERTY_LONG, &m_nIndentWidth); RegisterProperty(_T("indentheight"), DU_PROPERTY_LONG, &m_nIndentHeight); RegisterProperty(_T("iconwidth"), DU_PROPERTY_LONG, &m_nIconWidth); RegisterProperty(_T("iconheight"), DU_PROPERTY_LONG, &m_nIconHeight); RegisterProperty(_T("indenticonspace"), DU_PROPERTY_LONG, &m_nIndentIconSpace); RegisterProperty(_T("icontextspace"), DU_PROPERTY_LONG, &m_nIconTextSpace); RegisterProperty(_T("btooltip"), DU_PROPERTY_BOOL, &m_fAutoShowToolTip); duScrollView::RegisterControlProperty(); }
DecoratorTiledImageInstancer::DecoratorTiledImageInstancer() { RegisterTileProperty("image", false); RegisterProperty("image-scaling", "ignore") .AddParser("keyword", "ignore,fill,fit,center"); }
DecoratorInstancerDefender::DecoratorInstancerDefender() { RegisterProperty("image-src", "").AddParser("string"); }
namespace UI { void DragDeltaEventArgs::InvokeEventHandler(Object* genericTarget, stub_interface_base* genericHandler) { stub_interface2<void, Object*, DragDeltaEventArgs*>* handler = dynamic_cast<stub_interface2<void, Object*, DragDeltaEventArgs*>*>(genericHandler); ASSERT(handler); handler->invoke(genericTarget, this); } /* Thumb::Thumb() { Border* pBorder = new Border(new Thickness(1)); pBorder->set_BorderBrush(new LinearGradientBrush(new Color(255, 255, 255), new Color(0, 0, 0), new Point(0, 0), new Point(0, 1))); // pBorder->set_BorderBrush(new SolidColorBrush(new Color(0, 0, 0))); pBorder->set_Background(new SolidColorBrush(new Color(80, 114, 158))); set_VisualTree(pBorder); } */ DependencyProperty* Thumb::s_IsDraggingProperty = RegisterProperty(WSTR("IsDragging"), typeid(bool), typeid(Thumb), BoolObject::get_False(), PropertyMetaData(None)); RoutedEvent* Thumb::s_DragStartedEvent; RoutedEvent* Thumb::s_DragCompletedEvent; RoutedEvent* Thumb::s_DragDeltaEvent = EventManager::RegisterRoutedEvent(WSTR("DragDelta"), RoutingStrategy_Bubble, typeid(stub_interface2<void, Object*, DragDeltaEventArgs*>), typeid(Thumb)); //void ApplyStyle(Style* style, FrameworkElement* element); //Object* CreateObjectFromElement(Type* pType, Object* parentObject, XmlData::Node* node, Type** pReturnType); __live_object_ptr<Style> ThumbStyle; Thumb::Thumb() { m_dragging = false; if (ThumbStyle == NULL) { XmlData::Document* document = new XmlData::Document; StringW* filename = MakeFilePath(_Module, L"../../../ThumbStyle.lxui"); document->load(filename); Type* returnType; ThumbStyle = dynamic_cast<Style*>(CreateObjectFromElement(NULL, NULL, document->get_documentElement(), &returnType)); } set_Style(ThumbStyle); /* ApplyStyle(get_Style(), this); InitScript(); */ } bool Thumb::get_IsDragging() { return static_cast<BoolObject*>(GetValue(get_IsDraggingProperty()))->GetValue(); } void Thumb::set_IsDragging(bool dragging) { SetValue(get_IsDraggingProperty(), BoolObject::GetObject(dragging)); } void Thumb::OnMouseDown(MouseButtonEventArgs* args) { if (!m_dragging) { CaptureMouse(); set_IsDragging(true); m_dragging = true; m_oldpoint = args->GetPosition(dynamic_cast<IInputElement*>(GetRParent()));//LDraw::PointD(mouseevt->get_ScreenX(), mouseevt->get_ScreenY()); } args->set_Handled(true); } void Thumb::OnMouseUp(MouseButtonEventArgs* args) { if (m_dragging) { ReleaseMouseCapture(); set_IsDragging(false); m_dragging = false; } args->set_Handled(true); } void Thumb::OnMouseMove(MouseEventArgs* args) { // Point point(mouseevt->get_ScreenX(), mouseevt->get_ScreenY()); Point point = args->GetPosition(dynamic_cast<IInputElement*>(GetRParent()));//point(mouseevt->get_ScreenX(), mouseevt->get_ScreenY()); if (m_dragging) { #if 0 DragDeltaEvent* dragevent = new DragDeltaEvent; dragevent->InitEvent(WSTR("DragDelta"), true, true); dragevent->m_HorizontalChange = point.X - m_oldpoint.X; dragevent->m_VerticalChange = point.Y - m_oldpoint.Y; m_oldpoint = point; dispatchEvent(dragevent); #endif DragDeltaEventArgs* args = new DragDeltaEventArgs; args->set_RoutedEvent(get_DragDeltaEvent()); args->m_HorizontalChange = point.X - m_oldpoint.X; args->m_VerticalChange = point.Y - m_oldpoint.Y; m_oldpoint = point; RaiseEvent(args); } args->set_Handled(true); } #if 0 void Thumb::handleEvent(Event* evt) { StringW* type = evt->get_type(); if (evt->get_eventPhase() != CAPTURING_PHASE) { if (type == MouseEvent::mousedown) { MouseEvent* mouseevt = static_cast<MouseEvent*>(evt); if (!m_dragging) { CaptureMouse(); m_dragging = true; m_oldpoint = LDraw::PointD(mouseevt->get_ScreenX(), mouseevt->get_ScreenY()); } // OnLButtonDown(static_cast<MouseEvent*>(evt)); evt->stopPropagation(); } else if (type == MouseEvent::mouseup) { if (m_dragging) { ReleaseMouseCapture(); m_dragging = false; } // OnLButtonUp(static_cast<MouseEvent*>(evt)); evt->stopPropagation(); } else if (type == MouseEvent::mousemove) { MouseEvent* mouseevt = static_cast<MouseEvent*>(evt); //LDraw::PointD point = ScreenToClient(evt->get_ScreenX(), evt->get_ScreenY()); LDraw::PointD point(mouseevt->get_ScreenX(), mouseevt->get_ScreenY()); if (m_dragging) { DragDeltaEvent* dragevent = new DragDeltaEvent; dragevent->InitEvent(WSTR("DragDelta"), true, true); dragevent->m_HorizontalChange = point.X - m_oldpoint.X; dragevent->m_VerticalChange = point.Y - m_oldpoint.Y; m_oldpoint = point; dispatchEvent(dragevent); } // OnMouseMove(static_cast<MouseEvent*>(evt)); evt->stopPropagation(); } } } #endif } // UI
void WINAPI duFlash::RegisterControlProperty() { RegisterProperty(_T("url"), DU_PROPERTY_STRING, &m_szURL); }
void WINAPI duOutlookBar::RegisterControlProperty() { RegisterProperty(_T("itemstyle"), DU_PROPERTY_STYLEGROUP, m_szItemStyle); RegisterProperty(_T("itemheight"), DU_PROPERTY_LONG, &m_nItemHeight); }
void WINAPI duPie::RegisterControlProperty() { RegisterProperty(_T("percent"), DU_PROPERTY_FLOAT, &m_fPercent); RegisterProperty(_T("colorall"), DU_PROPERTY_COLOR, &m_clrAll); RegisterProperty(_T("colorpercent"), DU_PROPERTY_COLOR, &m_clrPercent); }
void duGifCtrl::RegisterControlProperty() { RegisterProperty(_T("gif"), DU_PROPERTY_STRING, m_szGifName); }
void duLEDTimer::RegisterControlProperty() { RegisterProperty(_T("imagefont"), DU_PROPERTY_STRING, m_szImageFont); }
void WINAPI duStatic::RegisterControlProperty() { RegisterProperty(_T("showtooltip"), DU_PROPERTY_BOOL, &m_fShowToolTip); }