本文整理汇总了C++中dom::element类的典型用法代码示例。如果您正苦于以下问题:C++ element类的具体用法?C++ element怎么用?C++ element使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了element类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: get_value
/** Get value of the DOM element. Returns value for elements recognized by get_ctl_type() function.
* \param[in] el \b const dom::element&, The element.
* \return \b value_t, value of the element.
**/
inline value_t get_value(dom::element& el )
{
switch(get_ctl_type(el))
{
case CTL_EDIT:
case CTL_DECIMAL:
case CTL_CURRENCY:
case CTL_PASSWORD:
case CTL_NUMERIC:
case CTL_PROGRESS:
case CTL_SLIDER:
case CTL_SELECT_SINGLE:
case CTL_SELECT_MULTIPLE:
case CTL_DD_SELECT:
case CTL_TEXTAREA:
case CTL_DATE:
case CTL_CALENDAR:
default:
return el.get_value();
// special cases:
case CTL_UNKNOWN:
if( !aux::wcseq(el.get_attribute("type"),L"hidden"))
break;
//else fall below if it is hidden
case CTL_BUTTON: return value_t(el.get_attribute("value"));
case CTL_CHECKBOX: return get_checkbox_bits(el);
case CTL_RADIO: return get_radio_index(el);
case CTL_HTMLAREA: return value_t(el.get_html(false/*inner*/));
}
return value_t();
}
开发者ID:calupator,项目名称:wiredplane-wintools,代码行数:36,代码来源:htmlayout_controls.hpp
示例2: setup_node
void setup_node( dom::element node )
{
dom::element on = node.find_first("option[check='on'],options[check='on']");
dom::element off = node.find_first("option[check='off'],options[check='off']");
dom::element mixed = node.find_first("options[check='mixed']");
const wchar_t* _prev = node.get_attribute(CHECK_ATTR);
std::wstring prev = _prev?_prev:L"";
if( mixed.is_valid() || (on.is_valid() && off.is_valid()))
{
node.set_attribute(CHECK_ATTR,L"mixed");
if(prev != L"mixed") node.update();
}
else if( on.is_valid() )
{
node.set_attribute(CHECK_ATTR,L"on");
if(prev != L"on") node.update();
}
else
{
node.set_attribute(CHECK_ATTR,L"off");
if(prev != L"off") node.update();
}
}
开发者ID:Erls-Corporation,项目名称:webinaria-source,代码行数:25,代码来源:behavior_select_checkmark.cpp
示例3: init_options
NODE_STATE init_options(dom::element n)
{
//NODE_STATE n_state = NODE_MIXED;
int n_off = 0;
int n_on = 0;
int n_total = 0;
for(int i = 0; i < int(n.children_count()); ++i)
{
dom::element t = n.child(i);
NODE_STATE t_state;
if( streq(t.get_element_type(),"options") )
t_state = init_options(t);
else if( streq(t.get_element_type(),"option") )
t_state = get_state(t);
else
continue;
set_state(t, t_state);
switch( t_state )
{
case NODE_OFF: ++n_off; break;
case NODE_ON: ++n_on; break;
}
++n_total;
}
if( n_off == n_total ) return NODE_OFF;
if( n_on == n_total ) return NODE_ON;
return NODE_MIXED;
}
开发者ID:Erls-Corporation,项目名称:webinaria-source,代码行数:33,代码来源:behavior_select_checkmark.cpp
示例4: checkall
void checkall (dom::element& table, bool onOff )
{
if( !is_multiple(table) ) return;
struct unchecker_cb: dom::callback
{
bool on_element(HELEMENT he)
{
htmlayout::dom::element el = he; if( el.get_state(STATE_CHECKED)) el.set_state(0,STATE_CHECKED,false ); return false; /*continue enumeration*/
}
};
struct checker_cb: dom::callback
{
bool on_element(HELEMENT he)
{
htmlayout::dom::element el = he; if( !el.get_state(STATE_CHECKED)) el.set_state(STATE_CHECKED,0,false ); return false; /*continue enumeration*/
}
};
if(onOff)
{
checker_cb checker;
table.find_all(&checker,"tr");
}
else
{
unchecker_cb unchecker;
table.find_all(&unchecker,"tr:checked");
}
}
开发者ID:Erls-Corporation,项目名称:webinaria-source,代码行数:30,代码来源:behavior_grid.cpp
示例5: set_anchor
void set_anchor (dom::element& table,const int idx)
{
dom::element row = table.find_first("tr:anchor");
if( row.is_valid() ) row.set_state( 0,STATE_ANCHOR,false);
row = table.child(idx);
if( row.is_valid() )
row.set_state( STATE_ANCHOR | STATE_CHECKED,0,false);
}
开发者ID:Erls-Corporation,项目名称:webinaria-source,代码行数:8,代码来源:behavior_grid.cpp
示例6: belongs_to
bool belongs_to( dom::element parent, dom::element child )
{
if( !child.is_valid())
return false;
if( parent == child )
return true;
return belongs_to( parent, child.parent() );
}
开发者ID:calupator,项目名称:wiredplane-wintools,代码行数:8,代码来源:behavior_popup.cpp
示例7: sort_rows
void sort_rows( dom::element& table, int column_no )
{
row_sorter rs( column_no );
int fr = fixed_rows( table );
table.sort(rs,fr);
table.update(true);
}
开发者ID:Erls-Corporation,项目名称:webinaria-source,代码行数:8,代码来源:behavior_grid.cpp
示例8: get_state
NODE_STATE get_state(dom::element item)
{
if(wcseq(item.get_attribute("check"),L"on"))
return NODE_ON;
else if(wcseq(item.get_attribute("check"),L"mixed"))
return NODE_MIXED;
else
return NODE_OFF;
}
开发者ID:Erls-Corporation,项目名称:webinaria-source,代码行数:9,代码来源:behavior_select_checkmark.cpp
示例9: set_state
void set_state(dom::element item, NODE_STATE st)
{
switch( st )
{
case NODE_ON: item.set_attribute("check",L"on"); break;
case NODE_MIXED: item.set_attribute("check",L"mixed"); break;
case NODE_OFF: item.set_attribute("check",L"off"); break;
}
}
开发者ID:Erls-Corporation,项目名称:webinaria-source,代码行数:9,代码来源:behavior_select_checkmark.cpp
示例10: select_all_options
// selects all options in multiselect.
inline void select_all_options(dom::element& select_el )
{
selected_cb all_options;
select_el.find_all(&all_options, "option"); // select all currently selected <option>s
for( int n = int(all_options.elements.size()) - 1; n >= 0 ; --n )
all_options.elements[n].set_state(STATE_CHECKED,0, false); // set state
select_el.update();
}
开发者ID:calupator,项目名称:wiredplane-wintools,代码行数:10,代码来源:htmlayout_controls.hpp
示例11: get_checkbox_bits
// returns bit mask - checkboxes set
inline value_t get_checkbox_bits(dom::element& el )
{
selected_cb selected;
dom::element r = el.parent(); // ATTN: I assume here that all checkboxes in the group belong to the same parent!
r.find_all(&selected, "[type='checkbox'][name='%S']", el.get_attribute("name"));
int m = 1, v = 0;
for( unsigned int n = 0; n < selected.elements.size(); ++n, m <<= 1 )
if ( selected.elements[n].get_state(STATE_CHECKED) ) v |= m;
return selected.elements.size()==1?value_t(v==1):value_t(v); // for alone checkbox we return true/false
}
开发者ID:calupator,项目名称:wiredplane-wintools,代码行数:11,代码来源:htmlayout_controls.hpp
示例12: get_radio_index
inline value_t get_radio_index( dom::element& el )
{
selected_cb selected;
dom::element r = el.parent(); // ATTN: I assume here that all radios in the group belong to the same parent!
r.find_all(&selected, "[type='radio'][name='%S']", el.get_attribute("name"));
for( unsigned int n = 0; n < selected.elements.size(); ++n )
if ( selected.elements[n].get_state(STATE_CHECKED) )
return value_t(int(n));
return value_t();
}
开发者ID:calupator,项目名称:wiredplane-wintools,代码行数:10,代码来源:htmlayout_controls.hpp
示例13: clear_all_options
// clear checked states in multiselect <select>.
// this simply resets :checked state for all checked <option>'s
inline void clear_all_options(dom::element& select_el )
{
selected_cb selected;
select_el.find_all(&selected, "option:checked,[role='option']:checked"); // select all currently selected <option>s
for( int n = int(selected.elements.size()) - 1; n >= 0 ; --n )
selected.elements[n].set_state(0, STATE_CHECKED, false); // reset state
select_el.update();
}
开发者ID:calupator,项目名称:wiredplane-wintools,代码行数:12,代码来源:htmlayout_controls.hpp
示例14: is_fullpath
bool is_fullpath(dom::element &el)
{
BOOL bFullPath = (el.get_attribute("fullpath") != NULL);
if ( !bFullPath )
{
dom::element ep = el.parent();
bFullPath = (ep.is_valid())?(ep.get_attribute("fullpath") != NULL):FALSE;
}
return bFullPath;
}
开发者ID:Beifeng,项目名称:qui,代码行数:10,代码来源:behavior_path.cpp
示例15: get_current_row
/** returns current row (if any) **/
dom::element get_current_row( dom::element& table )
{
for( int i = table.children_count() - 1; i >= 0 ; --i)
{
dom::element t = table.child((unsigned int)i);
if( t.get_state(STATE_CURRENT))
return t;
}
return dom::element(); // empty
}
开发者ID:Erls-Corporation,项目名称:webinaria-source,代码行数:11,代码来源:behavior_grid.cpp
示例16: set_checked_row
void set_checked_row( dom::element& table, dom::element& row, bool toggle = false )
{
if(toggle)
{
if( row.get_state( STATE_CHECKED) )
row.set_state( 0,STATE_CHECKED,false);
else
row.set_state( STATE_CHECKED,0,false);
}
else
row.set_state( STATE_CHECKED,0,false);
}
开发者ID:Erls-Corporation,项目名称:webinaria-source,代码行数:12,代码来源:behavior_grid.cpp
示例17: set_current_row
/** set current row **/
void set_current_row( dom::element& table, dom::element& row, UINT keyboardStates, bool dblClick = false )
{
// get previously selected row:
dom::element prev = get_current_row( table );
if( prev.is_valid() )
{
if( prev != row )
prev.set_state(0,STATE_CURRENT, false); // drop state flags
}
row.set_state(STATE_CURRENT); // set state flags
row.scroll_to_view();
table.post_event( dblClick? TABLE_ROW_DBL_CLICK:TABLE_ROW_CLICK, row.index(), row);
}
开发者ID:txe,项目名称:ieml,代码行数:14,代码来源:behavior_virtual_grid.cpp
示例18: set_radio_index
inline void set_radio_index( dom::element& el, const value_t& t )
{
selected_cb selected;
dom::element r = el.parent(); // ATTN: I assume here that all radios in the group belong to the same parent!
r.find_all(&selected, "[type='radio'][name='%S']", el.get_attribute("name"));
unsigned int idx = (unsigned int)t.get(0);
for( unsigned int n = 0; n < selected.elements.size(); ++n )
{
dom::element& e = selected.elements[n];
if ( n == idx)
e.set_state(STATE_CHECKED, 0);
else
e.set_state(0, STATE_CHECKED);
}
}
开发者ID:calupator,项目名称:wiredplane-wintools,代码行数:15,代码来源:htmlayout_controls.hpp
示例19: set_checkbox_bits
// sets checkboxes by bit mask
inline void set_checkbox_bits(dom::element& el, const value_t& t )
{
selected_cb selected;
dom::element r = el.parent(); // ATTN: I assume here that all checkboxes in the group belong to the same parent!
r.find_all(&selected, "[type='checkbox'][name='%S']", el.get_attribute("name"));
int m = 1, v = selected.elements.size()==1?(t.get(false)?1:0):t.get(0);
for( unsigned int n = 0; n < selected.elements.size(); ++n, m <<= 1 )
{
dom::element& e = selected.elements[n];
if( (v & m) != 0)
e.set_state( STATE_CHECKED, 0 ) ;
else
e.set_state( 0, STATE_CHECKED ) ;
}
}
开发者ID:calupator,项目名称:wiredplane-wintools,代码行数:16,代码来源:htmlayout_controls.hpp
示例20: notify
void notify(dom::element& el, NMHL_HYPERLINK::type code)
{
// send notification
NMHL_HYPERLINK nm;
memset(&nm,0,sizeof(nm));
HWND hwnd = el.get_element_hwnd(true);
nm.hdr.code = HLN_HYPERLINK;
nm.hdr.hwndFrom = hwnd;
nm.hdr.idFrom = GetDlgCtrlID(hwnd);
nm.action = code;
nm.he = el;
dom::element root = el.root();
const wchar_t *pHREF = el.get_attribute("href");
if(pHREF)
{
if(code == NMHL_HYPERLINK::CLICK && pHREF[0] == '#') // anchor name, this is a local hyperlink
{
if( pHREF+1 == 0 ) // href='#' case
return;
dom::element anchor_el = root.find_first("[id='%S'],[name='%S']",pHREF+1,pHREF+1);
//find_element_by_name(el.root_element(hwnd), pHREF + 1);
if(anchor_el.is_valid()) // found
{
anchor_el.scroll_to_view(true /* scroll it to top of the view */);
return; // shall host be notified about this?
}
}
wcsncpy(nm.szHREF,pHREF,MAX_URL_LENGTH);
el.combine_url(nm.szHREF,MAX_URL_LENGTH);
}
const wchar_t *pszTarget = el.get_attribute("target");
if(pszTarget)
{
if(code == NMHL_HYPERLINK::CLICK && try_to_load( root, nm.szHREF, pszTarget ))
return;
wcsncpy(nm.szTarget,pszTarget,MAX_URL_LENGTH);
}
::SendMessage(hwnd,WM_BEHAVIOR_NOTIFY,HLN_HYPERLINK,LPARAM(&nm));
}
开发者ID:calupator,项目名称:wiredplane-wintools,代码行数:48,代码来源:behavior_hyperlink.cpp
注:本文中的dom::element类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论